summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/todayconfig.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 8d0b069..bedfd61 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,220 +1,221 @@
1/* 1/*
2 * todayconfig.cpp 2 * todayconfig.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todayconfig.h" 17#include "todayconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qcheckbox.h> 23#include <qcheckbox.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qspinbox.h> 25#include <qspinbox.h>
26#include <qtabwidget.h> 26#include <qtabwidget.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qheader.h> 28#include <qheader.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qvbox.h> 30#include <qvbox.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32#include <qtooltip.h> 32#include <qtooltip.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34 34
35class ToolButton : public QToolButton { 35class ToolButton : public QToolButton {
36 36
37public: 37public:
38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
39 : QToolButton( parent, name ) { 39 : QToolButton( parent, name ) {
40 setPixmap( Resource::loadPixmap( icon ) ); 40 setPixmap( Resource::loadPixmap( icon ) );
41 setAutoRaise( TRUE ); 41 setAutoRaise( TRUE );
42 setFocusPolicy( QWidget::NoFocus ); 42 setFocusPolicy( QWidget::NoFocus );
43 setToggleButton( t ); 43 setToggleButton( t );
44 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 44 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
45 } 45 }
46}; 46};
47 47
48 48
49/** 49/**
50 * The class has currently quite some duplicate code. 50 * The class has currently quite some duplicate code.
51 * By that way it would be real easy to have it as seperate app in settings tab 51 * By that way it would be real easy to have it as seperate app in settings tab
52 * 52 *
53 */ 53 */
54TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) 54TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
55 : QDialog( parent, name, modal, WStyle_ContextHelp ) { 55 : QDialog( parent, name, modal, WStyle_ContextHelp ) {
56 56
57 setCaption( tr( "Today config" ) ); 57 setCaption( tr( "Today config" ) );
58 58
59 QVBoxLayout *layout = new QVBoxLayout( this ); 59 QVBoxLayout *layout = new QVBoxLayout( this );
60 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 60 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
61 layout->addWidget( TabWidget3 ); 61 layout->addWidget( TabWidget3 );
62 62
63 tab_2 = new QWidget( TabWidget3, "tab_2" ); 63 tab_2 = new QWidget( TabWidget3, "tab_2" );
64 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); 64 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
65 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); 65 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
66 tab2Layout->addWidget( l ); 66 tab2Layout->addWidget( l );
67 QHBox *hbox1 = new QHBox( tab_2 ); 67 QHBox *hbox1 = new QHBox( tab_2 );
68 m_appletListView = new QListView( hbox1 ); 68 m_appletListView = new QListView( hbox1 );
69 m_appletListView->addColumn( "PluginList" ); 69 m_appletListView->addColumn( "PluginList" );
70 m_appletListView->header()->hide(); 70 m_appletListView->header()->hide();
71 m_appletListView->setSorting( -1 ); 71 m_appletListView->setSorting( -1 );
72 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin ore use the arrow buttons on the right to change the appearance order" ) ); 72 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin ore use the arrow buttons on the right to change the appearance order" ) );
73 QVBox *vbox1 = new QVBox( hbox1 ); 73 QVBox *vbox1 = new QVBox( hbox1 );
74 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 74 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
75 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 75 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
76 tab2Layout->addWidget( hbox1 ); 76 tab2Layout->addWidget( hbox1 );
77 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 77 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
78 78
79 tab_3 = new QWidget( TabWidget3, "tab_3" ); 79 tab_3 = new QWidget( TabWidget3, "tab_3" );
80 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 80 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
81 tab3Layout->setMargin( 20 ); 81 tab3Layout->setMargin( 20 );
82 QHBox *hbox_auto = new QHBox( tab_3 ); 82 QHBox *hbox_auto = new QHBox( tab_3 );
83 TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); 83 TextLabel2 = new QLabel( hbox_auto, "AutoStart" );
84 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); 84 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) );
85 QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); 85 QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) );
86 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); 86 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
87 QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); 87 QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) );
88 QHBox *hbox_inactive = new QHBox( tab_3 ); 88 QHBox *hbox_inactive = new QHBox( tab_3 );
89 TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); 89 TimeLabel = new QLabel( hbox_inactive, "TimeLabel" );
90 TimeLabel->setText( tr( "minutes inactive" ) ); 90 TimeLabel->setText( tr( "minutes inactive" ) );
91 QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); 91 QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
92 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); 92 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" );
93 SpinBoxTime->setMaxValue ( 1440 );
93 QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); 94 QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
94 QHBox *hbox_iconSize = new QHBox( tab_3 ); 95 QHBox *hbox_iconSize = new QHBox( tab_3 );
95 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); 96 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" );
96 iconSizeLabel->setText( tr( "Icon size" ) ); 97 iconSizeLabel->setText( tr( "Icon size" ) );
97 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); 98 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) );
98 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); 99 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" );
99 SpinBoxIconSize->setMaxValue( 32 ); 100 SpinBoxIconSize->setMaxValue( 32 );
100 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); 101 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) );
101 102
102 QHBox *hbox_refresh = new QHBox( tab_3 ); 103 QHBox *hbox_refresh = new QHBox( tab_3 );
103 QLabel *refreshLabel = new QLabel( hbox_refresh ); 104 QLabel *refreshLabel = new QLabel( hbox_refresh );
104 refreshLabel->setText( tr( "Refresh" ) ); 105 refreshLabel->setText( tr( "Refresh" ) );
105 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); 106 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) );
106 SpinRefresh = new QSpinBox( hbox_refresh ); 107 SpinRefresh = new QSpinBox( hbox_refresh );
107 SpinRefresh->setMinValue( 0 ); 108 SpinRefresh->setMinValue( 0 );
108 SpinRefresh->setSuffix( tr( " sec" ) ); 109 SpinRefresh->setSuffix( tr( " sec" ) );
109 SpinRefresh->setMaxValue ( 7200 ); 110 SpinRefresh->setMaxValue ( 7200 );
110 SpinRefresh->setSpecialValueText ( tr("never") ); 111 SpinRefresh->setSpecialValueText ( tr("never") );
111 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); 112 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) );
112 113
113 tab3Layout->addWidget( hbox_auto ); 114 tab3Layout->addWidget( hbox_auto );
114 tab3Layout->addWidget( hbox_inactive ); 115 tab3Layout->addWidget( hbox_inactive );
115 tab3Layout->addWidget( hbox_iconSize ); 116 tab3Layout->addWidget( hbox_iconSize );
116 tab3Layout->addWidget( hbox_refresh ); 117 tab3Layout->addWidget( hbox_refresh );
117 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 118 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
118 119
119 m_applets_changed = false; 120 m_applets_changed = false;
120 121
121 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 122 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
122 123
123 readConfig(); 124 readConfig();
124 showMaximized(); 125 showMaximized();
125} 126}
126 127
127 128
128/** 129/**
129 * Autostart, uses the new (opie only) autostart method in the launcher code. 130 * Autostart, uses the new (opie only) autostart method in the launcher code.
130 * If registered against that today ist started on each resume. 131 * If registered against that today ist started on each resume.
131 */ 132 */
132void TodayConfig::setAutoStart() { 133void TodayConfig::setAutoStart() {
133 Config cfg( "today" ); 134 Config cfg( "today" );
134 cfg.setGroup( "Autostart" ); 135 cfg.setGroup( "Autostart" );
135 if ( m_autoStart ) { 136 if ( m_autoStart ) {
136 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 137 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
137 e << QString( "add" ); 138 e << QString( "add" );
138 e << QString( "today" ); 139 e << QString( "today" );
139 e << QString( "%1" ).arg( m_autoStartTimer ); 140 e << QString( "%1" ).arg( m_autoStartTimer );
140 } else { 141 } else {
141 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 142 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
142 e << QString( "remove" ); 143 e << QString( "remove" );
143 e << QString( "today" ); 144 e << QString( "today" );
144 } 145 }
145} 146}
146 147
147/** 148/**
148 * Read the config part 149 * Read the config part
149 */ 150 */
150void TodayConfig::readConfig() { 151void TodayConfig::readConfig() {
151 Config cfg( "today" ); 152 Config cfg( "today" );
152 cfg.setGroup( "Autostart" ); 153 cfg.setGroup( "Autostart" );
153 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 154 m_autoStart = cfg.readNumEntry( "autostart", 1 );
154 CheckBoxAuto->setChecked( m_autoStart ); 155 CheckBoxAuto->setChecked( m_autoStart );
155 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 156 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
156 SpinBoxTime->setValue( m_autoStartTimer ); 157 SpinBoxTime->setValue( m_autoStartTimer );
157 158
158 cfg.setGroup( "General" ); 159 cfg.setGroup( "General" );
159 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 160 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
160 SpinBoxIconSize->setValue( m_iconSize ); 161 SpinBoxIconSize->setValue( m_iconSize );
161 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 162 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
162 163
163 164
164 cfg.setGroup( "Plugins" ); 165 cfg.setGroup( "Plugins" );
165 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 166 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
166} 167}
167 168
168/** 169/**
169 * Write the config part 170 * Write the config part
170 */ 171 */
171void TodayConfig::writeConfig() { 172void TodayConfig::writeConfig() {
172 Config cfg( "today" ); 173 Config cfg( "today" );
173 cfg.setGroup( "Plugins" ); 174 cfg.setGroup( "Plugins" );
174 if ( m_applets_changed ) { 175 if ( m_applets_changed ) {
175 QStringList exclude; 176 QStringList exclude;
176 QStringList include; 177 QStringList include;
177 QStringList all_applets; 178 QStringList all_applets;
178 179
179 QListViewItemIterator list_it( m_appletListView ); 180 QListViewItemIterator list_it( m_appletListView );
180 181
181 // this makes sure the names get saved in the order selected 182 // this makes sure the names get saved in the order selected
182 for ( ; list_it.current(); ++list_it ) { 183 for ( ; list_it.current(); ++list_it ) {
183 QMap <QString, QCheckListItem *>::Iterator it; 184 QMap <QString, QCheckListItem *>::Iterator it;
184 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 185 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
185 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 186 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
186 exclude << it.key(); 187 exclude << it.key();
187 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 188 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
188 include << it.key(); 189 include << it.key();
189 } 190 }
190 if ( list_it.current() == (*it) ) { 191 if ( list_it.current() == (*it) ) {
191 all_applets << it.key(); 192 all_applets << it.key();
192 } 193 }
193 } 194 }
194 } 195 }
195 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 196 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
196 cfg.writeEntry( "IncludeApplets", include, ',' ); 197 cfg.writeEntry( "IncludeApplets", include, ',' );
197 cfg.writeEntry( "AllApplets", all_applets, ',' ); 198 cfg.writeEntry( "AllApplets", all_applets, ',' );
198 } 199 }
199 200
200 cfg.setGroup( "Autostart" ); 201 cfg.setGroup( "Autostart" );
201 m_autoStart = CheckBoxAuto->isChecked(); 202 m_autoStart = CheckBoxAuto->isChecked();
202 cfg.writeEntry( "autostart", m_autoStart ); 203 cfg.writeEntry( "autostart", m_autoStart );
203 m_autoStartTimer = SpinBoxTime->value(); 204 m_autoStartTimer = SpinBoxTime->value();
204 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 205 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
205 m_iconSize = SpinBoxIconSize->value(); 206 m_iconSize = SpinBoxIconSize->value();
206 207
207 cfg.setGroup( "General" ); 208 cfg.setGroup( "General" );
208 cfg.writeEntry( "IconSize", m_iconSize ); 209 cfg.writeEntry( "IconSize", m_iconSize );
209 cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 ); 210 cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 );
210 211
211 // set autostart settings 212 // set autostart settings
212 setAutoStart(); 213 setAutoStart();
213} 214}
214 215
215 216
216void TodayConfig::moveSelectedUp() { 217void TodayConfig::moveSelectedUp() {
217 QListViewItem *item = m_appletListView->selectedItem(); 218 QListViewItem *item = m_appletListView->selectedItem();
218 if ( item && item->itemAbove() ) { 219 if ( item && item->itemAbove() ) {
219 item->itemAbove()->moveItem( item ); 220 item->itemAbove()->moveItem( item );
220 } 221 }