# HG changeset patch
# User insilmaril
# Date 1258446299 0
# Node ID 2a33304714baca715e5ca93a8d19597b4b47cd99
# Parent  fc7a93ff97c3379c79cd56f512ff12570b9324a9
added shortcuts.h and .cpp

diff -r fc7a93ff97c3 -r 2a33304714ba main.cpp
--- a/main.cpp	Mon Nov 16 09:47:10 2009 +0000
+++ b/main.cpp	Tue Nov 17 08:24:59 2009 +0000
@@ -26,6 +26,7 @@
 QString vymVersion;
 QString vymBuildDate;
 QString vymCodeName;
+QString vymInstanceName;
 
 Main *mainWindow;				// used in BranchObj::select()								
 
@@ -70,6 +71,7 @@
 	options.add ("debug", Option::Switch, "d", "debug");
 	options.add ("version", Option::Switch, "v","version");
 	options.add ("local", Option::Switch, "l", "local");
+	options.add ("name", Option::Switch, "n", "name");
 	options.add ("help", Option::Switch, "h", "help");
 	options.add ("quit", Option::Switch, "q", "quit");
 	options.add ("run", Option::String, "r", "run");
@@ -101,7 +103,13 @@
 	
 	// Register for DBUS
 	if (debug) cout << "PID="<<getpid()<<endl;
-	dbusConnection.registerService (QString ("org.insilmaril.vym-%1").arg(getpid()));
+	QString pidString=QString ("%1").arg(getpid());
+	dbusConnection.registerService ("org.insilmaril.vym-"+pidString);
+	if (options.isOn ("name"))
+		vymInstanceName=options.getArg ("name");
+	else
+		vymInstanceName=pidString;
+	
 
 	// Use /usr/share/vym or /usr/local/share/vym or . ?
 	// First try options
diff -r fc7a93ff97c3 -r 2a33304714ba shortcuts.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shortcuts.cpp	Tue Nov 17 08:24:59 2009 +0000
@@ -0,0 +1,36 @@
+#include "shortcuts.h"
+
+#include <iostream>
+using namespace std;
+
+/////////////////////////////////////////////////////////////////
+// Shortcut
+/////////////////////////////////////////////////////////////////
+Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
+{
+}
+
+/////////////////////////////////////////////////////////////////
+// Switchboard
+/////////////////////////////////////////////////////////////////
+Switchboard::Switchboard ()
+{
+}
+
+void Switchboard::addConnection (QAction *a, const QString &desc)
+{	
+	QKeySequence ks=QKeySequence::fromString (desc);
+	actions.append (a);
+	if (!desc.isEmpty()) keys.append (new QKeySequence (ks));
+	if (a) a->setShortcut (ks);
+}
+
+void Switchboard::print ()
+{
+	for (int i=0;i<actions.size();++i)
+	{
+		cout <<actions.at(i)->shortcut().toString().toStdString();
+		cout << "  Action: " <<actions.at(i)->text().toStdString();
+		cout <<endl;
+	}
+}
diff -r fc7a93ff97c3 -r 2a33304714ba shortcuts.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shortcuts.h	Tue Nov 17 08:24:59 2009 +0000
@@ -0,0 +1,32 @@
+#ifndef SHORTCUTS_H
+#define SHORTCUTS_H
+
+#include <QAction>
+#include <QShortcut>
+#include <QString>
+
+class Shortcut:public QShortcut {
+public:
+	Shortcut(QWidget *parent=NULL);
+	void setGroup(const QString &);
+	QString getGroup ();
+	void setContextName (const QString &);
+	QString getContextName();
+
+protected:
+	QString group;
+	QString context;
+};
+
+class Switchboard {
+public:
+    Switchboard ();
+	void addConnection(QAction *a,const QString &s);
+//	void addFunction (Function,
+	void print();
+protected:  
+	QList <QKeySequence*> keys;
+	QList <QAction*> actions;
+};
+
+#endif
diff -r fc7a93ff97c3 -r 2a33304714ba version.h
--- a/version.h	Mon Nov 16 09:47:10 2009 +0000
+++ b/version.h	Tue Nov 17 08:24:59 2009 +0000
@@ -7,7 +7,7 @@
 #define __VYM_VERSION "1.13.0"
 //#define __VYM_CODENAME "Codename: RC-1"
 #define __VYM_CODENAME "Codename: development version, not for production!"
-#define __VYM_BUILD_DATE "2009-11-12"
+#define __VYM_BUILD_DATE "2009-11-16"
 
 
 bool checkVersion(const QString &);
diff -r fc7a93ff97c3 -r 2a33304714ba vymview.cpp
--- a/vymview.cpp	Mon Nov 16 09:47:10 2009 +0000
+++ b/vymview.cpp	Tue Nov 17 08:24:59 2009 +0000
@@ -127,7 +127,7 @@
 	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-5 maybe connect VymModel <-> MainWindow directly?
 	// would require to also get current model in mainWindow
 
-	cout << "VV::changeSelection   newsel.count="<<newsel.indexes().count()<<endl;
+	//cout << "VV::changeSelection   newsel.count="<<newsel.indexes().count()<<endl;
 
 	if (newsel.indexes().count()>0)
 	{
@@ -149,7 +149,7 @@
 	// Notify mainwindow to update satellites, but map selection to 
 	// original model first
 
-	cout << "VV::changeProxySelection   newsel.count="<<newsel.indexes().count()<<endl;
+	//cout << "VV::changeProxySelection   newsel.count="<<newsel.indexes().count()<<endl;
 	if (!newsel.indexes().isEmpty())
 	{
 	/* FIXME-2 need to set current, too