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 void ImportBase::setMapCenter(MapCenterObj *mc)
42 bool ImportBase::transform()
47 QString ImportBase::getTransformedFile()
49 return transformedFile;
52 /////////////////////////////////////////////////
53 bool ImportKDE3Bookmarks::transform()
55 transformedFile=tmpDir.path()+"/bookmarks.xml";
58 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
59 p.setOutputFile (transformedFile);
60 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
66 /////////////////////////////////////////////////
67 bool ImportKDE4Bookmarks::transform()
69 transformedFile=tmpDir.path()+"/bookmarks.xml";
72 p.setInputFile (tmpDir.home().path()+"/.kde4/share/apps/konqueror/bookmarks.xml");
73 p.setOutputFile (transformedFile);
74 p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
82 /////////////////////////////////////////////////
83 bool ImportFirefoxBookmarks::transform()
85 transformedFile=tmpDir.path()+"/bookmarks.xml";
88 QFile file( inputFile );
89 if ( file.open( QIODevice::ReadOnly ) )
91 QTextStream stream( &file );
92 while ( !stream.atEnd() )
93 lines += stream.readLine(); // line of text excluding '\n'
96 // TODO Generate vym from broken bookmarks above...
101 /////////////////////////////////////////////////
102 bool ImportMM::transform()
105 if (success==unzipDir (tmpDir, inputFile))
108 // Set short name, too. Search from behind:
109 transformedFile=inputFile;
110 int i=transformedFile.findRev("/");
111 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
112 transformedFile.replace(".mmap",".xml");
113 transformedFile=tmpDir.path()+"/"+transformedFile;
116 p.setInputFile (tmpDir.path()+"/Document.xml");
117 p.setOutputFile (transformedFile);
118 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");