7 #include "linkablemapobj.h"
9 #include "mainwindow.h"
12 extern Main *mainWindow;
13 extern QDir vymBaseDir;
15 ImportBase::ImportBase()
18 tmpDir.setPath (makeUniqueDir(ok,"/tmp/vym-XXXXXX"));
19 if (!tmpDir.exists() || !ok)
20 QMessageBox::critical( 0, QObject::tr( "Error" ),
21 QObject::tr("Couldn't access temporary directory\n"));
25 ImportBase::~ImportBase()
31 void ImportBase::setDir(const QString &p)
36 void ImportBase::setFile (const QString &p)
41 void ImportBase::setMapCenter(MapCenterObj *mc)
46 bool ImportBase::transform()
51 QString ImportBase::getTransformedFile()
53 return transformedFile;
56 /////////////////////////////////////////////////
57 bool ImportKDEBookmarks::transform()
59 transformedFile=tmpDir.path()+"/bookmarks.xml";
62 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
63 p.setOutputFile (transformedFile);
64 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
71 /////////////////////////////////////////////////
72 bool ImportFirefoxBookmarks::transform()
74 transformedFile=tmpDir.path()+"/bookmarks.xml";
77 QFile file( inputFile );
78 if ( file.open( QIODevice::ReadOnly ) )
80 QTextStream stream( &file );
81 while ( !stream.atEnd() )
82 lines += stream.readLine(); // line of text excluding '\n'
86 // Generate vym from broken bookmarks above...
92 /////////////////////////////////////////////////
93 bool ImportMM::transform()
96 if (success==unzipDir (tmpDir, inputFile))
99 // Set short name, too. Search from behind:
100 transformedFile=inputFile;
101 int i=transformedFile.findRev("/");
102 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
103 transformedFile.replace(".mmap",".xml");
104 transformedFile=tmpDir.path()+"/"+transformedFile;
107 p.setInputFile (tmpDir.path()+"/Document.xml");
108 p.setOutputFile (transformedFile);
109 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
112 cout << " xslt done"<<endl;