mainwindow.cpp
changeset 580 8099ebaf4515
parent 564 b8f0eefe4351
child 582 a4c3dd0e48de
     1.1 --- a/mainwindow.cpp	Mon Jul 23 12:42:02 2007 +0000
     1.2 +++ b/mainwindow.cpp	Thu Aug 09 18:34:07 2007 +0000
     1.3 @@ -310,6 +310,11 @@
     1.4  		connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) );
     1.5  	}	
     1.6  
     1.7 +	a = new QAction("Freemind...",this);
     1.8 +	a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Freemind")  );
     1.9 +	fileImportMenu->addAction (a);
    1.10 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFreemind() ) );
    1.11 +
    1.12  	a = new QAction("Mind Manager...",this);
    1.13  	a->setStatusTip ( tr( "Import %1","status tip file menu").arg(" Mind Manager")  );
    1.14  	fileImportMenu->addAction (a);
    1.15 @@ -1817,13 +1822,13 @@
    1.16  			newME->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
    1.17  			// For the very first map we do not have flagrows yet...
    1.18  			newME->select("mc:");
    1.19 -			newME->load (clipboardDir+"/"+clipboardFile,ImportReplace);
    1.20 +			newME->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
    1.21  		}
    1.22  
    1.23  	}
    1.24  }
    1.25  
    1.26 -ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
    1.27 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode, const FileType &ftype)
    1.28  {
    1.29  	ErrorCode err=success;
    1.30  	
    1.31 @@ -1990,7 +1995,7 @@
    1.32  
    1.33  			// Finally load map into mapEditor
    1.34  			me->setFilePath (mapfile,fn);
    1.35 -			err=me->load(mapfile,lmode);
    1.36 +			err=me->load(mapfile,lmode,ftype);
    1.37  
    1.38  			// Restore old (maybe empty) filepath, if this is an import
    1.39  			if (lmode!=NewMap)
    1.40 @@ -2311,7 +2316,7 @@
    1.41  		{
    1.42  			im.setFile (*it);
    1.43  			if (im.transform() && 
    1.44 -				success==fileLoad (im.getTransformedFile(),NewMap) && 
    1.45 +				success==fileLoad (im.getTransformedFile(),NewMap,FreemindMap) && 
    1.46  				currentMapEditor() )
    1.47  				currentMapEditor()->setFilePath ("");
    1.48  			++it;
    1.49 @@ -2320,6 +2325,37 @@
    1.50  	delete (fd);
    1.51  }
    1.52  
    1.53 +void Main::fileImportFreemind()
    1.54 +{
    1.55 +	QStringList filters;
    1.56 +	filters <<"Freemind map (*.mm)"<<"All files (*)";
    1.57 +	QFileDialog *fd=new QFileDialog( this);
    1.58 +	fd->setDir (lastFileDir);
    1.59 +	fd->setFileMode (QFileDialog::ExistingFiles);
    1.60 +	fd->setFilters (filters);
    1.61 +	fd->setCaption(vymName+ " - " +tr("Load Freemind map"));
    1.62 +	fd->show();
    1.63 +
    1.64 +	QString fn;
    1.65 +	if ( fd->exec() == QDialog::Accepted )
    1.66 +	{
    1.67 +		lastFileDir=fd->directory().path();
    1.68 +	    QStringList flist = fd->selectedFiles();
    1.69 +		QStringList::Iterator it = flist.begin();
    1.70 +		while( it != flist.end() ) 
    1.71 +		{
    1.72 +			fn = *it;
    1.73 +			if ( fileLoad (fn,NewMap, FreemindMap)  )
    1.74 +			{	
    1.75 +				currentMapEditor()->setFilePath ("");
    1.76 +			}	
    1.77 +			++it;
    1.78 +		}
    1.79 +	}
    1.80 +	delete (fd);
    1.81 +}
    1.82 +
    1.83 +
    1.84  void Main::fileImportMM()
    1.85  {
    1.86  	ImportMM im;