mainwindow.cpp
changeset 486 9c86935835a4
parent 473 8b9cfc26638c
child 487 8fca3a710dc4
     1.1 --- a/mainwindow.cpp	Wed May 02 15:31:18 2007 +0000
     1.2 +++ b/mainwindow.cpp	Wed May 02 15:31:20 2007 +0000
     1.3 @@ -92,14 +92,22 @@
     1.4  
     1.5  	procBrowser=NULL;
     1.6  
     1.7 -	// Initialize history window;
     1.8 +	// Satellite windows //////////////////////////////////////////
     1.9 +
    1.10 +	// history window
    1.11  	historyWindow=new HistoryWindow();
    1.12 -
    1.13 -	// Initialize properties window
    1.14 +	connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.15 +
    1.16 +	// properties window
    1.17  	branchPropertyWindow = new BranchPropertyWindow();
    1.18 -	branchPropertyWindow->move (20,20);
    1.19 -	branchPropertyWindow->resize (settings.value( "/branchpropertywindow/geometry/size",QSize (150,100)).toSize());
    1.20 -	branchPropertyWindow->move   (settings.value( "/branchpropertywindow/geometry/pos", QPoint(20,20)).toPoint());
    1.21 +	connect (branchPropertyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.22 +
    1.23 +	// Connect TextEditor, so that we can update flags if text changes
    1.24 +	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
    1.25 +	connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.26 +
    1.27 +	// Connect HistoryWindow, so that we can update flags
    1.28 +	connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.29  
    1.30  
    1.31  	// Initialize script editor
    1.32 @@ -109,6 +117,15 @@
    1.33  	connect( scriptEditor, SIGNAL( runScript ( QString ) ), 
    1.34  		this, SLOT( runScript( QString ) ) );
    1.35  	
    1.36 +
    1.37 +	// Initialize Find window
    1.38 +	findWindow=new FindWindow(NULL);
    1.39 +	findWindow->move (x(),y()+70);
    1.40 +	connect (findWindow, SIGNAL( findButton(QString) ), 
    1.41 +		this, SLOT(editFind(QString) ) );	
    1.42 +	connect (findWindow, SIGNAL( somethingChanged() ), 
    1.43 +		this, SLOT(editFindChanged() ) );	
    1.44 +
    1.45  	// Initialize some settings, which are platform dependant
    1.46  	QString p,s;
    1.47  
    1.48 @@ -165,23 +182,6 @@
    1.49  
    1.50  	restoreState (settings.value("/mainwindow/state",0).toByteArray());
    1.51  
    1.52 -	// Satellite windows //////////////////////////////////////////
    1.53 -
    1.54 -	// Initialize Find window
    1.55 -	findWindow=new FindWindow(NULL);
    1.56 -	findWindow->move (x(),y()+70);
    1.57 -	connect (findWindow, SIGNAL( findButton(QString) ), 
    1.58 -		this, SLOT(editFind(QString) ) );	
    1.59 -	connect (findWindow, SIGNAL( somethingChanged() ), 
    1.60 -		this, SLOT(editFindChanged() ) );	
    1.61 -
    1.62 -	// Connect TextEditor, so that we can update flags if text changes
    1.63 -	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
    1.64 -	connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.65 -
    1.66 -	// Connect HistoryWindow, so that we can update flags
    1.67 -	connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.68 -
    1.69  	updateGeometry();
    1.70  }
    1.71  
    1.72 @@ -637,15 +637,15 @@
    1.73      connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) );
    1.74  	actionEditHeading2URL=a;
    1.75      
    1.76 -	a = new QAction(tr( "Create URL to Bugzilla","Edit menu" ), this);
    1.77 -	a->setStatusTip ( tr( "Create URL to Bugzilla" ));
    1.78 +	a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
    1.79 +	a->setStatusTip ( tr( "Create URL to Novell Bugzilla" ));
    1.80  	a->setEnabled (false);
    1.81  	actionListBranches.append(a);
    1.82      connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
    1.83  	actionEditBugzilla2URL=a;
    1.84      
    1.85 -	a = new QAction(tr( "Create URL to FATE","Edit menu" ), this);
    1.86 -	a->setStatusTip ( tr( "Create URL to FATE" ));
    1.87 +	a = new QAction(tr( "Create URL to Novell FATE","Edit menu" ), this);
    1.88 +	a->setStatusTip ( tr( "Create URL to Novell FATE" ));
    1.89  	a->setEnabled (false);
    1.90  	actionListBranches.append(a);
    1.91      connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
    1.92 @@ -792,9 +792,10 @@
    1.93  	a->setStatusTip (tr( "Set properties for selection" ));
    1.94  	a->setShortcut ( Qt::CTRL + Qt::Key_I );		//Property window
    1.95  	a->setShortcutContext (Qt::WindowShortcut);
    1.96 +	a->setToggleAction (true);
    1.97  	addAction (a);
    1.98      connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) );
    1.99 -	actionTogglePropertyWindow=a;
   1.100 +	actionViewTogglePropertyWindow=a;
   1.101  }
   1.102  
   1.103  // Format Actions
   1.104 @@ -942,15 +943,12 @@
   1.105  	viewMenu->addAction (a);
   1.106      connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
   1.107  
   1.108 +	viewMenu->addSeparator();	
   1.109  
   1.110      a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this);
   1.111  	a->setStatusTip ( tr( "Show Note Editor" ));
   1.112  	a->setShortcut ( Qt::CTRL + Qt::Key_E );
   1.113  	a->setToggleAction(true);
   1.114 -	if (textEditor->showWithMain())
   1.115 -		a->setOn(true);
   1.116 -	else	
   1.117 -		a->setOn(false);
   1.118      a->addTo( tb );
   1.119  	viewMenu->addAction (a);
   1.120      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
   1.121 @@ -965,7 +963,9 @@
   1.122      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
   1.123  	actionViewToggleHistoryWindow=a;
   1.124  
   1.125 -	viewMenu->addAction (actionTogglePropertyWindow);
   1.126 +	viewMenu->addAction (actionViewTogglePropertyWindow);
   1.127 +
   1.128 +	viewMenu->addSeparator();	
   1.129  
   1.130      a = new QAction(tr( "Antialiasing","View action" ),this );
   1.131  	a->setStatusTip ( tr( "Antialiasing" ));
   1.132 @@ -1485,7 +1485,7 @@
   1.133  
   1.134  	// Context Menu for branch or mapcenter
   1.135  	branchContextMenu =new QMenu (this);
   1.136 -	branchContextMenu->addAction (actionTogglePropertyWindow);
   1.137 +	branchContextMenu->addAction (actionViewTogglePropertyWindow);
   1.138  	branchContextMenu->addSeparator();	
   1.139  
   1.140  		// Submenu "Add"
   1.141 @@ -1629,7 +1629,7 @@
   1.142  
   1.143  void Main::showEvent (QShowEvent * )
   1.144  {
   1.145 -	if (textEditor->showWithMain()) textEditor->showNormal();
   1.146 +	//FIXME if (textEditor->showWithMain()) textEditor->showNormal();
   1.147  }
   1.148  
   1.149  bool Main::reallyWriteDirectory(const QString &dir)
   1.150 @@ -2465,7 +2465,7 @@
   1.151  		me=(MapEditor*)tabWidget->page(i);
   1.152  
   1.153  		// If something changed, ask what to do
   1.154 -		if (me->isUnsaved())
   1.155 +		if (me->hasChanged())
   1.156  		{
   1.157  			tabWidget->setCurrentPage(i);
   1.158  			QMessageBox mb( vymName,
   1.159 @@ -3263,10 +3263,10 @@
   1.160  
   1.161  void Main::windowToggleNoteEditor()
   1.162  {
   1.163 -	if (textEditor->showWithMain() )
   1.164 -		windowHideNoteEditor();
   1.165 +	if (textEditor->isVisible() )
   1.166 +		textEditor->hide();
   1.167  	else	
   1.168 -		windowShowNoteEditor();
   1.169 +		textEditor->show();
   1.170  }
   1.171  
   1.172  void Main::windowToggleHistory()
   1.173 @@ -3284,6 +3284,7 @@
   1.174  		branchPropertyWindow->hide();
   1.175  	else	
   1.176  		branchPropertyWindow->show();
   1.177 +
   1.178  	if(currentMapEditor())
   1.179  	{
   1.180  		LinkableMapObj *sel=currentMapEditor()->getSelection();
   1.181 @@ -3348,8 +3349,9 @@
   1.182  	historyWindow->setCaption (tr("History for %1").arg(currentMapEditor()->getFileName()));
   1.183  
   1.184  	// updateActions is also called when NoteEditor is closed
   1.185 -	actionViewToggleNoteEditor->setOn (textEditor->showWithMain());
   1.186 -	actionViewToggleHistoryWindow->setOn (historyWindow->showWithMain());
   1.187 +	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
   1.188 +	actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
   1.189 +	actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
   1.190  
   1.191  	if (me->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
   1.192  		actionFormatLinkColorHint->setOn(true);
   1.193 @@ -3384,7 +3386,7 @@
   1.194      actionFormatLinkColor->setIconSet( pix );
   1.195  
   1.196  
   1.197 -	actionFileSave->setEnabled( me->isUnsaved() );
   1.198 +	actionFileSave->setEnabled( me->hasChanged() );
   1.199  	if (me->isUndoAvailable())
   1.200  		actionEditUndo->setEnabled( true);
   1.201  	else	
   1.202 @@ -3548,14 +3550,12 @@
   1.203  
   1.204  void Main::windowShowNoteEditor()
   1.205  {
   1.206 -	textEditor->setShowWithMain(true);
   1.207  	textEditor->show();
   1.208  	actionViewToggleNoteEditor->setOn (true);
   1.209  }
   1.210  
   1.211  void Main::windowHideNoteEditor()
   1.212  {
   1.213 -	textEditor->setShowWithMain(false);
   1.214  	textEditor->hide();
   1.215  	actionViewToggleNoteEditor->setOn (false);
   1.216  }