mainwindow.cpp
branchqt4-port
changeset 17 557239819c45
parent 16 41c3d7f9f532
child 18 70c41284cb48
     1.1 --- a/mainwindow.cpp	Tue Aug 29 08:31:42 2006 +0000
     1.2 +++ b/mainwindow.cpp	Wed Aug 30 12:16:25 2006 +0000
     1.3 @@ -69,6 +69,7 @@
     1.4  extern QAction* actionEditBugzilla2URL;
     1.5  extern QAction* actionEditFATE2URL;
     1.6  extern QAction *actionEditOpenVymLink;
     1.7 +extern QAction *actionEditOpenMultipleVymLinks;
     1.8  extern QAction *actionEditVymLink;
     1.9  extern QAction *actionEditDeleteVymLink;
    1.10  extern QAction *actionEditToggleHideExport;
    1.11 @@ -129,8 +130,9 @@
    1.12  extern QMenu* branchContextMenu;
    1.13  extern QMenu* branchAddContextMenu;
    1.14  extern QMenu* branchRemoveContextMenu;
    1.15 -extern QMenu* branchLinksContextMenuEdit;
    1.16 -extern QMenu* branchLinksContextMenuFollow;
    1.17 +extern QMenu* branchLinksContextMenu;
    1.18 +extern QMenu* branchXLinksContextMenuEdit;
    1.19 +extern QMenu* branchXLinksContextMenuFollow;
    1.20  extern QMenu* floatimageContextMenu;
    1.21  extern QMenu* canvasContextMenu;
    1.22  extern QMenu* fileLastMapsMenu;
    1.23 @@ -259,10 +261,10 @@
    1.24  	settings.setValue( "/version/version", __VYM_VERSION );
    1.25  	settings.setValue( "/version/builddate", __BUILD_DATE );
    1.26  
    1.27 -	settings.setValue( "/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
    1.28 -	settings.setValue( "/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
    1.29 -	settings.setValue( "/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
    1.30 -	settings.setValue( "/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
    1.31 +	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
    1.32 +	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
    1.33 +	settings.setValue( "/mapeditor/editmode/pasteNewHeading",actionSettingsPasteNewHeading->isOn() );
    1.34 +	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
    1.35  	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
    1.36  	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
    1.37  	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
    1.38 @@ -680,8 +682,8 @@
    1.39  
    1.40  	a = new QAction( tr( "Open all URLs in subtree" ), this);
    1.41  	a->setStatusTip (tr( "Open all URLs in subtree" ));
    1.42 -	a->setShortcut (Qt::CTRL+Qt::Key_U );
    1.43  	addAction(a);
    1.44 +	actionListBranches.append(a);
    1.45      connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
    1.46  	actionEditOpenMultipleURLTabs=a;
    1.47  
    1.48 @@ -716,13 +718,21 @@
    1.49      connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
    1.50  	actionEditFATE2URL=a;
    1.51  	
    1.52 -    a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
    1.53 +    a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this);
    1.54  	a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
    1.55      tb->addAction (a);
    1.56  	a->setEnabled (false);
    1.57      connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
    1.58  	actionEditOpenVymLink=a;
    1.59  	
    1.60 +    a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this);
    1.61 +	a->setStatusTip ( tr( "Open all vym links in subtree" ));
    1.62 +	a->setEnabled (false);
    1.63 +	actionListBranches.append(a);
    1.64 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
    1.65 +	actionEditOpenMultipleVymLinks=a;
    1.66 +	
    1.67 +
    1.68      a = new QAction(tr( "Edit vym link"+QString("...") ), this);
    1.69  	a->setEnabled (false);
    1.70  	a->setStatusTip ( tr( "Edit link to another vym map" ));
    1.71 @@ -1413,28 +1423,28 @@
    1.72      a = new QAction( tr( "Edit branch after adding it" ), this );
    1.73      a->setStatusTip( tr( "Edit branch after adding it" ));
    1.74  	a->setToggleAction(true);
    1.75 -	a->setOn ( settings.value ("/mapeditor/editmode/autoedit",true).toBool());
    1.76 +	a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
    1.77  	settingsMenu->addAction (a);
    1.78  	actionSettingsAutoedit=a;
    1.79  
    1.80      a= new QAction( tr( "Select branch after adding it" ), this );
    1.81      a->setStatusTip( tr( "Select branch after adding it" ));
    1.82  	a->setToggleAction(true);
    1.83 -	a->setOn ( settings.value ("/mapeditor/editmode/autoselect",false).toBool() );
    1.84 +	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
    1.85  	settingsMenu->addAction (a);
    1.86  	actionSettingsAutoselectHeading=a;
    1.87  	
    1.88      a= new QAction(tr( "Select existing heading" ), this);
    1.89      a->setStatusTip( tr( "Select heading before editing" ));
    1.90  	a->setToggleAction(true);
    1.91 -	a->setOn ( settings.value ("/mapeditor/editmode/autoselectexistingtext",true).toBool() );
    1.92 +	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
    1.93  	settingsMenu->addAction (a);
    1.94  	actionSettingsAutoselectText=a;
    1.95  	
    1.96      a= new QAction(tr( "pasting into new branch" ), this );
    1.97      a->setStatusTip( tr( "Pasting into new branch" ));
    1.98  	a->setToggleAction(true);
    1.99 -	a->setOn ( settings.value ("/mapeditor/editmode/newheadingisempty",true).toBool() );
   1.100 +	a->setOn ( settings.value ("/mapeditor/editmode/newHeadingIsEmpty",true).toBool() );
   1.101  	settingsMenu->addAction (a);
   1.102  	actionSettingsPasteNewHeading=a;
   1.103  	
   1.104 @@ -1527,22 +1537,6 @@
   1.105  	actionEditSaveBranch->addTo( branchContextMenu );
   1.106  
   1.107  	branchContextMenu->addSeparator();	
   1.108 -	branchContextMenu->addAction ( actionEditOpenURL );
   1.109 -	branchContextMenu->addAction ( actionEditOpenURLTab );
   1.110 -	branchContextMenu->addAction ( actionEditOpenMultipleURLTabs );
   1.111 -	branchContextMenu->addAction ( actionEditURL );
   1.112 -	branchContextMenu->addAction ( actionEditHeading2URL );
   1.113 -	branchContextMenu->addAction ( actionEditBugzilla2URL );
   1.114 -    if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
   1.115 -	{
   1.116 -		branchContextMenu->addAction ( actionEditFATE2URL );
   1.117 -	}	
   1.118 -	branchContextMenu->addSeparator();	
   1.119 -	branchContextMenu->addAction ( actionEditOpenVymLink );
   1.120 -	branchContextMenu->addAction ( actionEditVymLink );
   1.121 -	branchContextMenu->addAction ( actionEditDeleteVymLink );
   1.122 -	
   1.123 -	branchContextMenu->addSeparator();	
   1.124  	branchContextMenu->addAction ( actionFormatFrameNone );
   1.125  	branchContextMenu->addAction ( actionFormatFrameRectangle);
   1.126  
   1.127 @@ -1551,13 +1545,36 @@
   1.128  	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
   1.129  	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
   1.130  
   1.131 -	// Context Menu for links in a branch menu
   1.132 +	// Submenu for Links (URLs, vymLinks)
   1.133 +	branchLinksContextMenu =new QMenu (this);
   1.134 +
   1.135 +		branchContextMenu->addSeparator();	
   1.136 +		branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks"));	
   1.137 +		branchLinksContextMenu->addAction ( actionEditOpenURL );
   1.138 +		branchLinksContextMenu->addAction ( actionEditOpenURLTab );
   1.139 +		branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
   1.140 +		branchLinksContextMenu->addAction ( actionEditURL );
   1.141 +		branchLinksContextMenu->addAction ( actionEditHeading2URL );
   1.142 +		branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
   1.143 +		if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
   1.144 +		{
   1.145 +			branchLinksContextMenu->addAction ( actionEditFATE2URL );
   1.146 +		}	
   1.147 +		branchLinksContextMenu->addSeparator();	
   1.148 +		branchLinksContextMenu->addAction ( actionEditOpenVymLink );
   1.149 +		branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks );
   1.150 +		branchLinksContextMenu->addAction ( actionEditVymLink );
   1.151 +		branchLinksContextMenu->addAction ( actionEditDeleteVymLink );
   1.152 +		
   1.153 +
   1.154 +	// Context Menu for XLinks in a branch menu
   1.155  	// This will be populated "on demand" in MapEditor::updateActions
   1.156  	branchContextMenu->addSeparator();	
   1.157 -	branchLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
   1.158 -	branchLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
   1.159 -	connect( branchLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
   1.160 -	connect( branchLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
   1.161 +	branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
   1.162 +	branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
   1.163 +	connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
   1.164 +	connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
   1.165 + 	
   1.166  	
   1.167  	// Context menu for floatimage
   1.168  	floatimageContextMenu =new QMenu (this);
   1.169 @@ -2368,6 +2385,9 @@
   1.170  		if ( fd->exec() == QDialog::Accepted )
   1.171  		{
   1.172  			QString fn=fd->selectedFile();
   1.173 +			if (!fn.contains (".odp"))
   1.174 +				fn +=".odp";
   1.175 +
   1.176  			//lastImageDir=fn.left(fn.findRev ("/"));
   1.177  			if (currentMapEditor())
   1.178  				currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
   1.179 @@ -2623,10 +2643,7 @@
   1.180  	if (currentMapEditor())
   1.181  	{	
   1.182  	    QStringList urls;
   1.183 -		urls.append ("www.suse.de");
   1.184 -		urls.append ("www.google.de");
   1.185 -		urls.append ("www.heise.de");
   1.186 -		urls.append ("www.insilmaril.de");
   1.187 +		urls=currentMapEditor()->getURLs();
   1.188  		openTabs (urls);
   1.189  	}	
   1.190  }
   1.191 @@ -2661,7 +2678,13 @@
   1.192  	if (lineedit->isVisible())
   1.193  	{
   1.194  		if (currentMapEditor())
   1.195 -			currentMapEditor()->setHeading(lineedit->text());
   1.196 +		{	
   1.197 +			MapEditor *me=currentMapEditor();
   1.198 +			QString oldSel=me->getSelectString();
   1.199 +			if (me->select (editSel))
   1.200 +				me->setHeading(lineedit->text());
   1.201 +			me->select (oldSel);
   1.202 +		}	
   1.203  		lineedit->releaseKeyboard();
   1.204  		lineedit->hide();
   1.205  		setFocus();
   1.206 @@ -2697,6 +2720,8 @@
   1.207  				lineedit->show();
   1.208  				lineedit->grabKeyboard();
   1.209  				lineedit->setFocus();
   1.210 +
   1.211 +				editSel=currentMapEditor()->getSelectString();
   1.212  #endif
   1.213  
   1.214  			}
   1.215 @@ -2704,13 +2729,10 @@
   1.216  	}
   1.217  }
   1.218  
   1.219 -void Main::editOpenVymLink()
   1.220 +void Main::openVymLinks(const QStringList &vl)
   1.221  {
   1.222 -	// Get current path to map
   1.223 -	QString currentVymLink;
   1.224 -	if (currentMapEditor())
   1.225 +	for (int j=0; j<vl.size(); j++)
   1.226  	{
   1.227 -		currentVymLink=currentMapEditor()->getVymLink();	
   1.228  		// compare path with already loaded maps
   1.229  		int index=-1;
   1.230  		int i;
   1.231 @@ -2718,7 +2740,7 @@
   1.232  		for (i=0;i<=tabWidget->count() -1;i++)
   1.233  		{
   1.234  			me=(MapEditor*)tabWidget->page(i);
   1.235 -			if (currentVymLink==me->getFilePath() )
   1.236 +			if (vl.at(j)==me->getFilePath() )
   1.237  			{
   1.238  				index=i;
   1.239  				break;
   1.240 @@ -2727,12 +2749,12 @@
   1.241  		if (index<0)
   1.242  		// Load map
   1.243  		{
   1.244 -			if (!QFile(currentVymLink).exists() )
   1.245 +			if (!QFile(vl.at(j)).exists() )
   1.246  				QMessageBox::critical( 0, tr( "Critical Error" ),
   1.247 -				   tr("Couldn't open map %1").arg(currentVymLink));
   1.248 +				   tr("Couldn't open map %1").arg(vl.at(j)));
   1.249  			else
   1.250  			{
   1.251 -				fileLoad (currentVymLink, NewMap);
   1.252 +				fileLoad (vl.at(j), NewMap);
   1.253  				tabWidget->setCurrentPage (tabWidget->count()-1);	
   1.254  			}
   1.255  		} else
   1.256 @@ -2741,6 +2763,26 @@
   1.257  	}
   1.258  }
   1.259  
   1.260 +void Main::editOpenVymLink()
   1.261 +{
   1.262 +	if (currentMapEditor())
   1.263 +	{
   1.264 +		QStringList vl;
   1.265 +		vl.append(currentMapEditor()->getVymLink());	
   1.266 +		openVymLinks (vl);
   1.267 +	}
   1.268 +}
   1.269 +
   1.270 +void Main::editOpenMultipleVymLinks()
   1.271 +{
   1.272 +	QString currentVymLink;
   1.273 +	if (currentMapEditor())
   1.274 +	{
   1.275 +		QStringList vl=currentMapEditor()->getVymLinks();
   1.276 +		openVymLinks (vl);
   1.277 +	}
   1.278 +}
   1.279 +
   1.280  void Main::editVymLink()
   1.281  {
   1.282  	if (currentMapEditor())
   1.283 @@ -2903,13 +2945,13 @@
   1.284  {
   1.285  
   1.286  	if (currentMapEditor())
   1.287 -		currentMapEditor()->followXLink(branchLinksContextMenuFollow->actions().indexOf(a));
   1.288 +		currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
   1.289  }
   1.290  
   1.291  void Main::editEditXLink(QAction *a)
   1.292  {
   1.293  	if (currentMapEditor())
   1.294 -		currentMapEditor()->editXLink(branchLinksContextMenuEdit->actions().indexOf(a));
   1.295 +		currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
   1.296  }
   1.297  
   1.298  void Main::formatSelectColor()