1 #include <qmessagebox.h>
5 #include "linkablemapobj.h"
7 #include "mainwindow.h"
10 extern Main *mainWindow;
11 extern QDir vymBaseDir;
13 ImportBase::ImportBase()
16 tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
20 ImportBase::~ImportBase()
26 void ImportBase::setDir(const QString &p)
31 void ImportBase::setFile (const QString &p)
36 void ImportBase::setMapCenter(MapCenterObj *mc)
41 bool ImportBase::transform()
46 QString ImportBase::getTransformedFile()
48 return transformedFile;
51 /////////////////////////////////////////////////
52 bool ImportKDEBookmarks::transform()
54 transformedFile=tmpDir.path()+"/bookmarks.xml";
57 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
58 p.setOutputFile (transformedFile);
59 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
66 /////////////////////////////////////////////////
67 bool ImportFirefoxBookmarks::transform()
69 transformedFile=tmpDir.path()+"/bookmarks.xml";
72 QFile file( inputFile );
73 if ( file.open( IO_ReadOnly ) )
75 QTextStream stream( &file );
76 while ( !stream.atEnd() )
77 lines += stream.readLine(); // line of text excluding '\n'
81 // Generate vym from broken bookmarks above...
87 /////////////////////////////////////////////////
88 bool ImportMM::transform()
91 if (success==unzipDir (tmpDir, inputFile))
93 cout << "Unzipped "<<inputFile<<" to "<<tmpDir.path()<<endl;
95 // Set short name, too. Search from behind:
96 transformedFile=inputFile;
97 int i=transformedFile.findRev("/");
98 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
99 transformedFile.replace(".mmap",".xml");
100 transformedFile=tmpDir.path()+"/"+transformedFile;
101 cout << " transformedFile="<<transformedFile<<endl;
104 p.setInputFile (tmpDir.path()+"/Document.xml");
105 p.setOutputFile (transformedFile);
106 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
109 cout << " xslt done"<<endl;