summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/todayconfig.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index bedfd61..0774ccb 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,200 +1,200 @@
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 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 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 SpinBoxTime->setMaxValue ( 1440 );
94 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" ) );
95 QHBox *hbox_iconSize = new QHBox( tab_3 ); 95 QHBox *hbox_iconSize = new QHBox( tab_3 );
96 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); 96 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" );
97 iconSizeLabel->setText( tr( "Icon size" ) ); 97 iconSizeLabel->setText( tr( "Icon size" ) );
98 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); 98 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) );
99 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); 99 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" );
100 SpinBoxIconSize->setMaxValue( 32 ); 100 SpinBoxIconSize->setMaxValue( 32 );
101 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); 101 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) );
102 102
103 QHBox *hbox_refresh = new QHBox( tab_3 ); 103 QHBox *hbox_refresh = new QHBox( tab_3 );
104 QLabel *refreshLabel = new QLabel( hbox_refresh ); 104 QLabel *refreshLabel = new QLabel( hbox_refresh );
105 refreshLabel->setText( tr( "Refresh" ) ); 105 refreshLabel->setText( tr( "Refresh" ) );
106 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); 106 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) );
107 SpinRefresh = new QSpinBox( hbox_refresh ); 107 SpinRefresh = new QSpinBox( hbox_refresh );
108 SpinRefresh->setMinValue( 0 ); 108 SpinRefresh->setMinValue( 0 );
109 SpinRefresh->setSuffix( tr( " sec" ) ); 109 SpinRefresh->setSuffix( tr( " sec" ) );
110 SpinRefresh->setMaxValue ( 7200 ); 110 SpinRefresh->setMaxValue ( 7200 );
111 SpinRefresh->setSpecialValueText ( tr("never") ); 111 SpinRefresh->setSpecialValueText ( tr("never") );
112 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); 112 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) );
113 113
114 tab3Layout->addWidget( hbox_auto ); 114 tab3Layout->addWidget( hbox_auto );
115 tab3Layout->addWidget( hbox_inactive ); 115 tab3Layout->addWidget( hbox_inactive );
116 tab3Layout->addWidget( hbox_iconSize ); 116 tab3Layout->addWidget( hbox_iconSize );
117 tab3Layout->addWidget( hbox_refresh ); 117 tab3Layout->addWidget( hbox_refresh );
118 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 118 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
119 119
120 m_applets_changed = false; 120 m_applets_changed = false;
121 121
122 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 122 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
123 123
124 readConfig(); 124 readConfig();
125 showMaximized(); 125 showMaximized();
126} 126}
127 127
128 128
129/** 129/**
130 * 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.
131 * If registered against that today ist started on each resume. 131 * If registered against that today ist started on each resume.
132 */ 132 */
133void TodayConfig::setAutoStart() { 133void TodayConfig::setAutoStart() {
134 Config cfg( "today" ); 134 Config cfg( "today" );
135 cfg.setGroup( "Autostart" ); 135 cfg.setGroup( "Autostart" );
136 if ( m_autoStart ) { 136 if ( m_autoStart ) {
137 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 137 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
138 e << QString( "add" ); 138 e << QString( "add" );
139 e << QString( "today" ); 139 e << QString( "today" );
140 e << QString( "%1" ).arg( m_autoStartTimer ); 140 e << QString( "%1" ).arg( m_autoStartTimer );
141 } else { 141 } else {
142 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 142 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
143 e << QString( "remove" ); 143 e << QString( "remove" );
144 e << QString( "today" ); 144 e << QString( "today" );
145 } 145 }
146} 146}
147 147
148/** 148/**
149 * Read the config part 149 * Read the config part
150 */ 150 */
151void TodayConfig::readConfig() { 151void TodayConfig::readConfig() {
152 Config cfg( "today" ); 152 Config cfg( "today" );
153 cfg.setGroup( "Autostart" ); 153 cfg.setGroup( "Autostart" );
154 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 154 m_autoStart = cfg.readNumEntry( "autostart", 1 );
155 CheckBoxAuto->setChecked( m_autoStart ); 155 CheckBoxAuto->setChecked( m_autoStart );
156 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 156 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
157 SpinBoxTime->setValue( m_autoStartTimer ); 157 SpinBoxTime->setValue( m_autoStartTimer );
158 158
159 cfg.setGroup( "General" ); 159 cfg.setGroup( "General" );
160 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 160 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
161 SpinBoxIconSize->setValue( m_iconSize ); 161 SpinBoxIconSize->setValue( m_iconSize );
162 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 162 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
163 163
164 164
165 cfg.setGroup( "Plugins" ); 165 cfg.setGroup( "Plugins" );
166 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 166 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
167} 167}
168 168
169/** 169/**
170 * Write the config part 170 * Write the config part
171 */ 171 */
172void TodayConfig::writeConfig() { 172void TodayConfig::writeConfig() {
173 Config cfg( "today" ); 173 Config cfg( "today" );
174 cfg.setGroup( "Plugins" ); 174 cfg.setGroup( "Plugins" );
175 if ( m_applets_changed ) { 175 if ( m_applets_changed ) {
176 QStringList exclude; 176 QStringList exclude;
177 QStringList include; 177 QStringList include;
178 QStringList all_applets; 178 QStringList all_applets;
179 179
180 QListViewItemIterator list_it( m_appletListView ); 180 QListViewItemIterator list_it( m_appletListView );
181 181
182 // this makes sure the names get saved in the order selected 182 // this makes sure the names get saved in the order selected
183 for ( ; list_it.current(); ++list_it ) { 183 for ( ; list_it.current(); ++list_it ) {
184 QMap <QString, QCheckListItem *>::Iterator it; 184 QMap <QString, QCheckListItem *>::Iterator it;
185 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 185 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
186 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 186 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
187 exclude << it.key(); 187 exclude << it.key();
188 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 188 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
189 include << it.key(); 189 include << it.key();
190 } 190 }
191 if ( list_it.current() == (*it) ) { 191 if ( list_it.current() == (*it) ) {
192 all_applets << it.key(); 192 all_applets << it.key();
193 } 193 }
194 } 194 }
195 } 195 }
196 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 196 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
197 cfg.writeEntry( "IncludeApplets", include, ',' ); 197 cfg.writeEntry( "IncludeApplets", include, ',' );
198 cfg.writeEntry( "AllApplets", all_applets, ',' ); 198 cfg.writeEntry( "AllApplets", all_applets, ',' );
199 } 199 }
200 200