mainwindow.cpp
changeset 151 4b2e70fbacec
parent 150 85eab6b8120b
child 159 e44baadd4958
     1.1 --- a/mainwindow.cpp	Wed Aug 10 06:26:20 2005 +0000
     1.2 +++ b/mainwindow.cpp	Tue Aug 16 14:25:43 2005 +0000
     1.3 @@ -340,7 +340,7 @@
     1.4  
     1.5      menu->insertSeparator();
     1.6  
     1.7 -    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
     1.8 +    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" );
     1.9      connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
    1.10      a->addTo( menu );
    1.11  
    1.12 @@ -445,7 +445,7 @@
    1.13  	
    1.14      menu->insertSeparator();
    1.15  
    1.16 -	a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
    1.17 +	a = new QAction( tr( "Find" ), QPixmap(), tr( "Find"+QString("...") ), CTRL + Key_F, this, "find" );
    1.18      connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
    1.19      a->addTo( menu );
    1.20      
    1.21 @@ -458,7 +458,7 @@
    1.22  	a->setEnabled (false);
    1.23  	actionEditOpenURL=a;
    1.24  
    1.25 -	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
    1.26 +	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL"+QString("...") ), SHIFT + CTRL + Key_U, this, "url" );
    1.27      connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
    1.28      a->addTo( menu );
    1.29  	a->setEnabled (false);
    1.30 @@ -487,7 +487,7 @@
    1.31  	a->setEnabled (false);
    1.32  	actionEditOpenVymLink=a;
    1.33  	
    1.34 -    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
    1.35 +    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link"+QString("...") ), 0, this, "editLinkMap" );
    1.36      connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
    1.37      a->addTo( menu );
    1.38  	a->setEnabled (false);
    1.39 @@ -502,7 +502,7 @@
    1.40  
    1.41  	menu->insertSeparator();
    1.42  
    1.43 -    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
    1.44 +    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info"+QString("...") ), 0, this, "editMapInfo" );
    1.45      connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
    1.46      a->addTo( menu );
    1.47  	a->setEnabled (true);
    1.48 @@ -623,7 +623,7 @@
    1.49  	actionListBranches.append(a);
    1.50  	actionEditSelectLast=a;
    1.51  
    1.52 -    a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
    1.53 +    a = new QAction( tr( "Add Image" ),tr( "Add Image" )+QString("..."), 0, this, "loadImage" );
    1.54      connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
    1.55  	actionEditLoadImage=a;
    1.56  
    1.57 @@ -639,7 +639,7 @@
    1.58      QAction *a;
    1.59      QPixmap pix( 16,16);
    1.60      pix.fill (black);
    1.61 -    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
    1.62 +    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" )+QString("..."), 0, this, "formatColor" );
    1.63      connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
    1.64      actionFormatColor->addTo( tb );
    1.65      actionFormatColor->addTo( menu );
    1.66 @@ -704,10 +704,10 @@
    1.67  	a->addTo( menu );
    1.68  	actionFormatLinkColorHint=a;
    1.69      pix.fill (white);
    1.70 -    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
    1.71 +    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color"+QString("...") ), 0, this, "formatLinkColor" );
    1.72      connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
    1.73      actionFormatLinkColor->addTo( menu );
    1.74 -    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
    1.75 +    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" )+QString("..."), 0, this, "formatBackColor" );
    1.76      connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
    1.77      actionFormatBackColor->addTo( menu );
    1.78  }
    1.79 @@ -721,7 +721,7 @@
    1.80      menuBar()->insertItem( tr( "&View" ), menu );
    1.81  
    1.82      QAction *a;
    1.83 -    a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
    1.84 +    a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), CTRL + Key_0, this, "zoomReset" );
    1.85      connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
    1.86      a->addTo( tb );
    1.87      a->addTo( menu );
    1.88 @@ -794,11 +794,11 @@
    1.89  	QAction *a;
    1.90  
    1.91  
    1.92 -    a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
    1.93 +    a = new QAction( tr( "Set application to open pdf files"), QPixmap(), tr( "Set application to open pdf files")+QString("...") , 0, this, "setPDF" );
    1.94      connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
    1.95      a->addTo( menu );
    1.96  
    1.97 -    a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
    1.98 +    a = new QAction( tr( "Set application to open external links"), QPixmap(), tr( "Set application to open external links")+QString("..."), 0, this, "setURL" );
    1.99      connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
   1.100      a->addTo( menu );
   1.101  
   1.102 @@ -821,19 +821,19 @@
   1.103      a->addTo( menu );
   1.104  	actionSettingsAutoselectText=a;
   1.105  	
   1.106 -    a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
   1.107 +    a= new QAction( tr( "Pasting into new branch" ), QPixmap(), tr( "pasting into new branch" ), 0, this, "pastenewheading" );
   1.108  	a->setToggleAction(true);
   1.109  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
   1.110      a->addTo( menu );
   1.111  	actionSettingsPasteNewHeading=a;
   1.112  	
   1.113 -    a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
   1.114 +    a= new QAction( tr( "Delete key for deleting branches" ), QPixmap(), tr( "Delete key" ), 0, this, "delkey" );
   1.115  	a->setToggleAction(true);
   1.116  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
   1.117      a->addTo( menu );
   1.118  	actionSettingsUseDelKey=a;
   1.119  
   1.120 -    a= new QAction( tr( "Use exclusive flags in flag toolbars" ), QPixmap(), tr( "Enable exclusive flags" ), 0, this, "flaggroups" );
   1.121 +    a= new QAction( tr( "Use exclusive flags in flag toolbars" ), QPixmap(), tr( "Exclusive flags" ), 0, this, "flaggroups" );
   1.122  	a->setToggleAction(true);
   1.123  	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
   1.124      a->addTo( menu );
   1.125 @@ -966,22 +966,22 @@
   1.126  	// Context menu for exports
   1.127  	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
   1.128  
   1.129 -    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
   1.130 +    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" +QString("...")), 0, this, "exportASCII" );
   1.131      connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
   1.132  	a->addTo( exportMenu );
   1.133  
   1.134 -	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
   1.135 +	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML"+QString("...") );
   1.136      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
   1.137      a->addTo( exportMenu );
   1.138  	
   1.139      if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
   1.140  	{
   1.141 -		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
   1.142 +		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML"+QString("...") );
   1.143  		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
   1.144  		a->addTo( exportMenu );
   1.145  	}
   1.146  
   1.147 -	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
   1.148 +	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" )+QString("..."), ALT + Key_X, this, "exportXHTML" );
   1.149      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
   1.150      a->addTo( exportMenu );
   1.151  
   1.152 @@ -1426,9 +1426,10 @@
   1.153  
   1.154  	bool saveZipped=currentMapEditor()->saveZipped();
   1.155  
   1.156 -	if (currentMapEditor())
   1.157 +	MapEditor *	me=currentMapEditor();
   1.158 +	if (me)
   1.159  	{
   1.160 -		QString fn=currentMapEditor()->getFilePath();
   1.161 +		QString fn=me->getFilePath();
   1.162  		// filename=unnamed, filepath="" in constructor...
   1.163  		if ( !fn.isEmpty() ) 
   1.164  		{	
   1.165 @@ -1479,12 +1480,12 @@
   1.166  				char tmpdir1[]="/tmp/vym-XXXXXX";	
   1.167  				tmpMapDir=mkdtemp(tmpdir1);
   1.168  			
   1.169 -				safeFilePath=currentMapEditor()->getFilePath();
   1.170 -				currentMapEditor()->setFilePath (tmpMapDir+"/"+
   1.171 -					currentMapEditor()->getMapName()+ ".xml",
   1.172 +				safeFilePath=me->getFilePath();
   1.173 +				me->setFilePath (tmpMapDir+"/"+
   1.174 +					me->getMapName()+ ".xml",
   1.175  					safeFilePath);
   1.176 -				currentMapEditor()->save (savemode);
   1.177 -				currentMapEditor()->setFilePath (safeFilePath);
   1.178 +				me->save (savemode);
   1.179 +				me->setFilePath (safeFilePath);
   1.180  				
   1.181  				// zip the temporary directory
   1.182  				Process *zipProc=new Process ();
   1.183 @@ -1526,10 +1527,10 @@
   1.184  			else
   1.185  			{
   1.186  				// Save unzipped. 
   1.187 -				safeFilePath=currentMapEditor()->getFilePath();
   1.188 -				currentMapEditor()->setFilePath (fn, safeFilePath);
   1.189 -				currentMapEditor()->save (savemode);
   1.190 -				currentMapEditor()->setFilePath (safeFilePath);
   1.191 +				safeFilePath=me->getFilePath();
   1.192 +				me->setFilePath (fn, safeFilePath);
   1.193 +				me->save (savemode);
   1.194 +				me->setFilePath (safeFilePath);
   1.195  			} // save zipped 	
   1.196  		} // filepath available
   1.197  		else
   1.198 @@ -1541,19 +1542,22 @@
   1.199  		}
   1.200      }
   1.201  
   1.202 -	if (currentMapEditor()->saveZipped())
   1.203 +	if (me->saveZipped())
   1.204  	{
   1.205  		// Delete tmpDir
   1.206  		system ( "rm -rf "+ tmpMapDir );
   1.207  	} 
   1.208  
   1.209  	if (err==success)
   1.210 +	{
   1.211  		statusBar()->message( 
   1.212 -			tr("Saved")+" " + currentMapEditor()->getFilePath(), 
   1.213 +			tr("Saved")+" " + me->getFilePath(), 
   1.214  			statusbarTime );
   1.215 -	else		
   1.216 +		lastMaps.prepend(me->getFilePath() );
   1.217 +		setupLastMapsMenu();
   1.218 +	} else		
   1.219  		statusBar()->message( 
   1.220 -			tr("Couldn't save")+" " + currentMapEditor()->getFilePath(), 
   1.221 +			tr("Couldn't save")+" " + me->getFilePath(), 
   1.222  			statusbarTime );
   1.223  }
   1.224  
   1.225 @@ -2036,7 +2040,7 @@
   1.226  
   1.227  void Main::editDeleteSelection()
   1.228  {
   1.229 -	if (currentMapEditor())
   1.230 +	if (currentMapEditor() && actionSettingsUseDelKey->isOn())
   1.231  		currentMapEditor()->deleteSelection();
   1.232  }
   1.233