1 #include <qmessagebox.h>
7 #include "linkablemapobj.h"
9 #include "mainwindow.h"
12 extern Main *mainWindow;
13 extern QDir vymBaseDir;
15 ImportBase::ImportBase()
18 tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
22 ImportBase::~ImportBase()
28 void ImportBase::setDir(const QString &p)
33 void ImportBase::setFile (const QString &p)
38 void ImportBase::setMapCenter(MapCenterObj *mc)
43 bool ImportBase::transform()
48 QString ImportBase::getTransformedFile()
50 return transformedFile;
53 /////////////////////////////////////////////////
54 bool ImportKDEBookmarks::transform()
56 transformedFile=tmpDir.path()+"/bookmarks.xml";
59 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
60 p.setOutputFile (transformedFile);
61 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
68 /////////////////////////////////////////////////
69 bool ImportFirefoxBookmarks::transform()
71 transformedFile=tmpDir.path()+"/bookmarks.xml";
74 QFile file( inputFile );
75 if ( file.open( QIODevice::ReadOnly ) )
77 QTextStream stream( &file );
78 while ( !stream.atEnd() )
79 lines += stream.readLine(); // line of text excluding '\n'
83 // Generate vym from broken bookmarks above...
89 /////////////////////////////////////////////////
90 bool ImportMM::transform()
93 if (success==unzipDir (tmpDir, inputFile))
96 // Set short name, too. Search from behind:
97 transformedFile=inputFile;
98 int i=transformedFile.findRev("/");
99 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
100 transformedFile.replace(".mmap",".xml");
101 transformedFile=tmpDir.path()+"/"+transformedFile;
104 p.setInputFile (tmpDir.path()+"/Document.xml");
105 p.setOutputFile (transformedFile);
106 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
109 cout << " xslt done"<<endl;