summaryrefslogtreecommitdiff
path: root/core/pim/today/todayconfig.cpp
Unidiff
Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/todayconfig.cpp73
1 files changed, 16 insertions, 57 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index a60f1d2..bfb5ec6 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,28 +1,28 @@
1/* 1/*
2 * todayconfig.cpp 2 * todayconfig.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 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>
@@ -55,191 +55,150 @@ TodayConfig::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 or 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 or 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 // Misc tab
79 tab_3 = new QWidget( TabWidget3, "tab_3" ); 80 tab_3 = new QWidget( TabWidget3, "tab_3" );
80 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 81 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
81 tab3Layout->setMargin( 20 ); 82
82 QHBox *hbox_auto = new QHBox( tab_3 ); 83 m_guiMisc = new TodayConfigMiscBase( tab_3 );
83 TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); 84
84 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); 85 tab3Layout->addWidget( m_guiMisc );
85 QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) );
86 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
87 QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) );
88
89 QHBox *hbox_hide = new QHBox( tab_3 );
90 TextLabel4 = new QLabel( hbox_hide, "HideBanner" );
91 TextLabel4->setText( tr( "Tiny Banner" ) );
92 //QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) );
93 CheckBoxHide = new QCheckBox( hbox_hide, "CheckBoxHide" );
94 // QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) );
95
96 QHBox *hbox_inactive = new QHBox( tab_3 );
97 TimeLabel = new QLabel( hbox_inactive, "TimeLabel" );
98 TimeLabel->setText( tr( "minutes inactive" ) );
99 QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
100 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" );
101 SpinBoxTime->setMaxValue ( 1440 );
102 QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
103 QHBox *hbox_iconSize = new QHBox( tab_3 );
104 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" );
105 iconSizeLabel->setText( tr( "Icon size" ) );
106 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) );
107 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" );
108 SpinBoxIconSize->setMaxValue( 32 );
109 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) );
110
111 QHBox *hbox_refresh = new QHBox( tab_3 );
112 QLabel *refreshLabel = new QLabel( hbox_refresh );
113 refreshLabel->setText( tr( "Refresh" ) );
114 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) );
115 SpinRefresh = new QSpinBox( hbox_refresh );
116 SpinRefresh->setMinValue( 0 );
117 SpinRefresh->setSuffix( tr( " sec" ) );
118 SpinRefresh->setMaxValue ( 7200 );
119 SpinRefresh->setSpecialValueText ( tr("never") );
120 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) );
121
122 tab3Layout->addWidget( hbox_auto );
123 tab3Layout->addWidget( hbox_hide );
124 tab3Layout->addWidget( hbox_inactive );
125 tab3Layout->addWidget( hbox_iconSize );
126 tab3Layout->addWidget( hbox_refresh );
127 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 86 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
128 87
129 m_applets_changed = false; 88 m_applets_changed = false;
130 89
131 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 90 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
132 91
133 readConfig(); 92 readConfig();
134 showMaximized(); 93 showMaximized();
135} 94}
136 95
137 96
138/** 97/**
139 * Autostart, uses the new (opie only) autostart method in the launcher code. 98 * Autostart, uses the new (opie only) autostart method in the launcher code.
140 * If registered against that today ist started on each resume. 99 * If registered against that today ist started on each resume.
141 */ 100 */
142void TodayConfig::setAutoStart() { 101void TodayConfig::setAutoStart() {
143 Config cfg( "today" ); 102 Config cfg( "today" );
144 cfg.setGroup( "Autostart" ); 103 cfg.setGroup( "Autostart" );
145 if ( m_autoStart ) { 104 if ( m_autoStart ) {
146 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 105 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
147 e << QString( "add" ); 106 e << QString( "add" );
148 e << QString( "today" ); 107 e << QString( "today" );
149 e << QString( "%1" ).arg( m_autoStartTimer ); 108 e << QString( "%1" ).arg( m_autoStartTimer );
150 } else { 109 } else {
151 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 110 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
152 e << QString( "remove" ); 111 e << QString( "remove" );
153 e << QString( "today" ); 112 e << QString( "today" );
154 } 113 }
155} 114}
156 115
157/** 116/**
158 * Read the config part 117 * Read the config part
159 */ 118 */
160void TodayConfig::readConfig() { 119void TodayConfig::readConfig() {
161 Config cfg( "today" ); 120 Config cfg( "today" );
162 cfg.setGroup( "Autostart" ); 121 cfg.setGroup( "Autostart" );
163 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 122 m_autoStart = cfg.readNumEntry( "autostart", 1 );
164 CheckBoxAuto->setChecked( m_autoStart ); 123 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart );
165 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 124 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
166 SpinBoxTime->setValue( m_autoStartTimer ); 125 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer );
167 126
168 cfg.setGroup( "General" ); 127 cfg.setGroup( "General" );
169 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 128 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
170 SpinBoxIconSize->setValue( m_iconSize ); 129 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize );
171 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 130 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
172 CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); 131 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) );
173 132
174 133
175 cfg.setGroup( "Plugins" ); 134 cfg.setGroup( "Plugins" );
176 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 135 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
177} 136}
178 137
179/** 138/**
180 * Write the config part 139 * Write the config part
181 */ 140 */
182void TodayConfig::writeConfig() { 141void TodayConfig::writeConfig() {
183 Config cfg( "today" ); 142 Config cfg( "today" );
184 cfg.setGroup( "Plugins" ); 143 cfg.setGroup( "Plugins" );
185 if ( m_applets_changed ) { 144 if ( m_applets_changed ) {
186 QStringList exclude; 145 QStringList exclude;
187 QStringList include; 146 QStringList include;
188 QStringList all_applets; 147 QStringList all_applets;
189 148
190 QListViewItemIterator list_it( m_appletListView ); 149 QListViewItemIterator list_it( m_appletListView );
191 150
192 // this makes sure the names get saved in the order selected 151 // this makes sure the names get saved in the order selected
193 for ( ; list_it.current(); ++list_it ) { 152 for ( ; list_it.current(); ++list_it ) {
194 QMap <QString, QCheckListItem *>::Iterator it; 153 QMap <QString, QCheckListItem *>::Iterator it;
195 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 154 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
196 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 155 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
197 exclude << it.key(); 156 exclude << it.key();
198 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 157 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
199 include << it.key(); 158 include << it.key();
200 } 159 }
201 if ( list_it.current() == (*it) ) { 160 if ( list_it.current() == (*it) ) {
202 all_applets << it.key(); 161 all_applets << it.key();
203 } 162 }
204 } 163 }
205 } 164 }
206 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 165 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
207 cfg.writeEntry( "IncludeApplets", include, ',' ); 166 cfg.writeEntry( "IncludeApplets", include, ',' );
208 cfg.writeEntry( "AllApplets", all_applets, ',' ); 167 cfg.writeEntry( "AllApplets", all_applets, ',' );
209 } 168 }
210 169
211 cfg.setGroup( "Autostart" ); 170 cfg.setGroup( "Autostart" );
212 m_autoStart = CheckBoxAuto->isChecked(); 171 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked();
213 cfg.writeEntry( "autostart", m_autoStart ); 172 cfg.writeEntry( "autostart", m_autoStart );
214 m_autoStartTimer = SpinBoxTime->value(); 173 m_autoStartTimer = m_guiMisc->SpinBoxTime->value();
215 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 174 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
216 m_iconSize = SpinBoxIconSize->value(); 175 m_iconSize = m_guiMisc->SpinBoxIconSize->value();
217 176
218 cfg.setGroup( "General" ); 177 cfg.setGroup( "General" );
219 cfg.writeEntry( "IconSize", m_iconSize ); 178 cfg.writeEntry( "IconSize", m_iconSize );
220 cfg.writeEntry( "HideBanner", CheckBoxHide->isChecked() ); 179 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() );
221 cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 ); 180 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 );
222 181
223 // set autostart settings 182 // set autostart settings
224 setAutoStart(); 183 setAutoStart();
225} 184}
226 185
227 186
228void TodayConfig::moveSelectedUp() { 187void TodayConfig::moveSelectedUp() {
229 QListViewItem *item = m_appletListView->selectedItem(); 188 QListViewItem *item = m_appletListView->selectedItem();
230 if ( item && item->itemAbove() ) { 189 if ( item && item->itemAbove() ) {
231 item->itemAbove()->moveItem( item ); 190 item->itemAbove()->moveItem( item );
232 } 191 }
233} 192}
234 193
235 194
236void TodayConfig::moveSelectedDown() { 195void TodayConfig::moveSelectedDown() {
237 QListViewItem *item = m_appletListView->selectedItem(); 196 QListViewItem *item = m_appletListView->selectedItem();
238 if ( item && item->itemBelow() ) { 197 if ( item && item->itemBelow() ) {
239 item->moveItem( item->itemBelow() ); 198 item->moveItem( item->itemBelow() );
240 } 199 }
241} 200}
242 201
243 202
244/** 203/**
245 * Set up the icons in the order/active tab 204 * Set up the icons in the order/active tab