Various fixes, also from 1.12. branch
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 ImportKDEBookmarks::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");
67 /////////////////////////////////////////////////
68 bool ImportFirefoxBookmarks::transform()
70 transformedFile=tmpDir.path()+"/bookmarks.xml";
73 QFile file( inputFile );
74 if ( file.open( QIODevice::ReadOnly ) )
76 QTextStream stream( &file );
77 while ( !stream.atEnd() )
78 lines += stream.readLine(); // line of text excluding '\n'
81 // TODO Generate vym from broken bookmarks above...
86 /////////////////////////////////////////////////
87 bool ImportMM::transform()
90 if (success==unzipDir (tmpDir, inputFile))
93 // Set short name, too. Search from behind:
94 transformedFile=inputFile;
95 int i=transformedFile.findRev("/");
96 if (i>=0) transformedFile=transformedFile.remove (0,i+1);
97 transformedFile.replace(".mmap",".xml");
98 transformedFile=tmpDir.path()+"/"+transformedFile;
101 p.setInputFile (tmpDir.path()+"/Document.xml");
102 p.setOutputFile (transformedFile);
103 p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");