• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
karambainterface.cpp
1 /***************************************************************************
2  * Copyright (C) 2004 by Petri Damsten *
3  * petri.damsten@iki.fi *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  ***************************************************************************/
10 
11 #include "karamba.h"
12 #include "karambainterface.h"
13 #include <kdebug.h>
14 #include "tqwidgetlist.h"
15 #include "themesdlg.h"
16 
17 KarambaIface::KarambaIface(): DCOPObject("KarambaIface")
18 {
19 }
20 
21 KarambaIface::~KarambaIface()
22 {
23 }
24 
25 karamba* KarambaIface::getKaramba(TQString name)
26 {
27  TQWidgetList *list = TQApplication::allWidgets();
28  TQWidgetListIt it(*list); // iterate over the widgets
29  TQWidget* w;
30  karamba* result = 0;
31 
32  while ( (w=it.current()) != 0 ) // for each widget...
33  {
34  ++it;
35  if (TQString(w->name()).startsWith("karamba"))
36  {
37  karamba* k = (karamba*) w;
38  //if(k->prettyName == name)
39  if(k->theme().name() == name)
40  {
41  result = k;
42  break;
43  }
44  }
45  }
46  delete list;
47  return result;
48 }
49 
50 ThemesDlg* KarambaIface::getThemeWnd()
51 {
52  TQWidgetList *list = TQApplication::allWidgets();
53  TQWidgetListIt it( *list ); // iterate over the widgets
54  TQWidget* w;
55  ThemesDlg* result = 0;
56 
57  while ( (w=it.current()) != 0 ) // for each widget...
58  {
59  ++it;
60  if (TQString(w->name()) == "ThemesLayout")
61  {
62  result = (ThemesDlg*) w;
63  break;
64  }
65  }
66  delete list; // delete the list, not the widgets
67  return result;
68 }
69 
70 void KarambaIface::openTheme(TQString filename)
71 {
72  TQFileInfo file(filename);
73  if(file.exists())
74  {
75  (new karamba(filename, TQString()))->show();
76  }
77 }
78 
79 void KarambaIface::openNamedTheme(TQString filename, TQString name, bool is_sub_theme)
80 {
81  TQFileInfo file(filename);
82  if(file.exists())
83  {
84  (new karamba(filename, name, false, -1, is_sub_theme))->show();
85  }
86 }
87 
88 void KarambaIface::closeTheme(TQString name)
89 {
90  kdDebug() << "KarambaIface::closeTheme: " << name << endl;
91  karamba* k;
92 
93  while((k = getKaramba(name)))
94  {
95  k->writeConfigData();
96  k->close(true);
97  }
98 }
99 
100 int KarambaIface::themeAdded(TQString appId, TQString file)
101 {
102  ThemesDlg* tw = getThemeWnd();
103  if(tw)
104  return tw->addTheme(appId, file);
105  return -1;
106 }
107 
108 void KarambaIface::themeNotify(TQString name, TQString text)
109 {
110  karamba* k = getKaramba(name);
111  if(k)
112  {
113  k->themeNotify(name, text);
114  }
115 }
116 
117 void KarambaIface::setIncomingData(TQString name, TQString text)
118 {
119  karamba* k = getKaramba(name);
120  if(k)
121  {
122  k->_setIncomingData(text);
123  }
124 }
125 
126 void KarambaIface::themeClosed(TQString appId, TQString file, int instance)
127 {
128  ThemesDlg* tw = getThemeWnd();
129  if(tw)
130  tw->removeTheme(appId, file, instance);
131 }
132 
133 bool KarambaIface::isMainKaramba()
134 {
135  if(getThemeWnd())
136  return true;
137  return false;
138 }
139 
140 void KarambaIface::quit()
141 {
142  karambaApp->quitSuperKaramba();
143 }
144 
145 void KarambaIface::hideSystemTray(bool hide)
146 {
147  karambaApp->hideSysTray(hide);
148 }
149 
150 void KarambaIface::showThemeDialog()
151 {
152  karambaApp->showThemeDialog();
153 }

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.8.13
This website is maintained by Timothy Pearson.