ported standard flags to QT4 qt4-port
authorinsilmaril
Tue, 13 Jun 2006 08:49:12 +0000
branchqt4-port
changeset 36a0342b3c519
parent 2 608f976aa7bb
child 4 ec3d2962893d
ported standard flags to QT4
aboutdialog.cpp
demos/todo.vym
flagobj.cpp
flagobj.h
flagrowobj.cpp
flagrowobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
settings.cpp
settings.h
texteditor.cpp
     1.1 --- a/aboutdialog.cpp	Tue Jun 06 14:58:11 2006 +0000
     1.2 +++ b/aboutdialog.cpp	Tue Jun 13 08:49:12 2006 +0000
     1.3 @@ -45,13 +45,11 @@
     1.4  		"</ul>"		
     1.5  	"<li> Credits " 
     1.6  	"<ul>"
     1.7 -	"<li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a> for <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
     1.8  	"<li>Jakob Hilmer for image drag and drop, &quot;About vym&quot; window patch </li>"
     1.9  	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
    1.10  	"<li>Debianization by Christoph Thielecke and Steffen Joeris</li>"
    1.11 -	"<li>Clemens Kraus for HTML-export "
    1.12 -	"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
    1.13  	"<li>Ken Wimer and Olaf Hering for Mac support</li>"
    1.14 +	"<li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a> for <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
    1.15  	"</ul>"
    1.16  	"</li>");
    1.17      credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
     2.1 Binary file demos/todo.vym has changed
     3.1 --- a/flagobj.cpp	Tue Jun 06 14:58:11 2006 +0000
     3.2 +++ b/flagobj.cpp	Tue Jun 13 08:49:12 2006 +0000
     3.3 @@ -36,8 +36,8 @@
     3.4  
     3.5  	icon=new ImageObj (canvas);
     3.6  	icon->move (absPos.x(), absPos.y() );
     3.7 -	button=NULL;
     3.8  	state=false;
     3.9 +	action=NULL;
    3.10  }
    3.11  
    3.12  void FlagObj::copy (FlagObj* other)
    3.13 @@ -48,10 +48,8 @@
    3.14  	tooltip=other->tooltip;
    3.15  	state=other->state;
    3.16  	icon->copy(other->icon);
    3.17 +	action=other->action;
    3.18  	setVisibility (other->isVisibleObj() );
    3.19 -	// button is not copied, because
    3.20 -	// we won't copy to a parentRow and
    3.21 -	// all others don't need a button
    3.22  }
    3.23  
    3.24  void FlagObj::move(double x, double y)
    3.25 @@ -119,24 +117,21 @@
    3.26  	return tooltip;
    3.27  }
    3.28  
    3.29 -void FlagObj::setButton(QAction* b)
    3.30 -{
    3.31 -    button=b;
    3.32 -}
    3.33 -
    3.34 -void FlagObj::updateButton()
    3.35 -{
    3.36 -	if (button)
    3.37 -		button->setOn(state);
    3.38 -	else
    3.39 -		qWarning ("FlagObj::updateButton  no button defined");
    3.40 -}
    3.41 -
    3.42  QPixmap FlagObj::getPixmap()
    3.43  {
    3.44  	return icon->getPixmap();
    3.45  }
    3.46  
    3.47 +void FlagObj::setAction (QAction* a)
    3.48 +{
    3.49 +	action=a;
    3.50 +}
    3.51 +
    3.52 +void FlagObj::updateAction ()
    3.53 +{
    3.54 +	if (action) action->setChecked(state);
    3.55 +}
    3.56 +
    3.57  bool FlagObj::isActive()
    3.58  {
    3.59  	return state;
    3.60 @@ -172,12 +167,6 @@
    3.61  	}	
    3.62  }
    3.63  
    3.64 -void FlagObj::setEnabled(bool b)
    3.65 -{
    3.66 -	button->setEnabled (b);
    3.67 -}	
    3.68 -	
    3.69 -
    3.70  void FlagObj::setUsed (bool b)
    3.71  {
    3.72  	used=b;
     4.1 --- a/flagobj.h	Tue Jun 06 14:58:11 2006 +0000
     4.2 +++ b/flagobj.h	Tue Jun 13 08:49:12 2006 +0000
     4.3 @@ -30,14 +30,13 @@
     4.4  	const QString getGroup();
     4.5  	void setToolTip(const QString&);
     4.6  	const QString getToolTip();
     4.7 -	void setButton (QAction*);
     4.8 -	void updateButton ();
     4.9  	QPixmap getPixmap();
    4.10 +	void setAction(QAction*);
    4.11 +	void updateAction ();
    4.12  	bool isActive();
    4.13  	void toggle();
    4.14  	void activate();
    4.15  	void deactivate();
    4.16 -	void setEnabled (bool);
    4.17  	void setUsed (bool);
    4.18  	bool isUsed();
    4.19  	void saveToDir (const QString&, const QString&);
    4.20 @@ -52,7 +51,7 @@
    4.21      virtual void calcBBoxSize();
    4.22  private:
    4.23  	ImageObj* icon;
    4.24 -	QAction* button;
    4.25 +	QAction* action;
    4.26  };
    4.27  
    4.28  #endif
     5.1 --- a/flagrowobj.cpp	Tue Jun 06 14:58:11 2006 +0000
     5.2 +++ b/flagrowobj.cpp	Tue Jun 13 08:49:12 2006 +0000
     5.3 @@ -1,5 +1,7 @@
     5.4  #include "flagrowobj.h"
     5.5  
     5.6 +#include <QToolBar>
     5.7 +
     5.8  /////////////////////////////////////////////////////////////////
     5.9  // FlagRowObj
    5.10  /////////////////////////////////////////////////////////////////
    5.11 @@ -232,15 +234,16 @@
    5.12  	}	
    5.13  }
    5.14  
    5.15 +void FlagRowObj::setToolBar(QToolBar *tb)
    5.16 +{
    5.17 +	toolbar=tb;
    5.18 +}
    5.19 +
    5.20  void FlagRowObj::setEnabled (bool b)
    5.21  {
    5.22 -	// If we have no parent, we are the default FlagRowObj
    5.23 -	// and have QToolbarButtons
    5.24 -	if (!parentRow)
    5.25 +	if (toolbar)
    5.26  	{
    5.27 -		FlagObj *fo;
    5.28 -		for (fo=flag.first();fo; fo=flag.next() )
    5.29 -			fo->setEnabled (b);
    5.30 +		toolbar->setEnabled (b);
    5.31  	}
    5.32  }
    5.33  
    5.34 @@ -286,45 +289,13 @@
    5.35  	name=n;
    5.36  }
    5.37  
    5.38 -void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
    5.39 -{
    5.40 -	//Only make toolbar for the parentrow, not each row in branches
    5.41 -	if (!parentRow)
    5.42 -	{
    5.43 -		// create bar and buttons
    5.44 -		Q3ToolBar* tb = new Q3ToolBar( w);
    5.45 -		tb->setLabel (n);
    5.46 -		QAction *a;
    5.47 -		FlagObj *fo;
    5.48 -		for (fo=flag.first();fo; fo=flag.next() )
    5.49 -		{
    5.50 -			a=new QAction (
    5.51 -// FIXME was in QT3:				fo->getToolTip(),
    5.52 -				fo->getPixmap(),
    5.53 -				fo->getName(),
    5.54 -//				0,
    5.55 -				w
    5.56 -//				fo->getName()
    5.57 -			);
    5.58 -			a->setToggleAction(true);
    5.59 -//			a->setTooltip (fo->getToolTip());
    5.60 -			// FIXME should not be enabled by default, later in updateToolbar
    5.61 -			a->setEnabled(true);
    5.62 -			a->addTo (tb);
    5.63 -			fo->setButton (a);
    5.64 -			connect(a, SIGNAL( activated() ), 
    5.65 -					w, SLOT( standardFlagChanged() ) );
    5.66 -		}
    5.67 -	} else
    5.68 -		qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
    5.69 -}
    5.70 -
    5.71  void  FlagRowObj::updateToolbar()
    5.72  {
    5.73  	FlagObj *fo;
    5.74  	if (parentRow)
    5.75  	{
    5.76  		// We are just a branch, not the toolbar default
    5.77 +		// but state has to be copied from ourselves to parentrow!
    5.78  		parentRow->deactivateAll();
    5.79  		// In parentRow activate all existing (==active) flags
    5.80  		for (fo=flag.first();fo; fo=flag.next() ) 
    5.81 @@ -333,8 +304,12 @@
    5.82  	} else
    5.83  	{
    5.84  		// We are the toolbar default
    5.85 -		for (fo=flag.first();fo; fo=flag.next() ) 
    5.86 -			fo->updateButton();
    5.87 +		if (toolbar)
    5.88 +		{
    5.89 +			// Update state of actions in toolbar
    5.90 +			for (fo=flag.first();fo; fo=flag.next() ) 
    5.91 +				fo->updateAction();
    5.92 +		}	
    5.93  	}
    5.94  }
    5.95  
     6.1 --- a/flagrowobj.h	Tue Jun 06 14:58:11 2006 +0000
     6.2 +++ b/flagrowobj.h	Tue Jun 13 08:49:12 2006 +0000
     6.3 @@ -1,7 +1,7 @@
     6.4  #ifndef FLAGROWOBJ_H
     6.5  #define FLAGROWOBJ_H
     6.6  
     6.7 -#include <q3mainwindow.h>
     6.8 +#include <QMainWindow>
     6.9  //Added by qt3to4:
    6.10  #include <Q3PtrList>
    6.11  
    6.12 @@ -29,17 +29,19 @@
    6.13  	void deactivate(const QString&);
    6.14  	void deactivateAll();
    6.15  	void deactivateGroup(FlagObj *);
    6.16 +	void setToolBar (QToolBar *);
    6.17  	void setEnabled (bool);
    6.18  	void setShowFlags (bool);
    6.19  	void resetUsedCounter();
    6.20  	QString saveToDir (const QString &,const QString &,bool);
    6.21  	void setName (const QString&);			// prefix for exporting flags to dir
    6.22 -	void makeToolbar (Q3MainWindow*, const QString &);	// Create Toolbar buttons
    6.23 +	void makeToolbar (QMainWindow*, const QString &);	// Create Toolbar buttons
    6.24  	void updateToolbar();					// Update Toolbar buttons	
    6.25  private:	
    6.26  	FlagRowObj* parentRow;					// look for flags in this row
    6.27  	FlagObj* findFlag (const QString&);
    6.28      Q3PtrList <FlagObj> flag; 
    6.29 +	QToolBar *toolbar;
    6.30  	QString name;
    6.31  	bool showFlags;							// FloatObjects want to hide their flags
    6.32  };
     7.1 --- a/main.cpp	Tue Jun 06 14:58:11 2006 +0000
     7.2 +++ b/main.cpp	Tue Jun 13 08:49:12 2006 +0000
     7.3 @@ -1,4 +1,4 @@
     7.4 -#include <qapplication.h>
     7.5 +#include <QApplication>
     7.6  #include <qpixmap.h>
     7.7  #include <qtranslator.h>
     7.8  #include <qdir.h>
     7.9 @@ -8,7 +8,7 @@
    7.10  #include <qmime.h>
    7.11  //Added by qt3to4:
    7.12  #include <Q3PopupMenu>
    7.13 -#include <Q3ActionGroup>
    7.14 +#include <QActionGroup>
    7.15  
    7.16  #include "settings.h"
    7.17  #include "options.h"
    7.18 @@ -79,16 +79,16 @@
    7.19  QAction *actionFormatLinkColorHint;
    7.20  QAction *actionFormatLinkColor;		
    7.21  
    7.22 -Q3ActionGroup *actionGroupModModes;
    7.23 +QActionGroup *actionGroupModModes;
    7.24  QAction *actionModModeColor;
    7.25  QAction *actionModModeLink;
    7.26  QAction *actionModModeCopy;
    7.27  
    7.28 -Q3ActionGroup *actionGroupFormatFrameTypes;
    7.29 +QActionGroup *actionGroupFormatFrameTypes;
    7.30  QAction *actionFormatFrameNone;
    7.31  QAction *actionFormatFrameRectangle;
    7.32  
    7.33 -Q3ActionGroup *actionGroupFormatLinkStyles;
    7.34 +QActionGroup *actionGroupFormatLinkStyles;
    7.35  QAction *actionFormatIncludeImagesVer;
    7.36  QAction *actionFormatIncludeImagesHor;
    7.37  QAction *actionFormatHideLinkUnselected;
    7.38 @@ -122,7 +122,7 @@
    7.39  Q3PopupMenu *exportImageFormatMenu;
    7.40  
    7.41  
    7.42 -Settings settings;
    7.43 +Settings settings ("vym","vym"); // Organization, Application name
    7.44  Options options;
    7.45  
    7.46  int statusbarTime=3500;
     8.1 --- a/mainwindow.cpp	Tue Jun 06 14:58:11 2006 +0000
     8.2 +++ b/mainwindow.cpp	Tue Jun 13 08:49:12 2006 +0000
     8.3 @@ -1,9 +1,11 @@
     8.4 +#include <QtGui>
     8.5 +
     8.6  #include "mainwindow.h"
     8.7  
     8.8 -#include <qstatusbar.h>
     8.9 -#include <qmessagebox.h>
    8.10 -#include <qmenubar.h>
    8.11 -#include <qapplication.h>
    8.12 +//#include <qstatusbar.h>
    8.13 +//#include <qmessagebox.h>
    8.14 +//#include <qmenubar.h>
    8.15 +//#include <qapplication.h>
    8.16  #include <qpainter.h>
    8.17  #include <qprinter.h>
    8.18  #include <qfile.h>
    8.19 @@ -19,7 +21,7 @@
    8.20  #include <QShowEvent>
    8.21  #include <QHideEvent>
    8.22  #include <Q3PopupMenu>
    8.23 -#include <Q3ActionGroup>
    8.24 +#include <QActionGroup>
    8.25  #include <Q3PtrList>
    8.26  //#include <qdatetime.h>			// for random seed
    8.27  
    8.28 @@ -101,16 +103,16 @@
    8.29  extern QAction *actionFormatIncludeImagesVer;
    8.30  extern QAction *actionFormatIncludeImagesHor;
    8.31  
    8.32 -extern Q3ActionGroup* actionGroupModModes;
    8.33 +extern QActionGroup* actionGroupModModes;
    8.34  extern QAction* actionModModeColor;
    8.35  extern QAction* actionModModeLink;
    8.36  extern QAction* actionModModeCopy;
    8.37  
    8.38 -extern Q3ActionGroup *actionGroupFormatFrameTypes;
    8.39 +extern QActionGroup *actionGroupFormatFrameTypes;
    8.40  extern QAction *actionFormatFrameNone;
    8.41  extern QAction *actionFormatFrameRectangle;
    8.42  
    8.43 -extern Q3ActionGroup *actionGroupFormatLinkStyles;
    8.44 +extern QActionGroup *actionGroupFormatLinkStyles;
    8.45  extern QAction *actionFormatLinkStyleLine;
    8.46  extern QAction *actionFormatLinkStyleParabel;
    8.47  extern QAction *actionFormatLinkStylePolyLine;
    8.48 @@ -150,7 +152,7 @@
    8.49  extern QString flagsPath;
    8.50  
    8.51  Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
    8.52 -    Q3MainWindow(parent,name,f)
    8.53 +    QMainWindow(parent,name,f)
    8.54  {
    8.55  	mainWindow=this;
    8.56  
    8.57 @@ -319,8 +321,7 @@
    8.58  // File Actions
    8.59  void Main::setupFileActions()
    8.60  {
    8.61 -    Q3ToolBar *tb = new Q3ToolBar( this );
    8.62 -    tb->setLabel( "File Actions" );
    8.63 +    QToolBar *tb = addToolBar( tr ("&File") );
    8.64      Q3PopupMenu *menu = new Q3PopupMenu( this );
    8.65      menuBar()->insertItem( tr( "&File" ), menu );
    8.66  
    8.67 @@ -418,7 +419,7 @@
    8.68  //Edit Actions
    8.69  void Main::setupEditActions()
    8.70  {
    8.71 -    Q3ToolBar *tb = new Q3ToolBar( this );
    8.72 +    QToolBar *tb = addToolBar( tr ("&Edit") );
    8.73      tb->setLabel( "Edit Actions" );
    8.74      Q3PopupMenu *menu = new Q3PopupMenu( this );
    8.75      menuBar()->insertItem( tr( "&Edit" ), menu );
    8.76 @@ -607,24 +608,28 @@
    8.77  	menu->insertSeparator();
    8.78  
    8.79      // Shortcuts to modify heading:
    8.80 +	/*
    8.81      a = new QAction(tr( "Edit heading" ),this);
    8.82  	a->setStatusTip ( tr( "edit Heading" ));
    8.83 -	a->setShortcut ( Qt::Key_Enter );
    8.84 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    8.85 +	a->setShortcut ( Qt::Key_Enter);
    8.86 +    connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
    8.87  	actionListBranches.append(a);
    8.88 +	*/
    8.89      a = new QAction( tr( "Edit heading" ), this);
    8.90  	a->setStatusTip (tr( "edit Heading" ));
    8.91  	a->setShortcut (Qt::Key_Return );
    8.92      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    8.93 -	actionListBranches.append(a);
    8.94 +	//actionListBranches.append(a);
    8.95 +    a->addTo( menu );
    8.96  	actionEditHeading=a;
    8.97 +	/*
    8.98      a = new QAction( tr( "Edit heading" ),this);
    8.99  	a->setStatusTip (tr( "edit Heading" ));
   8.100  	a->setShortcut ( Qt::Key_F2 );
   8.101      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   8.102  	a->setEnabled (false);
   8.103 -	actionEditHeading=a;
   8.104  	actionListBranches.append(a);
   8.105 +	*/
   8.106      
   8.107      // Shortcut to delete selection
   8.108      a = new QAction( tr( "Delete Selection" ),this);
   8.109 @@ -638,11 +643,11 @@
   8.110  	alt = new QAction(tr( "Add branch as child" ), this);
   8.111  	alt->setStatusTip ( tr( "Add a branch as child of selection" ));
   8.112  	alt->setShortcut (Qt::Key_A);
   8.113 -    connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   8.114 +	connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   8.115  	a = new QAction(tr( "Add branch as child" ), this);
   8.116  	a->setStatusTip ( tr( "Add a branch as child of selection" ));
   8.117  	a->setShortcut (Qt::Key_Insert);	
   8.118 -	a->setEnabled (false);
   8.119 +//	a->setEnabled (false);
   8.120      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   8.121  	actionListBranches.append(a);
   8.122  	#if defined (Q_OS_MACX)
   8.123 @@ -783,7 +788,7 @@
   8.124      Q3PopupMenu *menu = new Q3PopupMenu( this );
   8.125      menuBar()->insertItem( tr( "F&ormat" ), menu );
   8.126  
   8.127 -    Q3ToolBar *tb = new Q3ToolBar( this );
   8.128 +    QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
   8.129      QAction *a;
   8.130      QPixmap pix( 16,16);
   8.131      pix.fill (Qt::black);
   8.132 @@ -824,7 +829,7 @@
   8.133  	actionFormatColorSubtree=a;
   8.134  
   8.135      menu->insertSeparator();
   8.136 -	actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
   8.137 +	actionGroupFormatLinkStyles=new QActionGroup ( this);
   8.138  	actionGroupFormatLinkStyles->setExclusive (true);
   8.139      a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
   8.140  	a->setStatusTip (tr( "Line" ));
   8.141 @@ -848,7 +853,7 @@
   8.142  	actionFormatLinkStylePolyParabel=a;
   8.143  	actionGroupFormatLinkStyles->addTo (menu);
   8.144  	
   8.145 -	actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
   8.146 +	actionGroupFormatFrameTypes=new QActionGroup ( this);
   8.147  	actionGroupFormatFrameTypes->setExclusive (true);
   8.148      a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
   8.149  	a->setStatusTip (tr("No Frame"));
   8.150 @@ -904,7 +909,7 @@
   8.151  // View Actions
   8.152  void Main::setupViewActions()
   8.153  {
   8.154 -    Q3ToolBar *tb = new Q3ToolBar( this );
   8.155 +    QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
   8.156      tb->setLabel( "View Actions" );
   8.157      Q3PopupMenu *menu = new Q3PopupMenu( this );
   8.158      menuBar()->insertItem( tr( "&View" ), menu );
   8.159 @@ -972,10 +977,9 @@
   8.160      //QPopupMenu *menu = new QPopupMenu( this );
   8.161      //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
   8.162  
   8.163 -    Q3ToolBar *tb = new Q3ToolBar( this );
   8.164 -    tb->setLabel( tr ("Modes when using modifiers") );
   8.165 +    QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
   8.166      QAction *a;
   8.167 -	actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
   8.168 +	actionGroupModModes=new QActionGroup ( this);
   8.169  	actionGroupModModes->setExclusive (true);
   8.170      a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
   8.171  	a->setShortcut (Qt::Key_J);
   8.172 @@ -1040,145 +1044,282 @@
   8.173  	systemFlagsDefault->addFlag (fo);
   8.174  
   8.175  	// Create Standard Flags
   8.176 +	QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
   8.177 +
   8.178  	standardFlagsDefault = new FlagRowObj ();
   8.179  	standardFlagsDefault->setVisibility (false);
   8.180  	standardFlagsDefault->setName ("standardFlagsDef");
   8.181 +	standardFlagsDefault->setToolBar (tb);
   8.182  
   8.183  	fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
   8.184  	fo->setName ("exclamationmark");
   8.185  	fo->setGroup("standard-mark");
   8.186 -	fo->setToolTip(tr("Take care!","Standardflag"));
   8.187 +	QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.188 +	tb->addAction (a);
   8.189 +	fo->setAction (a);
   8.190 +	a->setCheckable(true);
   8.191 +	a->setObjectName(fo->getName());
   8.192 +	a->setToolTip(tr("Take care!","Standardflag"));
   8.193 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.194  	standardFlagsDefault->addFlag (fo);	// makes deep copy
   8.195  	
   8.196  	fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
   8.197  	fo->setName("questionmark");
   8.198  	fo->setGroup("standard-mark");
   8.199 -	fo->setToolTip(tr("Really?","Standardflag"));
   8.200 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.201 +	tb->addAction (a);
   8.202 +	fo->setAction (a);
   8.203 +	a->setCheckable(true);
   8.204 +	a->setObjectName(fo->getName());
   8.205 +	a->setToolTip(tr("Really?","Standardflag"));
   8.206 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.207  	standardFlagsDefault->addFlag (fo);	
   8.208  
   8.209  	fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
   8.210  	fo->setName("hook-green");
   8.211  	fo->setGroup("standard-hook");
   8.212 -	fo->setToolTip(tr("ok!","Standardflag"));
   8.213 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.214 +	tb->addAction (a);
   8.215 +	fo->setAction (a);
   8.216 +	a->setCheckable(true);
   8.217 +	a->setObjectName(fo->getName());
   8.218 +	a->setToolTip(tr("ok!","Standardflag"));
   8.219 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.220  	standardFlagsDefault->addFlag (fo);	
   8.221  
   8.222  	fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
   8.223  	fo->setName("cross-red");
   8.224  	fo->setGroup("standard-hook");
   8.225 -	fo->setToolTip(tr("Not ok!","Standardflag"));
   8.226 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.227 +	tb->addAction (a);
   8.228 +	fo->setAction (a);
   8.229 +	a->setCheckable(true);
   8.230 +	a->setObjectName(fo->getName());
   8.231 +	a->setToolTip(tr("Not ok!","Standardflag"));
   8.232 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.233  	standardFlagsDefault->addFlag (fo);	
   8.234  
   8.235  	fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
   8.236  	fo->setName("stopsign");
   8.237 -	fo->setToolTip(tr("This won't work!","Standardflag"));
   8.238 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.239 +	tb->addAction (a);
   8.240 +	fo->setAction (a);
   8.241 +	a->setCheckable(true);
   8.242 +	a->setObjectName(fo->getName());
   8.243 +	a->setToolTip(tr("This won't work!","Standardflag"));
   8.244 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.245  	standardFlagsDefault->addFlag (fo);	
   8.246  
   8.247  	fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
   8.248  	fo->setName("smiley-good");
   8.249  	fo->setGroup("standard-smiley");
   8.250 -	fo->setToolTip(tr("Good","Standardflag"));
   8.251 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.252 +	tb->addAction (a);
   8.253 +	fo->setAction (a);
   8.254 +	a->setCheckable(true);
   8.255 +	a->setObjectName(fo->getName());
   8.256 +	a->setToolTip(tr("Good","Standardflag"));
   8.257 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.258  	standardFlagsDefault->addFlag (fo);	
   8.259  
   8.260  	fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
   8.261  	fo->setName("smiley-sad");
   8.262  	fo->setGroup("standard-smiley");
   8.263 -	fo->setToolTip(tr("Bad","Standardflag"));
   8.264 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.265 +	tb->addAction (a);
   8.266 +	fo->setAction (a);
   8.267 +	a->setCheckable(true);
   8.268 +	a->setObjectName(fo->getName());
   8.269 +	a->setToolTip(tr("Bad","Standardflag"));
   8.270 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.271  	standardFlagsDefault->addFlag (fo);	
   8.272  
   8.273  	fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
   8.274  	// Original omg.png (in KDE emoticons)
   8.275  	fo->setName("smiley-omg");
   8.276  	fo->setGroup("standard-smiley");
   8.277 -	fo->setToolTip(tr("Oh no!","Standardflag"));
   8.278 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.279 +	tb->addAction (a);
   8.280 +	fo->setAction (a);
   8.281 +	a->setCheckable(true);
   8.282 +	a->setObjectName(fo->getName());
   8.283 +	a->setToolTip(tr("Oh no!","Standardflag"));
   8.284 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.285  	standardFlagsDefault->addFlag (fo);	
   8.286  
   8.287  	fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
   8.288  	fo->setName("clock");
   8.289 -	fo->setToolTip(tr("Time critical","Standardflag"));
   8.290 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.291 +	tb->addAction (a);
   8.292 +	fo->setAction (a);
   8.293 +	a->setCheckable(true);
   8.294 +	a->setObjectName(fo->getName());
   8.295 +	a->setToolTip(tr("Time critical","Standardflag"));
   8.296 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.297  	standardFlagsDefault->addFlag (fo);	
   8.298  
   8.299  	fo->load(QPixmap(flagsPath+"flag-phone.png"));
   8.300  	fo->setName("phone");
   8.301 -	fo->setToolTip(tr("Call...","Standardflag"));
   8.302 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.303 +	tb->addAction (a);
   8.304 +	fo->setAction (a);
   8.305 +	a->setCheckable(true);
   8.306 +	a->setObjectName(fo->getName());
   8.307 +	a->setToolTip(tr("Call...","Standardflag"));
   8.308 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.309  	standardFlagsDefault->addFlag (fo);	
   8.310  
   8.311  	fo->load(QPixmap(flagsPath+"flag-lamp.png"));
   8.312  	fo->setName("lamp");
   8.313 -	fo->setToolTip(tr("Idea!","Standardflag"));
   8.314 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.315 +	tb->addAction (a);
   8.316 +	fo->setAction (a);
   8.317 +	a->setCheckable(true);
   8.318 +	a->setObjectName(fo->getName());
   8.319 +	a->setToolTip(tr("Idea!","Standardflag"));
   8.320 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.321  	standardFlagsDefault->addFlag (fo);	
   8.322  
   8.323  	fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
   8.324  	fo->setName("arrow-up");
   8.325  	fo->setGroup("standard-arrow");
   8.326 -	fo->setToolTip(tr("Important","Standardflag"));
   8.327 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.328 +	tb->addAction (a);
   8.329 +	fo->setAction (a);
   8.330 +	a->setCheckable(true);
   8.331 +	a->setObjectName(fo->getName());
   8.332 +	a->setToolTip(tr("Important","Standardflag"));
   8.333 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.334  	standardFlagsDefault->addFlag (fo);	
   8.335  
   8.336  	fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
   8.337  	fo->setName("arrow-down");
   8.338  	fo->setGroup("standard-arrow");
   8.339 -	fo->setToolTip(tr("Unimportant","Standardflag"));
   8.340 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.341 +	tb->addAction (a);
   8.342 +	fo->setAction (a);
   8.343 +	a->setCheckable(true);
   8.344 +	a->setObjectName(fo->getName());
   8.345 +	a->setToolTip(tr("Unimportant","Standardflag"));
   8.346 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.347  	standardFlagsDefault->addFlag (fo);	
   8.348  
   8.349  	fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
   8.350  	fo->setName("2arrow-up");
   8.351  	fo->setGroup("standard-arrow");
   8.352 -	fo->setToolTip(tr("Very important!","Standardflag"));
   8.353 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.354 +	tb->addAction (a);
   8.355 +	fo->setAction (a);
   8.356 +	a->setCheckable(true);
   8.357 +	a->setObjectName(fo->getName());
   8.358 +	a->setToolTip(tr("Very important!","Standardflag"));
   8.359 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.360  	standardFlagsDefault->addFlag (fo);	
   8.361  
   8.362  	fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
   8.363  	fo->setName("2arrow-down");
   8.364  	fo->setGroup("standard-arrow");
   8.365 -	fo->setToolTip(tr("Very unimportant!","Standardflag"));
   8.366 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.367 +	tb->addAction (a);
   8.368 +	fo->setAction (a);
   8.369 +	a->setCheckable(true);
   8.370 +	a->setObjectName(fo->getName());
   8.371 +	a->setToolTip(tr("Very unimportant!","Standardflag"));
   8.372 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.373  	standardFlagsDefault->addFlag (fo);	
   8.374  
   8.375  	fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
   8.376  	fo->setName("thumb-up");
   8.377  	fo->setGroup("standard-thumb");
   8.378 -	fo->setToolTip(tr("I like this","Standardflag"));
   8.379 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.380 +	tb->addAction (a);
   8.381 +	fo->setAction (a);
   8.382 +	a->setCheckable(true);
   8.383 +	a->setObjectName(fo->getName());
   8.384 +	a->setToolTip(tr("I like this","Standardflag"));
   8.385 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.386  	standardFlagsDefault->addFlag (fo);	
   8.387  
   8.388  	fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
   8.389  	fo->setName("thumb-down");
   8.390  	fo->setGroup("standard-thumb");
   8.391 -	fo->setToolTip(tr("I like this","Standardflag"));
   8.392 -	fo->setToolTip(tr("I do not like this","Standardflag"));
   8.393 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.394 +	tb->addAction (a);
   8.395 +	fo->setAction (a);
   8.396 +	a->setCheckable(true);
   8.397 +	a->setObjectName(fo->getName());
   8.398 +	a->setToolTip(tr("I do not like this","Standardflag"));
   8.399 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.400  	standardFlagsDefault->addFlag (fo);	
   8.401  	
   8.402  	fo->load(QPixmap(flagsPath+"flag-rose.png"));
   8.403  	fo->setName("rose");
   8.404 -	fo->setToolTip(tr("Rose","Standardflag"));
   8.405 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.406 +	tb->addAction (a);
   8.407 +	fo->setAction (a);
   8.408 +	a->setCheckable(true);
   8.409 +	a->setObjectName(fo->getName());
   8.410 +	a->setToolTip(tr("Rose","Standardflag"));
   8.411 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.412  	standardFlagsDefault->addFlag (fo);	
   8.413  
   8.414  	fo->load(QPixmap(flagsPath+"flag-heart.png"));
   8.415  	fo->setName("heart");
   8.416 -	fo->setToolTip(tr("I just love... ","Standardflag"));
   8.417 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.418 +	tb->addAction (a);
   8.419 +	a->setCheckable(true);
   8.420 +	a->setObjectName(fo->getName());
   8.421 +	a->setToolTip(tr("I just love... ","Standardflag"));
   8.422 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.423  	standardFlagsDefault->addFlag (fo);	
   8.424  
   8.425  	fo->load(QPixmap(flagsPath+"flag-present.png"));
   8.426  	fo->setName("present");
   8.427 -	fo->setToolTip(tr("Surprise!","Standardflag"));
   8.428 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.429 +	tb->addAction (a);
   8.430 +	fo->setAction (a);
   8.431 +	a->setCheckable(true);
   8.432 +	a->setObjectName(fo->getName());
   8.433 +	a->setToolTip(tr("Surprise!","Standardflag"));
   8.434 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.435  	standardFlagsDefault->addFlag (fo);	
   8.436  
   8.437  	fo->load(QPixmap(flagsPath+"flag-flash.png"));
   8.438  	fo->setName("flash");
   8.439 -	fo->setToolTip(tr("Dangerous","Standardflag"));
   8.440 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.441 +	tb->addAction (a);
   8.442 +	fo->setAction (a);
   8.443 +	a->setCheckable(true);
   8.444 +	a->setObjectName(fo->getName());
   8.445 +	a->setToolTip(tr("Dangerous","Standardflag"));
   8.446 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.447  	standardFlagsDefault->addFlag (fo);	
   8.448  	
   8.449  	fo->load(QPixmap(flagsPath+"flag-info.png"));
   8.450  	// Original: xsldbg_output.png
   8.451  	fo->setName("info");
   8.452 -	fo->setToolTip(tr("Info","Standardflag"));
   8.453 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.454 +	tb->addAction (a);
   8.455 +	fo->setAction (a);
   8.456 +	a->setCheckable(true);
   8.457 +	a->setObjectName(fo->getName());
   8.458 +	a->setToolTip(tr("Info","Standardflag"));
   8.459 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.460  	standardFlagsDefault->addFlag (fo);	
   8.461  
   8.462  	fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
   8.463  	// Original khelpcenter.png
   8.464  	fo->setName("lifebelt");
   8.465 -	fo->setToolTip(tr("This will help","Standardflag"));
   8.466 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
   8.467 +	tb->addAction (a);
   8.468 +	fo->setAction (a);
   8.469 +	a->setCheckable(true);
   8.470 +	a->setObjectName(fo->getName());
   8.471 +	a->setToolTip(tr("This will help","Standardflag"));
   8.472 +	connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
   8.473  	standardFlagsDefault->addFlag (fo);	
   8.474  
   8.475  	delete (fo);
   8.476 -
   8.477 -	standardFlagsDefault->makeToolbar(this, "Standard Flags");
   8.478  }
   8.479  
   8.480  // Settings Actions
   8.481 @@ -1638,7 +1779,7 @@
   8.482  		// create a new mapeditor in a new tab
   8.483  		if ( lmode==NewMap && (!me || !me->isDefault() ) )
   8.484  		{
   8.485 -			me = new MapEditor (tabWidget,true);
   8.486 +			me= new MapEditor ( NULL,true);
   8.487  			tabWidget->addTab (me,fn);
   8.488  			tabIndex=tabWidget->indexOf (me);
   8.489  			tabWidget->setCurrentPage (tabIndex);
   8.490 @@ -2544,12 +2685,19 @@
   8.491  
   8.492  void Main::editHeading()
   8.493  {
   8.494 +	qWarning ("Main::editHeading called");
   8.495  	if (currentMapEditor())
   8.496  		currentMapEditor()->editHeading();
   8.497  }
   8.498  
   8.499  void Main::editNewBranch()
   8.500  {
   8.501 +	//FIXME
   8.502 +	// tried to see if maybe currentMapEditor is not set, but
   8.503 +	// ME does not seem to send a key event anyway...:q
   8.504 +	//here i was last time...
   8.505 +	
   8.506 +	cout << "Main::editNewBranch\n";
   8.507  	if (currentMapEditor())
   8.508  		currentMapEditor()->addNewBranch(0);
   8.509  }
     9.1 --- a/mainwindow.h	Tue Jun 06 14:58:11 2006 +0000
     9.2 +++ b/mainwindow.h	Tue Jun 13 08:49:12 2006 +0000
     9.3 @@ -2,12 +2,12 @@
     9.4  #define MAINWINDOW_H
     9.5  
     9.6  #include <q3popupmenu.h>
     9.7 -#include <q3mainwindow.h>
     9.8 +#include <QMainWindow>
     9.9  #include <q3textedit.h>
    9.10  #include <q3intdict.h>
    9.11  #include <q3canvas.h>
    9.12  #include <qlineedit.h>
    9.13 -#include <qaction.h>
    9.14 +#include <QAction>
    9.15  #include <qcursor.h>
    9.16  #include <qtabwidget.h>
    9.17  #include <qmap.h>
    9.18 @@ -22,7 +22,7 @@
    9.19  #include "texteditor.h"
    9.20  #include "xml.h"
    9.21  
    9.22 -class Main : public Q3MainWindow 
    9.23 +class Main : public QMainWindow 
    9.24  {
    9.25      Q_OBJECT
    9.26  
    10.1 --- a/mapeditor.cpp	Tue Jun 06 14:58:11 2006 +0000
    10.2 +++ b/mapeditor.cpp	Tue Jun 13 08:49:12 2006 +0000
    10.3 @@ -28,7 +28,7 @@
    10.4  #include <QDragEnterEvent>
    10.5  #include <QTextStream>
    10.6  #include <QDropEvent>
    10.7 -#include <Q3ActionGroup>
    10.8 +#include <QActionGroup>
    10.9  #include <Q3PtrList>
   10.10  
   10.11  #include <iostream>
   10.12 @@ -101,16 +101,16 @@
   10.13  extern QAction *actionFormatBackColor;
   10.14  extern QAction *actionFormatLinkColor;
   10.15  
   10.16 -extern Q3ActionGroup* actionGroupModModes;
   10.17 +extern QActionGroup* actionGroupModModes;
   10.18  extern QAction* actionModModeColor;
   10.19  extern QAction* actionModModeLink;
   10.20  extern QAction* actionModModeCopy;
   10.21  
   10.22 -extern Q3ActionGroup *actionGroupFormatFrameTypes;
   10.23 +extern QActionGroup *actionGroupFormatFrameTypes;
   10.24  extern QAction *actionFormatFrameNone;
   10.25  extern QAction *actionFormatFrameRectangle;
   10.26  
   10.27 -extern Q3ActionGroup *actionGroupFormatLinkStyles;
   10.28 +extern QActionGroup *actionGroupFormatLinkStyles;
   10.29  extern QAction *actionFormatIncludeImagesVer;
   10.30  extern QAction *actionFormatIncludeImagesHor;
   10.31  extern QAction *actionFormatHideLinkUnselected;
   10.32 @@ -2197,15 +2197,19 @@
   10.33  {
   10.34  	if (selection)
   10.35  	{
   10.36 -		BranchObj *bo=(BranchObj*)selection;
   10.37 -		QString s;
   10.38 -		if (bo->isSetStandardFlag(f))
   10.39 -			s="Unset";
   10.40 -		else
   10.41 -			s="Set";
   10.42 -		saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
   10.43 -		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
   10.44 -		adjustCanvasSize();
   10.45 +		if (typeid(*selection) == typeid(BranchObj) ||
   10.46 +			typeid(*selection) == typeid(MapCenterObj))
   10.47 +		{
   10.48 +			BranchObj *bo=(BranchObj*)selection;
   10.49 +			QString s;
   10.50 +			if (bo->isSetStandardFlag(f))
   10.51 +				s="Unset";
   10.52 +			else
   10.53 +				s="Set";
   10.54 +			saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
   10.55 +			bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
   10.56 +			adjustCanvasSize();
   10.57 +		}
   10.58  	}	
   10.59  }
   10.60  
   10.61 @@ -2640,7 +2644,7 @@
   10.62  		if ( (typeid(*selection) == typeid(FloatImageObj)) )
   10.63  		{
   10.64  			FloatObj *fo=(FloatImageObj*)selection;
   10.65 -			standardFlagsDefault->setEnabled (false);
   10.66 +//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
   10.67  
   10.68  			actionEditOpenURL->setEnabled (false);
   10.69  			actionEditOpenVymLink->setEnabled (false);
   10.70 @@ -2663,7 +2667,7 @@
   10.71  
   10.72  	} else
   10.73  	{
   10.74 -		standardFlagsDefault->setEnabled (false);
   10.75 +//FIXME do this in mainwindow				standardFlagsDefault->setEnabled (false);
   10.76  
   10.77  		actionEditCopy->setEnabled (false);	
   10.78  		actionEditCut->setEnabled (false);	
    11.1 --- a/settings.cpp	Tue Jun 06 14:58:11 2006 +0000
    11.2 +++ b/settings.cpp	Tue Jun 13 08:49:12 2006 +0000
    11.3 @@ -1,8 +1,114 @@
    11.4  #include <iostream>
    11.5 +#include <qregexp.h>
    11.6  #include "settings.h"
    11.7 -#include "misc.h"
    11.8 +#include "file.h"
    11.9  
   11.10  using namespace std;
   11.11 +
   11.12 +/////////////////////////////////////////////////////////////////
   11.13 +// SimpleSettings
   11.14 +/////////////////////////////////////////////////////////////////
   11.15 +SimpleSettings::SimpleSettings()
   11.16 +{
   11.17 +	clear();		 
   11.18 +}
   11.19 +
   11.20 +SimpleSettings::~SimpleSettings()
   11.21 +{
   11.22 +}
   11.23 +
   11.24 +void SimpleSettings::clear()
   11.25 +{
   11.26 +	keylist.clear();
   11.27 +	valuelist.clear();
   11.28 +}
   11.29 +
   11.30 +void SimpleSettings::readSettings (const QString &path)
   11.31 +{
   11.32 +	QString s;
   11.33 +	if (!loadStringFromDisk(path,s)) 
   11.34 +	{
   11.35 +		qWarning ("SimpleSettings::readSettings() Couldn't read "+path);
   11.36 +		return;
   11.37 +	}	
   11.38 +	QStringList lines;
   11.39 +	lines=QStringList::split (QRegExp("\n"),s,false);
   11.40 +	int i;
   11.41 +	QStringList::Iterator it=lines.begin();
   11.42 +	while (it !=lines.end() )
   11.43 +	{
   11.44 +		i=(*it).find("=",0);
   11.45 +		keylist.append((*it).left(i));
   11.46 +		valuelist.append((*it).right((*it).length()-i-1));
   11.47 +		it++;
   11.48 +	}
   11.49 +}
   11.50 +
   11.51 +void SimpleSettings::writeSettings (const QString &path)
   11.52 +{
   11.53 +	QString s;
   11.54 +	QStringList::Iterator itk=keylist.begin();
   11.55 +	QStringList::Iterator itv=valuelist.begin();
   11.56 +
   11.57 +	// First search for value in settings saved in map
   11.58 +	while (itk !=keylist.end() )
   11.59 +	{
   11.60 +		s+=*itk+"="+*itv+"\n";
   11.61 +		itk++;
   11.62 +		itv++;
   11.63 +	}
   11.64 +	if (!saveStringToDisk(path,s)) 
   11.65 +		qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
   11.66 +}
   11.67 +
   11.68 +QString SimpleSettings::readEntry (const QString &key)
   11.69 +{
   11.70 +	QStringList::Iterator itk=keylist.begin();
   11.71 +	QStringList::Iterator itv=valuelist.begin();
   11.72 +
   11.73 +	// First search for value in settings saved in map
   11.74 +	while (itk !=keylist.end() )
   11.75 +	{
   11.76 +		if (*itk == key)
   11.77 +			return *itv;
   11.78 +		itk++;
   11.79 +		itv++;
   11.80 +	}
   11.81 +	qWarning ("SimpleSettings::readEntry()  Couldn't find key "+key);
   11.82 +	return "";
   11.83 +}
   11.84 +
   11.85 +void SimpleSettings::setEntry (const QString &key, const QString &value)
   11.86 +{
   11.87 +	QStringList::Iterator itk=keylist.begin();
   11.88 +	QStringList::Iterator itv=valuelist.begin();
   11.89 +
   11.90 +	if (!key.isEmpty() )
   11.91 +	{
   11.92 +		// Search for existing entry first
   11.93 +		while (itk !=keylist.end() )
   11.94 +		{
   11.95 +			if (*itk == key)
   11.96 +			{
   11.97 +				if (!value.isEmpty())
   11.98 +					*itv=value;
   11.99 +				else
  11.100 +					*itv="";
  11.101 +				*itv=value;
  11.102 +				return;
  11.103 +			}
  11.104 +			itk++;
  11.105 +			itv++;
  11.106 +		}
  11.107 +		
  11.108 +		// If no entry exists, append a new one
  11.109 +		keylist.append (key);
  11.110 +		valuelist.append (value);
  11.111 +	}
  11.112 +}
  11.113 +
  11.114 +
  11.115 +
  11.116  /////////////////////////////////////////////////////////////////
  11.117  // Settings
  11.118  /////////////////////////////////////////////////////////////////
  11.119 @@ -11,6 +117,11 @@
  11.120  	clear();		 
  11.121  }
  11.122  
  11.123 +Settings::Settings(const QString & organization, const QString & application ):QSettings (organization,application)
  11.124 +{
  11.125 +	clear();		 
  11.126 +}
  11.127 +
  11.128  Settings::~Settings()
  11.129  {
  11.130  }
  11.131 @@ -116,17 +227,3 @@
  11.132  	return s;
  11.133  }
  11.134  
  11.135 -void Settings::write()
  11.136 -{
  11.137 -	QStringList::Iterator itp=pathlist.begin();
  11.138 -	QStringList::Iterator itk=keylist.begin();
  11.139 -	QStringList::Iterator itv=valuelist.begin();
  11.140 -
  11.141 -	while (itp !=pathlist.end() )
  11.142 -	{
  11.143 -		itp++;
  11.144 -		itk++;
  11.145 -		itv++;
  11.146 -	}
  11.147 -}
  11.148 -
    12.1 --- a/settings.h	Tue Jun 06 14:58:11 2006 +0000
    12.2 +++ b/settings.h	Tue Jun 13 08:49:12 2006 +0000
    12.3 @@ -7,18 +7,38 @@
    12.4  
    12.5  #include "misc.h"
    12.6  
    12.7 +// Some helper functions and simplified settings class
    12.8 +// to read and parse settings e.g.  in undo/redo directories
    12.9  
   12.10 +class SimpleSettings
   12.11 +{
   12.12 +public:
   12.13 +    SimpleSettings ();
   12.14 +	~SimpleSettings ();
   12.15 +	void clear();
   12.16 +	void readSettings(const QString &);
   12.17 +	void writeSettings(const QString &);
   12.18 +	QString readEntry (const QString &);
   12.19 +	void setEntry (const QString &,const QString &);
   12.20 +private:	
   12.21 +	QStringList keylist;
   12.22 +	QStringList valuelist;
   12.23 +};
   12.24 +
   12.25 +
   12.26 +// Overloaded QSettings class, used to save some settings in 
   12.27 +// a map instead of users home directory
   12.28  class Settings:public QSettings,public xmlObj
   12.29  {
   12.30  public:
   12.31      Settings ();
   12.32 +    Settings (const QString & , const QString &);
   12.33  	~Settings ();
   12.34  	void clear();
   12.35  	void clearLocal (const QString &);
   12.36  	QString readLocalEntry ( const QString &, const QString &, const QString &);
   12.37  	void setLocalEntry (const QString &, const QString &, const QString &);
   12.38  	QString getXMLData (const QString &);
   12.39 -	void write ();
   12.40  
   12.41  protected:
   12.42  	QStringList pathlist;
    13.1 --- a/texteditor.cpp	Tue Jun 06 14:58:11 2006 +0000
    13.2 +++ b/texteditor.cpp	Tue Jun 13 08:49:12 2006 +0000
    13.3 @@ -26,7 +26,7 @@
    13.4  //Added by qt3to4:
    13.5  #include <Q3ValueList>
    13.6  #include <QPixmap>
    13.7 -#include <Q3ActionGroup>
    13.8 +#include <QActionGroup>
    13.9  #include <QCloseEvent>
   13.10  
   13.11  #include <iostream>
   13.12 @@ -416,7 +416,7 @@
   13.13      actionTextUnderline->setToggleAction( true );
   13.14      menu->insertSeparator();
   13.15  
   13.16 -    Q3ActionGroup *grp = new Q3ActionGroup( this );
   13.17 +    QActionGroup *grp = new QActionGroup( this );
   13.18      connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
   13.19  
   13.20      actionAlignLeft = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
   13.21 @@ -435,7 +435,7 @@
   13.22      grp->addTo( tb );
   13.23      grp->addTo( menu );
   13.24  
   13.25 -    Q3ActionGroup *grp2 = new Q3ActionGroup( this );
   13.26 +    QActionGroup *grp2 = new QActionGroup( this );
   13.27      grp2->setExclusive(false);
   13.28      actionAlignSubScript = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
   13.29  	actionAlignSubScript->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );