summaryrefslogtreecommitdiffstats
path: root/superkaramba/src/karambainterface.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /superkaramba/src/karambainterface.cpp
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'superkaramba/src/karambainterface.cpp')
-rw-r--r--superkaramba/src/karambainterface.cpp153
1 files changed, 153 insertions, 0 deletions
diff --git a/superkaramba/src/karambainterface.cpp b/superkaramba/src/karambainterface.cpp
new file mode 100644
index 0000000..7a201d8
--- /dev/null
+++ b/superkaramba/src/karambainterface.cpp
@@ -0,0 +1,153 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Petri Damsten *
+ * petri.damsten@iki.fi *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "karamba.h"
+#include "karambainterface.h"
+#include <kdebug.h>
+#include "qwidgetlist.h"
+#include "themesdlg.h"
+
+KarambaIface::KarambaIface(): DCOPObject("KarambaIface")
+{
+}
+
+KarambaIface::~KarambaIface()
+{
+}
+
+karamba* KarambaIface::getKaramba(QString name)
+{
+ QWidgetList *list = QApplication::allWidgets();
+ QWidgetListIt it(*list); // iterate over the widgets
+ QWidget* w;
+ karamba* result = 0;
+
+ while ( (w=it.current()) != 0 ) // for each widget...
+ {
+ ++it;
+ if (QString(w->name()).startsWith("karamba"))
+ {
+ karamba* k = (karamba*) w;
+ //if(k->prettyName == name)
+ if(k->theme().name() == name)
+ {
+ result = k;
+ break;
+ }
+ }
+ }
+ delete list;
+ return result;
+}
+
+ThemesDlg* KarambaIface::getThemeWnd()
+{
+ QWidgetList *list = QApplication::allWidgets();
+ QWidgetListIt it( *list ); // iterate over the widgets
+ QWidget* w;
+ ThemesDlg* result = 0;
+
+ while ( (w=it.current()) != 0 ) // for each widget...
+ {
+ ++it;
+ if (QString(w->name()) == "ThemesLayout")
+ {
+ result = (ThemesDlg*) w;
+ break;
+ }
+ }
+ delete list; // delete the list, not the widgets
+ return result;
+}
+
+void KarambaIface::openTheme(QString filename)
+{
+ QFileInfo file(filename);
+ if(file.exists())
+ {
+ (new karamba(filename, QString()))->show();
+ }
+}
+
+void KarambaIface::openNamedTheme(QString filename, QString name, bool is_sub_theme)
+{
+ QFileInfo file(filename);
+ if(file.exists())
+ {
+ (new karamba(filename, name, false, -1, is_sub_theme))->show();
+ }
+}
+
+void KarambaIface::closeTheme(QString name)
+{
+ kdDebug() << "KarambaIface::closeTheme: " << name << endl;
+ karamba* k;
+
+ while((k = getKaramba(name)))
+ {
+ k->writeConfigData();
+ k->close(true);
+ }
+}
+
+int KarambaIface::themeAdded(QString appId, QString file)
+{
+ ThemesDlg* tw = getThemeWnd();
+ if(tw)
+ return tw->addTheme(appId, file);
+ return -1;
+}
+
+void KarambaIface::themeNotify(QString name, QString text)
+{
+ karamba* k = getKaramba(name);
+ if(k)
+ {
+ k->themeNotify(name, text);
+ }
+}
+
+void KarambaIface::setIncomingData(QString name, QString text)
+{
+ karamba* k = getKaramba(name);
+ if(k)
+ {
+ k->_setIncomingData(text);
+ }
+}
+
+void KarambaIface::themeClosed(QString appId, QString file, int instance)
+{
+ ThemesDlg* tw = getThemeWnd();
+ if(tw)
+ tw->removeTheme(appId, file, instance);
+}
+
+bool KarambaIface::isMainKaramba()
+{
+ if(getThemeWnd())
+ return true;
+ return false;
+}
+
+void KarambaIface::quit()
+{
+ karambaApp->quitSuperKaramba();
+}
+
+void KarambaIface::hideSystemTray(bool hide)
+{
+ karambaApp->hideSysTray(hide);
+}
+
+void KarambaIface::showThemeDialog()
+{
+ karambaApp->showThemeDialog();
+}