1.1 --- a/file.cpp Tue Feb 21 16:18:23 2006 +0000
1.2 +++ b/file.cpp Tue Feb 21 16:18:23 2006 +0000
1.3 @@ -183,6 +183,7 @@
1.4 zipProc->clearArguments();
1.5 zipProc->setWorkingDirectory (zipDir);
1.6 zipProc->addArgument ("unzip");
1.7 + zipProc->addArgument ("-o"); // overwrite existing files!
1.8 zipProc->addArgument (zipName );
1.9 zipProc->addArgument ("-d");
1.10 zipProc->addArgument (zipDir.path());
1.11 @@ -219,7 +220,6 @@
1.12 }
1.13 }
1.14 }
1.15 - if (err==aborted) qWarning("file.cpp: unzip aborted");
1.16 return err;
1.17 }
1.18
2.1 --- a/icons/vym-48x48.xpm Tue Feb 21 16:18:23 2006 +0000
2.2 +++ b/icons/vym-48x48.xpm Tue Feb 21 16:18:23 2006 +0000
2.3 @@ -1,24 +1,54 @@
2.4 /* XPM */
2.5 -static char * vym_xpm[] = {
2.6 -"16 16 5 1",
2.7 +static char * vym_48x48_xpm[] = {
2.8 +"48 48 3 1",
2.9 " c None",
2.10 -". c #0026FF",
2.11 -"+ c #001EFF",
2.12 -"@ c #FF0000",
2.13 -"# c #1C22E3",
2.14 -" ",
2.15 -" ...+ @@ ",
2.16 -" @@@@@@#@@@ ",
2.17 -" ...@+..@@ ",
2.18 -" ..@@#.. ",
2.19 -" @@ ..@.@@@@@ ",
2.20 -" @@@@.... ",
2.21 -" @@++...... ",
2.22 -" ...... ",
2.23 -" ..... ",
2.24 -" ..... ",
2.25 -" .... ",
2.26 -" .... ",
2.27 -" ",
2.28 -" ",
2.29 -" "};
2.30 +". c #FF0000",
2.31 +"+ c #0026FF",
2.32 +" ",
2.33 +" ",
2.34 +" ......... ",
2.35 +" .... ",
2.36 +" ++++++++++ . ",
2.37 +" .... ++++++++++++.. ",
2.38 +" ... ..............++++++++............ ",
2.39 +" ... +++++..+++++...++ ",
2.40 +" ... +++++++..+++..++++ ",
2.41 +" .... ++++++++.++..++++++ ",
2.42 +" ++++++++.++.+++++++ ",
2.43 +" ++++++++...++++++++ ",
2.44 +" +++++++..+++++++++++ ",
2.45 +" +++++++....+++++++++ ",
2.46 +" +++++..++..++++++++ ...... ",
2.47 +" +++++.++++...+++++.... ",
2.48 +" ++++++.++++++....... ",
2.49 +" ++++++..+++++++++....... ",
2.50 +" ........ ++++++.++++++++++++++ ..... ",
2.51 +" ......+++..++++++++++++++ ",
2.52 +" ........+++++++++++++++ ",
2.53 +" .....++..++++++++++++++++++ ",
2.54 +" ..... ++..+++++++++++++++++++ ",
2.55 +" +..++++++++++++++++++++ ",
2.56 +" ....++++++++++++++++++++ ",
2.57 +" ..... +++++++++++++++++ ",
2.58 +" .... +++++++++++++++++ ",
2.59 +" ++++++++++++++++ ",
2.60 +" ++++++++++++++++ ",
2.61 +" ++++++++++++++++ ",
2.62 +" ++++++++++++++++ ",
2.63 +" +++++++++++++++ ",
2.64 +" ++++++++++++++ ",
2.65 +" +++++++++++ ",
2.66 +" ++++++++++ ",
2.67 +" ++++++++++ ",
2.68 +" ++++++++++ ",
2.69 +" ++++++++++ ",
2.70 +" +++++++++ ",
2.71 +" +++++++ ",
2.72 +" ",
2.73 +" ",
2.74 +" ",
2.75 +" ",
2.76 +" ",
2.77 +" ",
2.78 +" ",
2.79 +" "};
3.1 --- a/imports.cpp Tue Feb 21 16:18:23 2006 +0000
3.2 +++ b/imports.cpp Tue Feb 21 16:18:23 2006 +0000
3.3 @@ -1,13 +1,14 @@
3.4 #include <qmessagebox.h>
3.5
3.6 +#include "file.h"
3.7 #include "imports.h"
3.8 -#include "file.h"
3.9 #include "linkablemapobj.h"
3.10 #include "misc.h"
3.11 #include "mainwindow.h"
3.12 #include "xsltproc.h"
3.13
3.14 extern Main *mainWindow;
3.15 +extern QDir vymBaseDir;
3.16
3.17 ImportBase::ImportBase()
3.18 {
3.19 @@ -19,7 +20,7 @@
3.20 ImportBase::~ImportBase()
3.21 {
3.22 // Remove tmpdir
3.23 - removeDir (tmpDir);
3.24 + //removeDir (tmpDir);
3.25 }
3.26
3.27 void ImportBase::setDir(const QString &p)
3.28 @@ -37,20 +38,57 @@
3.29 mapCenter=mc;
3.30 }
3.31
3.32 +bool ImportBase::transform()
3.33 +{
3.34 + return true;
3.35 +}
3.36 +
3.37 +QString ImportBase::getTransformedFile()
3.38 +{
3.39 + return transformedFile;
3.40 +}
3.41 +
3.42 /////////////////////////////////////////////////
3.43 -void ImportKDEBookmarks::transform()
3.44 +bool ImportKDEBookmarks::transform()
3.45 {
3.46 transformedFile=tmpDir.path()+"/bookmarks.xml";
3.47
3.48 XSLTProc p;
3.49 p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
3.50 p.setOutputFile (transformedFile);
3.51 - p.setXSLFile ("styles/kdebookmarks2vym.xsl");
3.52 + p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
3.53 p.process();
3.54 +
3.55 + return true;
3.56 }
3.57
3.58 -QString ImportKDEBookmarks::getTransformedFile()
3.59 +
3.60 +/////////////////////////////////////////////////
3.61 +bool ImportMM::transform()
3.62 {
3.63 - return transformedFile;
3.64 + // try to unzip
3.65 + if (success==unzipDir (tmpDir, inputFile))
3.66 + {
3.67 + cout << "Unzipped "<<inputFile<<" to "<<tmpDir.path()<<endl;
3.68 +
3.69 + // Set short name, too. Search from behind:
3.70 + transformedFile=inputFile;
3.71 + int i=transformedFile.findRev("/");
3.72 + if (i>=0) transformedFile=transformedFile.remove (0,i+1);
3.73 + transformedFile.replace(".mmap",".xml");
3.74 + transformedFile=tmpDir.path()+"/"+transformedFile;
3.75 + cout << " transformedFile="<<transformedFile<<endl;
3.76 +
3.77 + XSLTProc p;
3.78 + p.setInputFile (tmpDir.path()+"/Document.xml");
3.79 + p.setOutputFile (transformedFile);
3.80 + p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
3.81 + p.process();
3.82 +
3.83 + cout << " xslt done"<<endl;
3.84 +
3.85 + return true;
3.86 + } else
3.87 + return false;
3.88 +
3.89 }
3.90 -
4.1 --- a/imports.h Tue Feb 21 16:18:23 2006 +0000
4.2 +++ b/imports.h Tue Feb 21 16:18:23 2006 +0000
4.3 @@ -15,15 +15,18 @@
4.4 {
4.5 public:
4.6 ImportBase();
4.7 - ~ImportBase();
4.8 - void setDir(const QString &);
4.9 - void setFile(const QString &);
4.10 - void setMapCenter (MapCenterObj*);
4.11 + virtual ~ImportBase();
4.12 + virtual void setDir(const QString &);
4.13 + virtual void setFile(const QString &);
4.14 + virtual void setMapCenter (MapCenterObj*);
4.15 + virtual bool transform();
4.16 + virtual QString getTransformedFile();
4.17 protected:
4.18 QDir tmpDir;
4.19 QString inputDir;
4.20 QString inputFile;
4.21 MapCenterObj *mapCenter;
4.22 + QString transformedFile;
4.23
4.24 };
4.25
4.26 @@ -31,12 +34,17 @@
4.27 class ImportKDEBookmarks:public ImportBase
4.28 {
4.29 public:
4.30 - void transform();
4.31 - QString getTransformedFile();
4.32 -private:
4.33 - QString transformedFile;
4.34 + bool transform();
4.35 };
4.36
4.37
4.38 +///////////////////////////////////////////////////////////////////////
4.39 +class ImportMM:public ImportBase
4.40 +{
4.41 +public:
4.42 + bool transform();
4.43 +};
4.44 +
4.45 +
4.46
4.47 #endif
5.1 --- a/main.cpp Tue Feb 21 16:18:23 2006 +0000
5.2 +++ b/main.cpp Tue Feb 21 16:18:23 2006 +0000
5.3 @@ -24,6 +24,7 @@
5.4 Main *mainWindow; // used in BranchObj::select()
5.5 QString tmpVymDir; // All temp files go there, created in mainwindow
5.6 QString clipboardDir; // Clipboard used in all mapEditors
5.7 +QDir vymBaseDir; // Containing all styles, scripts, images, ...
5.8 bool clipboardEmpty;
5.9 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
5.10 FlagRowObj *standardFlagsDefault;
5.11 @@ -131,17 +132,17 @@
5.12 factory->setPixmap("vym_128x128", QPixmap(vym_128x128_xpm));
5.13 qInitNetworkProtocols();
5.14
5.15 - // Use /usr/share/vym or /usr/local/share/vym or .
5.16 - QDir shareDir;
5.17 - shareDir.setPath ("/usr/share/vym");
5.18 - if (!shareDir.exists())
5.19 - shareDir.setPath ("/usr/local/share/vym");
5.20 - if (!shareDir.exists())
5.21 - shareDir.setPath(".");
5.22 + // Use /usr/share/vym or /usr/local/share/vym or . ?
5.23 + QDir vymBaseDir;
5.24 + vymBaseDir.setPath ("/usr/share/vym");
5.25 + if (!vymBaseDir.exists())
5.26 + vymBaseDir.setPath ("/usr/local/share/vym");
5.27 + if (!vymBaseDir.exists())
5.28 + vymBaseDir.setPath(vymBaseDir.currentDirPath() );
5.29
5.30 // Initialize translations
5.31 QTranslator translator (0);
5.32 - translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
5.33 + translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
5.34 app.installTranslator( &translator );
5.35
5.36 // Initializing the row of system flags
6.1 --- a/mainwindow.cpp Tue Feb 21 16:18:23 2006 +0000
6.2 +++ b/mainwindow.cpp Tue Feb 21 16:18:23 2006 +0000
6.3 @@ -390,6 +390,10 @@
6.4 connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
6.5 a->addTo (importMenu);
6.6
6.7 + a = new QAction( tr( "Import")+" "+tr("Mind Manager" ), QPixmap(), tr("Mind Manager"), 0, this, "importMM" );
6.8 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
6.9 + a->addTo (importMenu);
6.10 +
6.11 a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" );
6.12 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
6.13 a->addTo( importMenu);
6.14 @@ -1123,7 +1127,9 @@
6.15
6.16 branchContextMenu->insertSeparator();
6.17 actionFormatIncludeImagesVer->addTo( branchContextMenu );
6.18 - // FIXME not implemented yet actionFormatIncludeImagesHor->addTo( branchContextMenu );
6.19 + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
6.20 + // FIXME not implemented yet
6.21 + actionFormatIncludeImagesHor->addTo( branchContextMenu );
6.22 actionFormatHideLinkUnselected->addTo( branchContextMenu );
6.23
6.24 // Context Menu for links in a branch menu
6.25 @@ -1778,12 +1784,6 @@
6.26 fileSaveAs (CompleteMap);
6.27 }
6.28
6.29 -void Main::fileImportDir()
6.30 -{
6.31 - if (currentMapEditor())
6.32 - currentMapEditor()->importDir();
6.33 -}
6.34 -
6.35 void Main::fileImportKDEBookmarks()
6.36 {
6.37 ImportKDEBookmarks im;
6.38 @@ -1792,6 +1792,44 @@
6.39 currentMapEditor()->setFilePath ("");
6.40 }
6.41
6.42 +void Main::fileImportMM()
6.43 +{
6.44 + ImportMM im;
6.45 +
6.46 + QFileDialog *fd=new QFileDialog( this);
6.47 + if (!lastFileDir.isEmpty())
6.48 + fd->setDir (lastFileDir);
6.49 + fd->setMode (QFileDialog::ExistingFiles);
6.50 + fd->addFilter ("Mind Manager (*.mmap)");
6.51 + fd->setCaption(tr("Import")+" "+"Mind Manager");
6.52 + fd->show();
6.53 +
6.54 + if ( fd->exec() == QDialog::Accepted )
6.55 + {
6.56 + lastFileDir=fd->dirPath();
6.57 + QStringList flist = fd->selectedFiles();
6.58 + QStringList::Iterator it = flist.begin();
6.59 + while( it != flist.end() )
6.60 + {
6.61 + im.setFile (*it);
6.62 + if (im.transform() &&
6.63 + success==fileLoad (im.getTransformedFile(),NewMap) &&
6.64 + currentMapEditor() )
6.65 + currentMapEditor()->setFilePath ("");
6.66 +
6.67 + ++it;
6.68 + }
6.69 + }
6.70 + delete (fd);
6.71 +
6.72 +}
6.73 +
6.74 +void Main::fileImportDir()
6.75 +{
6.76 + if (currentMapEditor())
6.77 + currentMapEditor()->importDir();
6.78 +}
6.79 +
6.80 void Main::fileExportXML()
6.81 {
6.82 if (currentMapEditor())
7.1 --- a/mainwindow.h Tue Feb 21 16:18:23 2006 +0000
7.2 +++ b/mainwindow.h Tue Feb 21 16:18:23 2006 +0000
7.3 @@ -65,8 +65,9 @@
7.4 void fileSave();
7.5 void fileSaveAs(const SaveMode &);
7.6 void fileSaveAs();
7.7 + void fileImportKDEBookmarks();
7.8 + void fileImportMM();
7.9 void fileImportDir();
7.10 - void fileImportKDEBookmarks();
7.11 void fileExportXML();
7.12 void fileExportHTML();
7.13 void fileExportXHTML();