mainwindow.cpp
changeset 746 ee6b0f3a4c2f
parent 742 54d44ecd6097
child 748 edb78a44240b
     1.1 --- a/mainwindow.cpp	Mon Mar 23 09:06:51 2009 +0000
     1.2 +++ b/mainwindow.cpp	Thu Mar 26 07:49:17 2009 +0000
     1.3 @@ -122,7 +122,6 @@
     1.4  	procBrowser=NULL;
     1.5  
     1.6  	// Satellite windows //////////////////////////////////////////
     1.7 -
     1.8  	// history window
     1.9  	historyWindow=new HistoryWindow();
    1.10  	connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
    1.11 @@ -1669,7 +1668,7 @@
    1.12  	actionFormatLinkColor->addTo( canvasContextMenu );
    1.13  	actionFormatSelectionColor->addTo( canvasContextMenu );
    1.14  	actionFormatBackColor->addTo( canvasContextMenu );
    1.15 -	// actionFormatBackImage->addTo( canvasContextMenu );  //FIXME makes vym too slow: postponed for later version 
    1.16 +	// actionFormatBackImage->addTo( canvasContextMenu );  //FIXME-4 makes vym too slow: postponed for later version 
    1.17  
    1.18  	// Menu for last opened files
    1.19  	// Create actions
    1.20 @@ -1902,7 +1901,7 @@
    1.21  
    1.22  		//tabWidget->currentPage() won't be NULL here, because of above...
    1.23  		tabWidget->setCurrentIndex (tabIndex);
    1.24 -		//FIXME no me anymore... me->viewport()->setFocus();
    1.25 +		//FIXME-3 no me anymore... me->viewport()->setFocus();
    1.26  
    1.27  		if (err!=aborted)
    1.28  		{
    1.29 @@ -2018,7 +2017,7 @@
    1.30  		// call fileSaveAs() now, this will call fileSave() 
    1.31  		// again.
    1.32  		// First switch to editor
    1.33 -		//FIXME needed???  tabWidget->setCurrentWidget (m->getMapEditor());
    1.34 +		//FIXME-3 needed???  tabWidget->setCurrentWidget (m->getMapEditor());
    1.35  		fileSaveAs(savemode);
    1.36  	}
    1.37  
    1.38 @@ -2247,7 +2246,7 @@
    1.39  	if (m) m->exportASCII();
    1.40  }
    1.41  
    1.42 -void Main::fileExportCSV()	//FIXME not scriptable yet
    1.43 +void Main::fileExportCSV()	//FIXME-2 not scriptable yet
    1.44  {
    1.45  	VymModel *m=currentModel();
    1.46  	if (m)
    1.47 @@ -2266,7 +2265,7 @@
    1.48  	}
    1.49  }
    1.50  
    1.51 -void Main::fileExportLaTeX()	//FIXME not scriptable yet
    1.52 +void Main::fileExportLaTeX()	//FIXME-2 not scriptable yet
    1.53  {
    1.54  	VymModel *m=currentModel();
    1.55  	if (m)
    1.56 @@ -2285,7 +2284,7 @@
    1.57  	}
    1.58  }
    1.59  
    1.60 -void Main::fileExportKDE3Bookmarks()	//FIXME not scriptable yet
    1.61 +void Main::fileExportKDE3Bookmarks()	//FIXME-2 not scriptable yet
    1.62  {
    1.63  	ExportKDE3Bookmarks ex;
    1.64  	VymModel *m=currentModel();
    1.65 @@ -2296,7 +2295,7 @@
    1.66  	}	
    1.67  }
    1.68  
    1.69 -void Main::fileExportKDE4Bookmarks()	//FIXME not scriptable yet
    1.70 +void Main::fileExportKDE4Bookmarks()	//FIXME-2 not scriptable yet
    1.71  {
    1.72  	ExportKDE4Bookmarks ex;
    1.73  	VymModel *m=currentModel();
    1.74 @@ -2307,7 +2306,7 @@
    1.75  	}	
    1.76  }
    1.77  
    1.78 -void Main::fileExportTaskjuggler()	//FIXME not scriptable yet
    1.79 +void Main::fileExportTaskjuggler()	//FIXME-2 not scriptable yet
    1.80  {
    1.81  	ExportTaskjuggler ex;
    1.82  	VymModel *m=currentModel();
    1.83 @@ -2326,7 +2325,7 @@
    1.84  	}	
    1.85  }
    1.86  
    1.87 -void Main::fileExportOOPresentation()	//FIXME not scriptable yet
    1.88 +void Main::fileExportOOPresentation()	//FIXME-2 not scriptable yet
    1.89  {
    1.90  	ExportOOFileDialog *fd=new ExportOOFileDialog( this,vymName+" - "+tr("Export to")+" Open Office");
    1.91  	// TODO add preview in dialog
    1.92 @@ -2395,7 +2394,7 @@
    1.93  		// Better would be delete (me), but then we could have a Qt error:
    1.94  		// "QObject: Do not delete object, 'MapEditor', during its event handler!"
    1.95  		// So we only remove data now and call deconstructor when vym closes later
    1.96 -		// FIXME  this needs to be moved to vymview...   me->clear();
    1.97 +		// FIXME-3  this needs to be moved to vymview...   me->clear();
    1.98  		// some model->clear is needed to free up memory ...
    1.99  
   1.100  		updateActions();
   1.101 @@ -2867,7 +2866,7 @@
   1.102  
   1.103  	// Calc some stats
   1.104  	QString stats;
   1.105 -/* FIXME no stats at the moment (view dependent...)
   1.106 +/* FIXME-2 no stats at the moment (view dependent...)
   1.107      stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
   1.108  
   1.109  	uint b=0;
   1.110 @@ -3243,7 +3242,7 @@
   1.111  }
   1.112  
   1.113  
   1.114 -void Main::formatHideLinkUnselected()	//FIXME get rid of this with imagepropertydialog
   1.115 +void Main::formatHideLinkUnselected()	//FIXME-3 get rid of this with imagepropertydialog
   1.116  {
   1.117  	VymModel *m=currentModel();
   1.118  	if (m)
   1.119 @@ -3455,7 +3454,7 @@
   1.120  	historyWindow->update (undoSet);
   1.121  }
   1.122  
   1.123 -void Main::updateNoteFlag()
   1.124 +void Main::updateNoteFlag()	
   1.125  {
   1.126  	// this slot is connected to TextEditor::textHasChanged()
   1.127  
   1.128 @@ -3463,9 +3462,66 @@
   1.129  	if (m) m->updateNoteFlag();
   1.130  }
   1.131  
   1.132 -void Main::updateSatellites(VymModel* model)
   1.133 +/*
   1.134 +void Main::updateNoteInEditor (VymModel *model, const NoteObj &note)
   1.135  {
   1.136 -	branchPropertyWindow->setModel (model );
   1.137 +	if (model&& model==currentModel() )
   1.138 +	{
   1.139 +		textEditor->setNote (note);
   1.140 +	}
   1.141 +}
   1.142 +*/
   1.143 +
   1.144 +void Main::updateContent (QModelIndex index )
   1.145 +{
   1.146 +	cout << "Main::updateContent model="<<sender();
   1.147 +	TreeItem *ti=((VymModel*)sender())->getItem(index);
   1.148 +	cout << "  item="<<ti->getHeading().toStdString()<<" ("<<ti<<")"<<endl;
   1.149 +	textEditor->setNote (ti->getNoteObj() );
   1.150 +}
   1.151 +
   1.152 +void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
   1.153 +{
   1.154 +	//branchPropertyWindow->setModel (model ); //FIXME-1 this used to be called from BranchObj::select()
   1.155 +	if (model && model==currentModel() )
   1.156 +	{
   1.157 +		// NoteEditor
   1.158 +		TreeItem *ti;
   1.159 +		if (!oldsel.indexes().isEmpty() )
   1.160 +		{
   1.161 +			ti=model->getItem(oldsel.indexes().first());
   1.162 +			//cout << "Main::changeSel getting note from "<<ti->getHeading().toStdString()<<":  \""<<ti->getNote().toStdString()<<"\""<<endl; 
   1.163 +			ti->setNoteObj (textEditor->getNoteObj(),false );
   1.164 +		} 
   1.165 +		if (!newsel.indexes().isEmpty() )
   1.166 +		{
   1.167 +			ti=model->getItem(newsel.indexes().first());
   1.168 +			if (!ti->getNoteObj().isEmpty()  )
   1.169 +			{
   1.170 +				//cout << "Main::changeSel setting note of "<<ti->getHeading().toStdString()<<" m=("<<ti->getModel()<<")  to \""<<ti->getNote().toStdString()<<"\""<<endl; 
   1.171 +				textEditor->setNote(ti->getNoteObj() );
   1.172 +			} else
   1.173 +				textEditor->setNote(NoteObj() );
   1.174 +		} else
   1.175 +		{
   1.176 +			textEditor->setInactive();
   1.177 +		}
   1.178 +
   1.179 +		// Show URL and link in statusbar
   1.180 +		QString status;
   1.181 +		QString s=model->getURL();
   1.182 +		if (!s.isEmpty() ) status+="URL: "+s+"  ";
   1.183 +		s=model->getVymLink();
   1.184 +		if (!s.isEmpty() ) status+="Link: "+s;
   1.185 +		if (!status.isEmpty() ) statusMessage (status);
   1.186 +
   1.187 +
   1.188 +		// Update Toolbar // FIXME-1, was so far in BranchObj
   1.189 +		//updateFlagsToolbar();
   1.190 +
   1.191 +		// Update actions
   1.192 +		updateActions();
   1.193 +	}
   1.194  }
   1.195  
   1.196  void Main::updateActions()