mainwindow.cpp
branchqt4-port
changeset 11 b8c547f0fc58
parent 10 e2a80d9b5858
child 12 58e7594239df
     1.1 --- a/mainwindow.cpp	Thu Jul 06 15:39:54 2006 +0000
     1.2 +++ b/mainwindow.cpp	Thu Jul 27 14:07:11 2006 +0000
     1.3 @@ -131,7 +131,6 @@
     1.4  extern QMenu* branchLinksContextMenuEdit;
     1.5  extern QMenu* branchLinksContextMenuFollow;
     1.6  extern QMenu* floatimageContextMenu;
     1.7 -extern QMenu* saveImageFormatMenu;
     1.8  extern QMenu* canvasContextMenu;
     1.9  extern QMenu* fileLastMapsMenu;
    1.10  extern QMenu* fileImportMenu;
    1.11 @@ -144,6 +143,7 @@
    1.12  
    1.13  extern QDir vymBaseDir;
    1.14  extern QDir lastImageDir;
    1.15 +extern QDir lastFileDir;
    1.16  extern QString iconPath;
    1.17  extern QString flagsPath;
    1.18  
    1.19 @@ -1553,14 +1553,9 @@
    1.20  	
    1.21  	// Context menu for floatimage
    1.22  	floatimageContextMenu =new QMenu (this);
    1.23 -	saveImageFormatMenu=floatimageContextMenu->addMenu (tr("Save image"));
    1.24 -
    1.25 -    foreach (QByteArray format, QImageWriter::supportedImageFormats()) 
    1.26 -	{
    1.27 -        QString text = tr("%1...").arg(QString(format).toUpper());
    1.28 -		a= new QAction (text,this);
    1.29 -		saveImageFormatMenu->addAction ( a );
    1.30 -    }
    1.31 +	a= new QAction (tr ("Save image"),this);
    1.32 +	connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
    1.33 +	floatimageContextMenu->addAction (a);
    1.34  
    1.35  	floatimageContextMenu->addSeparator();	
    1.36  	actionEditCopy->addTo( floatimageContextMenu );
    1.37 @@ -1920,8 +1915,7 @@
    1.38  void Main::fileLoad(const LoadMode &lmode)
    1.39  {
    1.40  	Q3FileDialog *fd=new Q3FileDialog( this);
    1.41 -	if (!lastFileDir.isEmpty()) 
    1.42 -		fd->setDir (lastFileDir);
    1.43 +	fd->setDir (lastFileDir);
    1.44  	fd->setMode (Q3FileDialog::ExistingFiles);
    1.45  	fd->addFilter ("XML (*.xml)");
    1.46  	fd->addFilter ("VYM map (*.vym *.vyp)");
    1.47 @@ -2188,8 +2182,7 @@
    1.48  	ImportMM im;
    1.49  
    1.50  	Q3FileDialog *fd=new Q3FileDialog( this);
    1.51 -	if (!lastFileDir.isEmpty()) 
    1.52 -		fd->setDir (lastFileDir);
    1.53 +	fd->setDir (lastFileDir);
    1.54  	fd->setMode (Q3FileDialog::ExistingFiles);
    1.55  	fd->addFilter ("Mind Manager (*.mmap)");
    1.56  	fd->setCaption(tr("Import")+" "+"Mind Manager");
    1.57 @@ -2360,14 +2353,22 @@
    1.58  	//fd->setPreviewMode( QFileDialog::Contents );
    1.59  	fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
    1.60  	fd->setDir (QDir().current());
    1.61 -	fd->show();
    1.62 -
    1.63 -	if ( fd->exec() == QDialog::Accepted )
    1.64 +	if (fd->foundConfig())
    1.65  	{
    1.66 -		QString fn=fd->selectedFile();
    1.67 -		//lastImageDir=fn.left(fn.findRev ("/"));
    1.68 -		if (currentMapEditor())
    1.69 -			currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
    1.70 +		fd->show();
    1.71 +
    1.72 +		if ( fd->exec() == QDialog::Accepted )
    1.73 +		{
    1.74 +			QString fn=fd->selectedFile();
    1.75 +			//lastImageDir=fn.left(fn.findRev ("/"));
    1.76 +			if (currentMapEditor())
    1.77 +				currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
    1.78 +		}
    1.79 +	} else
    1.80 +	{
    1.81 +		QMessageBox::warning(0, 
    1.82 +		tr("Warning"),
    1.83 +		tr("Couldn't find configuration for export to Open Office\n"));
    1.84  	}
    1.85  }
    1.86  
    1.87 @@ -2795,10 +2796,10 @@
    1.88  		currentMapEditor()->loadFloatImage();
    1.89  }
    1.90  
    1.91 -void Main::editSaveImage(int item)
    1.92 +void Main::editSaveImage()
    1.93  {
    1.94  	if (currentMapEditor())
    1.95 -		currentMapEditor()->saveFloatImage(item);
    1.96 +		currentMapEditor()->saveFloatImage();
    1.97  }
    1.98  
    1.99  void Main::editFollowXLink(QAction *a)