summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-04-05 23:31:44 (UTC)
committer zautrix <zautrix>2005-04-05 23:31:44 (UTC)
commitcf4848d972efe96640f2d5f5d52704306d0cbe4c (patch) (unidiff)
tree123a2075927def5f7f59a20949d6b59174ae79b6 /microkde
parent6add774cf9841377f32613c7aa23161a823aa1da (diff)
downloadkdepimpi-cf4848d972efe96640f2d5f5d52704306d0cbe4c.zip
kdepimpi-cf4848d972efe96640f2d5f5d52704306d0cbe4c.tar.gz
kdepimpi-cf4848d972efe96640f2d5f5d52704306d0cbe4c.tar.bz2
fixes
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kglobalsettings.cpp16
-rw-r--r--microkde/kglobalsettings.h1
-rw-r--r--microkde/kutils/kcmultidialog.cpp2
3 files changed, 18 insertions, 1 deletions
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index b6d2feb..b837b23 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -1,50 +1,66 @@
1#include "kglobalsettings.h" 1#include "kglobalsettings.h"
2#include "kconfig.h" 2#include "kconfig.h"
3#include "kglobal.h" 3#include "kglobal.h"
4#include "kconfigbase.h" 4#include "kconfigbase.h"
5 5
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8QFont KGlobalSettings::generalFont() 8QFont KGlobalSettings::generalFont()
9{ 9{
10 int size = 12; 10 int size = 12;
11 if (QApplication::desktop()->width() < 480 ) { 11 if (QApplication::desktop()->width() < 480 ) {
12 size = 10; 12 size = 10;
13 } 13 }
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15 else 15 else
16 if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) 16 if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
17 size = 18; 17 size = 18;
18#endif 18#endif
19 QFont f = QApplication::font(); 19 QFont f = QApplication::font();
20 //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); 20 //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1());
21 f.setPointSize( size ); 21 f.setPointSize( size );
22 return f; 22 return f;
23} 23}
24QFont KGlobalSettings::generalMaxFont()
25{
26 int size = 12;
27 if (QApplication::desktop()->width() < 480 ) {
28 size = 10;
29 }
30#ifndef DESKTOP_VERSION
31 else
32 if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
33 size = 18;
34#endif
35 QFont f = QApplication::font();
36 if ( f.pointSize() > size )
37 f.setPointSize( size );
38 return f;
39}
24QFont KGlobalSettings::toolBarFont() 40QFont KGlobalSettings::toolBarFont()
25{ 41{
26 return QApplication::font(); 42 return QApplication::font();
27} 43}
28 44
29QColor KGlobalSettings::toolBarHighlightColor() 45QColor KGlobalSettings::toolBarHighlightColor()
30{ 46{
31 return QColor( "black" ); 47 return QColor( "black" );
32} 48}
33 49
34QRect KGlobalSettings::desktopGeometry( QWidget * ) 50QRect KGlobalSettings::desktopGeometry( QWidget * )
35{ 51{
36 return QApplication::desktop()->rect(); 52 return QApplication::desktop()->rect();
37} 53}
38 54
39 /** 55 /**
40 * Returns whether KDE runs in single (default) or double click 56 * Returns whether KDE runs in single (default) or double click
41 * mode. 57 * mode.
42 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html 58 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html
43 * @return true if single click mode, or false if double click mode. 59 * @return true if single click mode, or false if double click mode.
44 **/ 60 **/
45bool KGlobalSettings::singleClick() 61bool KGlobalSettings::singleClick()
46{ 62{
47 KConfig *c = KGlobal::config(); 63 KConfig *c = KGlobal::config();
48 KConfigGroupSaver cgs( c, "KDE" ); 64 KConfigGroupSaver cgs( c, "KDE" );
49 return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); 65 return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK);
50} 66}
diff --git a/microkde/kglobalsettings.h b/microkde/kglobalsettings.h
index 7df8012..075bb1c 100644
--- a/microkde/kglobalsettings.h
+++ b/microkde/kglobalsettings.h
@@ -1,30 +1,31 @@
1#ifndef MICROKDE_KGLOBALSETTINGS_H 1#ifndef MICROKDE_KGLOBALSETTINGS_H
2#define MICROKDE_KGLOBALSETTINGS_H 2#define MICROKDE_KGLOBALSETTINGS_H
3 3
4#include <qfont.h> 4#include <qfont.h>
5#include <qrect.h> 5#include <qrect.h>
6 6
7 7
8#define KDE_DEFAULT_SINGLECLICK true 8#define KDE_DEFAULT_SINGLECLICK true
9 9
10 10
11class KGlobalSettings 11class KGlobalSettings
12{ 12{
13 public: 13 public:
14 static QFont generalFont(); 14 static QFont generalFont();
15 static QFont generalMaxFont();
15 static QFont toolBarFont(); 16 static QFont toolBarFont();
16 17
17 static QColor toolBarHighlightColor(); 18 static QColor toolBarHighlightColor();
18 static QRect desktopGeometry( QWidget * ); 19 static QRect desktopGeometry( QWidget * );
19 20
20 /** 21 /**
21 * Returns whether KDE runs in single (default) or double click 22 * Returns whether KDE runs in single (default) or double click
22 * mode. 23 * mode.
23 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html 24 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html
24 * @return true if single click mode, or false if double click mode. 25 * @return true if single click mode, or false if double click mode.
25 **/ 26 **/
26 static bool singleClick(); 27 static bool singleClick();
27 28
28}; 29};
29 30
30#endif 31#endif
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index bb41b18..9c87682 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,229 +1,229 @@
1/* 1/*
2 Copyright (c) 2000 Matthias Elter <elter@kde.org> 2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> 3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 19
20*/ 20*/
21 21
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qcursor.h> 24#include <qcursor.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kglobal.h> 28#include <kglobal.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32//US #include <klibloader.h> 32//US #include <klibloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kprocess.h> 34#include <kprocess.h>
35#include <kglobalsettings.h> 35#include <kglobalsettings.h>
36 36
37#include "kcmultidialog.h" 37#include "kcmultidialog.h"
38//US #include "kcmultidialog.moc" 38//US #include "kcmultidialog.moc"
39//US #include "kcmoduleloader.h" 39//US #include "kcmoduleloader.h"
40 40
41KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) 41KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
42 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, 42 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
43 parent, name, modal, true), d(0L) 43 parent, name, modal, true), d(0L)
44{ 44{
45 setFont( KGlobalSettings::generalFont() ); 45 setFont( KGlobalSettings::generalMaxFont() );
46 enableButton(Apply, false); 46 enableButton(Apply, false);
47 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); 47 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
48 48
49 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); 49 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
50 50
51 _baseGroup = baseGroup; 51 _baseGroup = baseGroup;
52 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); 52 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
53 setMainWidget(mMainWidget ); 53 setMainWidget(mMainWidget );
54#ifdef DESKTOP_VERSION 54#ifdef DESKTOP_VERSION
55 resize(640,480); 55 resize(640,480);
56#else 56#else
57 //resize(640,480); 57 //resize(640,480);
58 //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); 58 //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
59 resize(800,800); 59 resize(800,800);
60 setMaximumSize( 800, 800 ); 60 setMaximumSize( 800, 800 );
61 //showMaximized(); 61 //showMaximized();
62#endif 62#endif
63 63
64} 64}
65 65
66KCMultiDialog::~KCMultiDialog() 66KCMultiDialog::~KCMultiDialog()
67{ 67{
68//US moduleDict.setAutoDelete(true); 68//US moduleDict.setAutoDelete(true);
69} 69}
70 70
71void KCMultiDialog::slotDefault() 71void KCMultiDialog::slotDefault()
72{ 72{
73 73
74 int curPageIndex = activePageIndex(); 74 int curPageIndex = activePageIndex();
75 75
76 QPtrListIterator<KCModule> it(modules); 76 QPtrListIterator<KCModule> it(modules);
77 for (; it.current(); ++it) 77 for (; it.current(); ++it)
78 { 78 {
79 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) 79 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
80 { 80 {
81 (*it)->defaults(); 81 (*it)->defaults();
82 clientChanged(true); 82 clientChanged(true);
83 return; 83 return;
84 } 84 }
85 } 85 }
86 86
87} 87}
88void KCMultiDialog::accept() 88void KCMultiDialog::accept()
89{ 89{
90 slotOk(); 90 slotOk();
91} 91}
92void KCMultiDialog::slotApply() 92void KCMultiDialog::slotApply()
93{ 93{
94 QPtrListIterator<KCModule> it(modules); 94 QPtrListIterator<KCModule> it(modules);
95 for (; it.current(); ++it) 95 for (; it.current(); ++it)
96 (*it)->save(); 96 (*it)->save();
97 clientChanged(false); 97 clientChanged(false);
98 98
99 emit applyClicked(); 99 emit applyClicked();
100 100
101} 101}
102 102
103 103
104void KCMultiDialog::slotOk() 104void KCMultiDialog::slotOk()
105{ 105{
106qDebug("KCMultiDialog::slotOk clicked"); 106qDebug("KCMultiDialog::slotOk clicked");
107 107
108 QPtrListIterator<KCModule> it(modules); 108 QPtrListIterator<KCModule> it(modules);
109 for (; it.current(); ++it) 109 for (; it.current(); ++it)
110 (*it)->save(); 110 (*it)->save();
111 QDialog::accept(); 111 QDialog::accept();
112 112
113 emit okClicked(); 113 emit okClicked();
114} 114}
115 115
116void KCMultiDialog::slotHelp() 116void KCMultiDialog::slotHelp()
117{ 117{
118/*US 118/*US
119 KURL url( KURL("help:/"), _docPath ); 119 KURL url( KURL("help:/"), _docPath );
120 120
121 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { 121 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
122 KProcess process; 122 KProcess process;
123 process << "khelpcenter" 123 process << "khelpcenter"
124 << url.url(); 124 << url.url();
125 process.start(KProcess::DontCare); 125 process.start(KProcess::DontCare);
126 process.detach(); 126 process.detach();
127 } else { 127 } else {
128 new KRun(url); 128 new KRun(url);
129 } 129 }
130*/ 130*/
131} 131}
132 132
133void KCMultiDialog::clientChanged(bool state) 133void KCMultiDialog::clientChanged(bool state)
134{ 134{
135 enableButton(Apply, state); 135 enableButton(Apply, state);
136} 136}
137 137
138/*US 138/*US
139void KCMultiDialog::addModule(const QString& path, bool withfallback) 139void KCMultiDialog::addModule(const QString& path, bool withfallback)
140{ 140{
141 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; 141 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
142 142
143 KCModuleInfo info(path, _baseGroup); 143 KCModuleInfo info(path, _baseGroup);
144 144
145 QHBox* page = addHBoxPage(info.moduleName(), info.comment(), 145 QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
146 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); 146 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
147 if(!page) { 147 if(!page) {
148 KCModuleLoader::unloadModule(info); 148 KCModuleLoader::unloadModule(info);
149 return; 149 return;
150 } 150 }
151 moduleDict.insert(page, new LoadInfo(path, withfallback)); 151 moduleDict.insert(page, new LoadInfo(path, withfallback));
152 if (modules.isEmpty()) 152 if (modules.isEmpty())
153 slotAboutToShow(page); 153 slotAboutToShow(page);
154} 154}
155*/ 155*/
156QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) 156QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
157{ 157{
158 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); 158 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
159 return page; 159 return page;
160 160
161} 161}
162//US special method for microkde. We dop noty want to load everything dynamically. 162//US special method for microkde. We dop noty want to load everything dynamically.
163void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) 163void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
164{ 164{
165 165
166 modules.append(module); 166 modules.append(module);
167 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 167 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
168//US 168//US
169 module->load(); 169 module->load();
170 170
171 171
172} 172}
173 173
174void KCMultiDialog::slotAboutToShow(QWidget *page) 174void KCMultiDialog::slotAboutToShow(QWidget *page)
175{ 175{
176/*US 176/*US
177 LoadInfo *loadInfo = moduleDict[page]; 177 LoadInfo *loadInfo = moduleDict[page];
178 if (!loadInfo) 178 if (!loadInfo)
179 return; 179 return;
180 180
181 QApplication::setOverrideCursor(Qt::WaitCursor); 181 QApplication::setOverrideCursor(Qt::WaitCursor);
182 182
183 moduleDict.remove(page); 183 moduleDict.remove(page);
184 184
185 KCModuleInfo info(loadInfo->path, _baseGroup); 185 KCModuleInfo info(loadInfo->path, _baseGroup);
186 186
187 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); 187 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
188 188
189 if (!module) 189 if (!module)
190 { 190 {
191 QApplication::restoreOverrideCursor(); 191 QApplication::restoreOverrideCursor();
192 KCModuleLoader::showLastLoaderError(this); 192 KCModuleLoader::showLastLoaderError(this);
193 delete loadInfo; 193 delete loadInfo;
194 return; 194 return;
195 } 195 }
196 196
197 module->reparent(page,0,QPoint(0,0),true); 197 module->reparent(page,0,QPoint(0,0),true);
198 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 198 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
199 //setHelp( docpath, QString::null ); 199 //setHelp( docpath, QString::null );
200 _docPath = info.docPath(); 200 _docPath = info.docPath();
201 modules.append(module); 201 modules.append(module);
202 202
203 //KCGlobal::repairAccels( topLevelWidget() ); 203 //KCGlobal::repairAccels( topLevelWidget() );
204 204
205 delete loadInfo; 205 delete loadInfo;
206 206
207 QApplication::restoreOverrideCursor(); 207 QApplication::restoreOverrideCursor();
208*/ 208*/
209 209
210qDebug("KCMultiDialog::slotAboutToShow not implemented"); 210qDebug("KCMultiDialog::slotAboutToShow not implemented");
211} 211}
212 212
213 213
214bool KCMultiDialog::showPage( int index ) 214bool KCMultiDialog::showPage( int index )
215{ 215{
216 return(mMainWidget->showPage(index) ); 216 return(mMainWidget->showPage(index) );
217} 217}
218 218
219 219
220int KCMultiDialog::activePageIndex() const 220int KCMultiDialog::activePageIndex() const
221{ 221{
222 return( mMainWidget->activePageIndex() ); 222 return( mMainWidget->activePageIndex() );
223} 223}
224 224
225 225
226int KCMultiDialog::pageIndex( QWidget *widget ) const 226int KCMultiDialog::pageIndex( QWidget *widget ) const
227{ 227{
228 return( mMainWidget->pageIndex( widget) ); 228 return( mMainWidget->pageIndex( widget) );
229} 229}