3 #include "linkablemapobj.h"
5 #include "mainwindow.h"
8 extern Main *mainWindow;
9 extern QDir vymBaseDir;
11 ImportBase::ImportBase()
14 tmpDir.setPath (makeTmpDir(ok,"vym-import"));
15 if (!tmpDir.exists() || !ok)
16 QMessageBox::critical( 0, QObject::tr( "Error" ),
17 QObject::tr("Couldn't access temporary directory\n"));
21 ImportBase::~ImportBase()
27 void ImportBase::setDir(const QString &p)
32 void ImportBase::setFile (const QString &p)
37 bool ImportBase::transform()
42 QString ImportBase::getTransformedFile()
44 return transformedFile;
47 /////////////////////////////////////////////////
48 bool ImportKDE3Bookmarks::transform()
50 transformedFile=tmpDir.path()+"/bookmarks.xml";
53 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
54 p.setOutputFile (transformedFile);
55 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
61 /////////////////////////////////////////////////
62 bool ImportKDE4Bookmarks::transform()
64 transformedFile=tmpDir.path()+"/bookmarks.xml";
67 p.setInputFile (tmpDir.home().path()+"/.kde4/share/apps/konqueror/bookmarks.xml");
68 p.setOutputFile (transformedFile);
69 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
77 /////////////////////////////////////////////////
78 bool ImportFirefoxBookmarks::transform()
80 transformedFile=tmpDir.path()+"/bookmarks.xml";
83 QFile file( inputFile );
84 if ( file.open( QIODevice::ReadOnly ) )
86 QTextStream stream( &file );
87 while ( !stream.atEnd() )
88 lines += stream.readLine(); // line of text excluding '\n'
91 // TODO Generate vym from broken bookmarks above...
96 /////////////////////////////////////////////////
97 bool ImportMM::transform()
100 if (success==unzipDir (tmpDir, inputFile))
103 // Set short name, too. Search from behind:
104 transformedFile=inputFile;
105 int i=transformedFile.findRev("/");
106 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
107 transformedFile.replace(".mmap",".xml");
108 transformedFile=tmpDir.path()+"/"+transformedFile;
111 p.setInputFile (tmpDir.path()+"/Document.xml");
112 p.setOutputFile (transformedFile);
113 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");