X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=imports.cpp;fp=imports.cpp;h=0000000000000000000000000000000000000000;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=87a62e621317fd59531a4b4bdc2033cc03d30d61;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/imports.cpp b/imports.cpp deleted file mode 100644 index 87a62e6..0000000 --- a/imports.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "file.h" -#include "imports.h" -#include "linkablemapobj.h" -#include "misc.h" -#include "mainwindow.h" -#include "xsltproc.h" - -#include - -extern Main *mainWindow; -extern QDir vymBaseDir; - -ImportBase::ImportBase() -{ - bool ok; - tmpDir.setPath (makeTmpDir(ok,"vym-import")); - if (!tmpDir.exists() || !ok) - QMessageBox::critical( 0, QObject::tr( "Error" ), - QObject::tr("Couldn't access temporary directory\n")); -} - - -ImportBase::~ImportBase() -{ - // Remove tmpdir - removeDir (tmpDir); -} - -void ImportBase::setDir(const QString &p) -{ - inputDir=p; -} - -void ImportBase::setFile (const QString &p) -{ - inputFile=p; -} - -bool ImportBase::transform() -{ - return true; -} - -QString ImportBase::getTransformedFile() -{ - return transformedFile; -} - -///////////////////////////////////////////////// -bool ImportFirefoxBookmarks::transform() -{ - transformedFile=tmpDir.path()+"/bookmarks.xml"; - - QStringList lines; - QFile file( inputFile ); - if ( file.open( QIODevice::ReadOnly ) ) - { - QTextStream stream( &file ); - while ( !stream.atEnd() ) - lines += stream.readLine(); // line of text excluding '\n' - file.close(); - } - // TODO Generate vym from broken bookmarks above... - - return true; -} - -///////////////////////////////////////////////// -bool ImportMM::transform() -{ - // try to unzip - if (File::Success==unzipDir (tmpDir, inputFile)) - { - - // Set short name, too. Search from behind: - transformedFile=inputFile; - int i=transformedFile.lastIndexOf ("/"); - if (i>=0) transformedFile=transformedFile.remove (0,i+1); - transformedFile.replace(".mmap",".xml"); - transformedFile=tmpDir.path()+"/"+transformedFile; - - XSLTProc p; - p.setInputFile (tmpDir.path()+"/Document.xml"); - p.setOutputFile (transformedFile); - p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl"); - p.process(); - - return true; - } else - return false; - -}