Empty branches are always unscrolled after import, relinking to scrolled branch doesn't open branch, starting DBUS implementation
authorinsilmaril
Wed, 22 Jul 2009 11:48:23 +0000
changeset 7816cbf3c9cbd21
parent 780 fe839bdfd10c
child 782 ffb02a9bb508
Empty branches are always unscrolled after import, relinking to scrolled branch doesn't open branch, starting DBUS implementation
branchitem.cpp
main.cpp
mainwindow.cpp
mainwindow.h
scripts/update-bookmarks
treeitem.cpp
vym.pro
vymmodel.cpp
vymmodel.h
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Tue Jul 07 11:21:27 2009 +0000
     1.2 +++ b/branchitem.cpp	Wed Jul 22 11:48:23 2009 +0000
     1.3 @@ -154,8 +154,11 @@
     1.4      return s;
     1.5  }
     1.6  
     1.7 -void BranchItem::updateVisibility()	// FIXME-3	Check if this is needed after all...
     1.8 +void BranchItem::updateVisibility()	
     1.9  {
    1.10 +	// Needed to hide relinked branch, if parent is scrolled
    1.11 +	if (lmo)
    1.12 +		lmo->setVisibility(!((BranchItem*)parentItem)->isScrolled());
    1.13  }
    1.14  
    1.15  void BranchItem::setHeadingColor (QColor color)
     2.1 --- a/main.cpp	Tue Jul 07 11:21:27 2009 +0000
     2.2 +++ b/main.cpp	Wed Jul 22 11:48:23 2009 +0000
     2.3 @@ -1,4 +1,5 @@
     2.4  #include <QApplication>
     2.5 +#include <QtDBus/QDBusConnection>
     2.6  
     2.7  #include <iostream>
     2.8  using namespace std;
     2.9 @@ -24,6 +25,8 @@
    2.10  QString vymCodeName;
    2.11  
    2.12  Main *mainWindow;				// used in BranchObj::select()								
    2.13 +QDBusConnection dbusConnection= QDBusConnection::sessionBus();
    2.14 +
    2.15  QString tmpVymDir;				// All temp files go there, created in mainwindow
    2.16  QString clipboardDir;			// Clipboard used in all mapEditors
    2.17  QString clipboardFile;			// Clipboard used in all mapEditors
    2.18 @@ -180,8 +183,6 @@
    2.19  	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
    2.20  	m.show();
    2.21  	m.fileNew();
    2.22 -
    2.23 -
    2.24  	// Paint Mainwindow first time
    2.25  	qApp->processEvents();
    2.26  
     3.1 --- a/mainwindow.cpp	Tue Jul 07 11:21:27 2009 +0000
     3.2 +++ b/mainwindow.cpp	Wed Jul 22 11:48:23 2009 +0000
     3.3 @@ -1,6 +1,5 @@
     3.4  #include "mainwindow.h"
     3.5  
     3.6 -#include <QtDBus/QtDBus>
     3.7  #include <QtGui>
     3.8  
     3.9  #include <iostream>
    3.10 @@ -38,6 +37,7 @@
    3.11  
    3.12  extern TextEditor *textEditor;
    3.13  extern Main *mainWindow;
    3.14 +extern QDBusConnection dbusConnection;
    3.15  extern QString tmpVymDir;
    3.16  extern QString clipboardDir;
    3.17  extern QString clipboardFile;
    3.18 @@ -229,6 +229,14 @@
    3.19  
    3.20  	updateGeometry();
    3.21  
    3.22 +	//Initialize DBUS
    3.23 +	new Adaptor (this);
    3.24 +    dbusConnection = QDBusConnection::sessionBus();
    3.25 +    dbusConnection.registerObject("/MainWindow", this);
    3.26 +    dbusConnection.registerService("org.insilmaril.vym");
    3.27 +
    3.28 +
    3.29 +
    3.30  }
    3.31  
    3.32  Main::~Main()
     4.1 --- a/mainwindow.h	Tue Jul 07 11:21:27 2009 +0000
     4.2 +++ b/mainwindow.h	Wed Jul 22 11:48:23 2009 +0000
     4.3 @@ -2,7 +2,10 @@
     4.4  #define MAINWINDOW_H
     4.5  
     4.6  #include <QMainWindow>
     4.7 +#include <QtDBus>
     4.8  
     4.9 +
    4.10 +#include "adaptor.h"
    4.11  #include "branchpropwindow.h"
    4.12  #include "extrainfodialog.h"
    4.13  #include "flag.h"
     5.1 --- a/scripts/update-bookmarks	Tue Jul 07 11:21:27 2009 +0000
     5.2 +++ b/scripts/update-bookmarks	Wed Jul 22 11:48:23 2009 +0000
     5.3 @@ -7,4 +7,3 @@
     5.4  # And now the same using QDBUS in KDE 4:
     5.5  
     5.6  qdbus| grep konqueror- |  xargs -iOBJECT qdbus OBJECT /KBookmarkManager/konqueror org.kde.KIO.KBookmarkManager.notifyCompleteChange
     5.7 -#qdbus| grep konqueror- |  xargs -iOBJECT qdbus OBJECT /KBookmarkManager/kfilePlaces org.kde.KIO.KBookmarkManager.notifyCompleteChange
     6.1 --- a/treeitem.cpp	Tue Jul 07 11:21:27 2009 +0000
     6.2 +++ b/treeitem.cpp	Wed Jul 22 11:48:23 2009 +0000
     6.3 @@ -606,7 +606,7 @@
     6.4  }
     6.5  
     6.6  
     6.7 -void TreeItem::setHideTmp (HideTmpMode mode)
     6.8 +void TreeItem::setHideTmp (HideTmpMode mode)  //FIXME-2
     6.9  {
    6.10  	if (isBranchLikeType() )
    6.11  		((BranchItem*)this)->updateVisibility();
     7.1 --- a/vym.pro	Tue Jul 07 11:21:27 2009 +0000
     7.2 +++ b/vym.pro	Wed Jul 22 11:48:23 2009 +0000
     7.3 @@ -3,13 +3,12 @@
     7.4  
     7.5  CONFIG	+= qt warn_on release debug
     7.6  CONFIG += x86 ppc
     7.7 -
     7.8 +CONFIG += qdbus
     7.9  
    7.10  include (/data/qtanimationframework-2.3-opensource/src/gui-animation.pri)
    7.11  include (/data/qtanimationframework-2.3-opensource/src/corelib-animation.pri)
    7.12  include (/data/qtanimationframework-2.3-opensource/src/qtanimationframework.pri)
    7.13  
    7.14 -
    7.15  TRANSLATIONS += lang/vym_de.ts
    7.16  TRANSLATIONS += lang/vym_en.ts
    7.17  TRANSLATIONS += lang/vym_es.ts
    7.18 @@ -33,6 +32,7 @@
    7.19  
    7.20  HEADERS	+= \
    7.21  	aboutdialog.h \
    7.22 +	adaptor.h \
    7.23  	animpoint.h \
    7.24  	attribute.h \
    7.25  #	attributedelegate.h\
    7.26 @@ -93,6 +93,7 @@
    7.27  
    7.28  SOURCES	+= \
    7.29  	aboutdialog.cpp \
    7.30 +	adaptor.cpp \
    7.31  	animpoint.cpp \
    7.32  	attribute.cpp \
    7.33  #	attributedelegate.cpp \
     8.1 --- a/vymmodel.cpp	Tue Jul 07 11:21:27 2009 +0000
     8.2 +++ b/vymmodel.cpp	Wed Jul 22 11:48:23 2009 +0000
     8.3 @@ -22,6 +22,8 @@
     8.4  
     8.5  extern bool debug;
     8.6  extern Main *mainWindow;
     8.7 +extern QDBusConnection dbusConnection;
     8.8 +
     8.9  extern Settings settings;
    8.10  extern QString tmpVymDir;
    8.11  
    8.12 @@ -148,6 +150,12 @@
    8.13  	// Create MapCenter
    8.14  	//  addMapCenter();  FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene
    8.15  
    8.16 +	//Initialize DBUS
    8.17 +	//new CarAdaptor(car);
    8.18 +    //connection.registerObject("/Car", car);
    8.19 +    dbusConnection.registerService("org.insilmaril.vym");
    8.20 +
    8.21 +
    8.22  }
    8.23  
    8.24  void VymModel::makeTmpDirectories()
    8.25 @@ -2169,7 +2177,13 @@
    8.26  
    8.27  		emit (layoutChanged() );
    8.28  		reposition();	// both for moveUp/Down and relinking
    8.29 -		select (branch);
    8.30 +		if (dst->isScrolled() )
    8.31 +		{
    8.32 +			select (dst);	
    8.33 +			branch->updateVisibility();
    8.34 +		}
    8.35 +		else	
    8.36 +			select (branch);
    8.37  		return true;
    8.38  	}
    8.39  	return false;
    8.40 @@ -2316,6 +2330,7 @@
    8.41  		beginRemoveRows (ix,0,n);
    8.42  		removeRows (0,n+1,ix);
    8.43  		endRemoveRows();
    8.44 +		if (selbi->isScrolled()) selbi->unScroll();
    8.45  		emit (layoutChanged() );
    8.46  		reposition();
    8.47  	}	
     9.1 --- a/vymmodel.h	Tue Jul 07 11:21:27 2009 +0000
     9.2 +++ b/vymmodel.h	Wed Jul 22 11:48:23 2009 +0000
     9.3 @@ -3,6 +3,7 @@
     9.4  
     9.5  #include <QGraphicsScene>
     9.6  #include <QtNetwork>
     9.7 +#include <QtDBus/QDBusConnection>
     9.8  
     9.9  #include "file.h"
    9.10  #include "imageitem.h"
    10.1 --- a/xml-vym.cpp	Tue Jul 07 11:21:27 2009 +0000
    10.2 +++ b/xml-vym.cpp	Wed Jul 22 11:48:23 2009 +0000
    10.3 @@ -145,7 +145,7 @@
    10.4  		{
    10.5  			// Treat the found mapcenter as a branch 
    10.6  			// in an existing map
    10.7 -			BranchItem *bi=model->getSelectedBranchItem();
    10.8 +			BranchItem *bi=model->getSelectedBranchItem();	//FIXME-3 selection is no longer used here...
    10.9  			if (bi)
   10.10  			{
   10.11  				lastBranch=bi;
   10.12 @@ -191,7 +191,7 @@
   10.13  	{
   10.14  		// This is used in vymparts, which have no mapcenter!
   10.15  		isVymPart=true;
   10.16 -		TreeItem *ti=model->getSelectedItem();
   10.17 +		TreeItem *ti=model->getSelectedItem();	//FIXME-3 selection is no longer used here...
   10.18  		if (!ti)
   10.19  		{
   10.20  			// If a vym part is _loaded_ (not imported), 
   10.21 @@ -269,8 +269,9 @@
   10.22  	/* Testing
   10.23  	cout << "endElement </" <<qPrintable(eName)
   10.24  		<<">  state=" <<state 
   10.25 -		<<"  laststate=" <<laststate
   10.26 -		<<"  stateStack="<<stateStack.last() 
   10.27 +	//	<<"  laststate=" <<laststate
   10.28 +	//	<<"  stateStack="<<stateStack.last() 
   10.29 +		<<"  selString="<<model->getSelectString().toStdString()
   10.30  		<<endl;
   10.31  	*/
   10.32      switch ( state ) 
   10.33 @@ -279,14 +280,17 @@
   10.34  			mainWindow->removeProgressBar();
   10.35  			break;
   10.36          case StateMapCenter: 
   10.37 -			model->selectParent();	// FIXME-3 really needed to "select"? Maybe optimize...
   10.38  			model->emitDataHasChanged (lastBranch);
   10.39  			lastBranch=(BranchItem*)(lastBranch->parent());
   10.40  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   10.41              break;
   10.42          case StateBranch: 
   10.43 -			model->selectParent();// FIXME-3 really needed to "select"? Maybe optimize...
   10.44 +			// Empty branches may not be scrolled 
   10.45 +			// (happens if bookmarks are imported)
   10.46 +			if (lastBranch->isScrolled() && lastBranch->branchCount()==0) 
   10.47 +				lastBranch->unScroll();
   10.48  			model->emitDataHasChanged (lastBranch);
   10.49 +
   10.50  			lastBranch=(BranchItem*)(lastBranch->parent());
   10.51  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   10.52              break;