Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 5c51515..a6f53e1 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,184 +1,184 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.cpp | 2 | * todayconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß | 4 | * copyright : (c) 2002, 2003, 2004 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 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qspinbox.h> | 26 | #include <qspinbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qheader.h> | 28 | #include <qheader.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | 32 | ||
33 | class ToolButton : public QToolButton { | 33 | class ToolButton : public QToolButton { |
34 | 34 | ||
35 | public: | 35 | public: |
36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
37 | : QToolButton( parent, name ) { | 37 | : QToolButton( parent, name ) { |
38 | setPixmap( Resource::loadPixmap( icon ) ); | 38 | setPixmap( Resource::loadPixmap( icon ) ); |
39 | setAutoRaise( TRUE ); | 39 | setAutoRaise( TRUE ); |
40 | setFocusPolicy( QWidget::NoFocus ); | 40 | setFocusPolicy( QWidget::NoFocus ); |
41 | setToggleButton( t ); | 41 | setToggleButton( t ); |
42 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 42 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
43 | } | 43 | } |
44 | }; | 44 | }; |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * The class has currently quite some duplicate code. | 48 | * The class has currently quite some duplicate code. |
49 | * By that way it would be real easy to have it as seperate app in settings tab | 49 | * By that way it would be real easy to have it as seperate app in settings tab |
50 | * | 50 | * |
51 | */ | 51 | */ |
52 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | 52 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) |
53 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { | 53 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { |
54 | 54 | ||
55 | setCaption( tr( "Today Config" ) ); | 55 | setCaption( tr( "Today Config" ) ); |
56 | 56 | ||
57 | QVBoxLayout *layout = new QVBoxLayout( this ); | 57 | QVBoxLayout *layout = new QVBoxLayout( this ); |
58 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 58 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
59 | layout->addWidget( TabWidget3 ); | 59 | layout->addWidget( TabWidget3 ); |
60 | 60 | ||
61 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 61 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
62 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | 62 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); |
63 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | 63 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); |
64 | tab2Layout->addWidget( l ); | 64 | tab2Layout->addWidget( l ); |
65 | QHBox *hbox1 = new QHBox( tab_2 ); | 65 | QHBox *hbox1 = new QHBox( tab_2 ); |
66 | m_appletListView = new QListView( hbox1 ); | 66 | m_appletListView = new QListView( hbox1 ); |
67 | m_appletListView->addColumn( "PluginList" ); | 67 | m_appletListView->addColumn( "PluginList" ); |
68 | m_appletListView->header()->hide(); | 68 | m_appletListView->header()->hide(); |
69 | m_appletListView->setSorting( -1 ); | 69 | m_appletListView->setSorting( -1 ); |
70 | 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" ) ); | 70 | 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" ) ); |
71 | QVBox *vbox1 = new QVBox( hbox1 ); | 71 | QVBox *vbox1 = new QVBox( hbox1 ); |
72 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); | 72 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); |
73 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | 73 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
74 | tab2Layout->addWidget( hbox1 ); | 74 | tab2Layout->addWidget( hbox1 ); |
75 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); | 75 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); |
76 | 76 | ||
77 | // Misc tab | 77 | // Misc tab |
78 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 78 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
79 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 79 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
80 | 80 | ||
81 | m_guiMisc = new TodayConfigMiscBase( tab_3 ); | 81 | m_guiMisc = new TodayConfigMiscBase( tab_3 ); |
82 | 82 | ||
83 | tab3Layout->addWidget( m_guiMisc ); | 83 | tab3Layout->addWidget( m_guiMisc ); |
84 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); | 84 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); |
85 | 85 | ||
86 | m_applets_changed = false; | 86 | m_applets_changed = false; |
87 | 87 | ||
88 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 88 | connect ( m_appletListView , SIGNAL( clicked(QListViewItem*) ), this, SLOT( appletChanged() ) ); |
89 | 89 | ||
90 | readConfig(); | 90 | readConfig(); |
91 | QPEApplication::showDialog( this ); | 91 | QPEApplication::showDialog( this ); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 96 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
97 | * If registered against that today ist started on each resume. | 97 | * If registered against that today ist started on each resume. |
98 | */ | 98 | */ |
99 | void TodayConfig::setAutoStart() { | 99 | void TodayConfig::setAutoStart() { |
100 | Config cfg( "today" ); | 100 | Config cfg( "today" ); |
101 | cfg.setGroup( "Autostart" ); | 101 | cfg.setGroup( "Autostart" ); |
102 | if ( m_autoStart ) { | 102 | if ( m_autoStart ) { |
103 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 103 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
104 | e << QString( "add" ); | 104 | e << QString( "add" ); |
105 | e << QString( "today" ); | 105 | e << QString( "today" ); |
106 | e << QString( "%1" ).arg( m_autoStartTimer ); | 106 | e << QString( "%1" ).arg( m_autoStartTimer ); |
107 | } else { | 107 | } else { |
108 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 108 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
109 | e << QString( "remove" ); | 109 | e << QString( "remove" ); |
110 | e << QString( "today" ); | 110 | e << QString( "today" ); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Read the config part | 115 | * Read the config part |
116 | */ | 116 | */ |
117 | void TodayConfig::readConfig() { | 117 | void TodayConfig::readConfig() { |
118 | Config cfg( "today" ); | 118 | Config cfg( "today" ); |
119 | cfg.setGroup( "Autostart" ); | 119 | cfg.setGroup( "Autostart" ); |
120 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 120 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
121 | m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); | 121 | m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); |
122 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); | 122 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); |
123 | m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); | 123 | m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); |
124 | 124 | ||
125 | cfg.setGroup( "General" ); | 125 | cfg.setGroup( "General" ); |
126 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 126 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
127 | m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); | 127 | m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); |
128 | m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); | 128 | m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); |
129 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); | 129 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); |
130 | 130 | ||
131 | 131 | ||
132 | cfg.setGroup( "Plugins" ); | 132 | cfg.setGroup( "Plugins" ); |
133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
134 | } | 134 | } |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * Write the config part | 137 | * Write the config part |
138 | */ | 138 | */ |
139 | void TodayConfig::writeConfig() { | 139 | void TodayConfig::writeConfig() { |
140 | Config cfg( "today" ); | 140 | Config cfg( "today" ); |
141 | cfg.setGroup( "Plugins" ); | 141 | cfg.setGroup( "Plugins" ); |
142 | if ( m_applets_changed ) { | 142 | if ( m_applets_changed ) { |
143 | QStringList exclude; | 143 | QStringList exclude; |
144 | QStringList include; | 144 | QStringList include; |
145 | QStringList all_applets; | 145 | QStringList all_applets; |
146 | 146 | ||
147 | QListViewItemIterator list_it( m_appletListView ); | 147 | QListViewItemIterator list_it( m_appletListView ); |
148 | 148 | ||
149 | // this makes sure the names get saved in the order selected | 149 | // this makes sure the names get saved in the order selected |
150 | for ( ; list_it.current(); ++list_it ) { | 150 | for ( ; list_it.current(); ++list_it ) { |
151 | QMap <QString, QCheckListItem *>::Iterator it; | 151 | QMap <QString, QCheckListItem *>::Iterator it; |
152 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | 152 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { |
153 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | 153 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { |
154 | exclude << it.key(); | 154 | exclude << it.key(); |
155 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | 155 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ |
156 | include << it.key(); | 156 | include << it.key(); |
157 | } | 157 | } |
158 | if ( list_it.current() == (*it) ) { | 158 | if ( list_it.current() == (*it) ) { |
159 | all_applets << it.key(); | 159 | all_applets << it.key(); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 163 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
164 | cfg.writeEntry( "IncludeApplets", include, ',' ); | 164 | cfg.writeEntry( "IncludeApplets", include, ',' ); |
165 | cfg.writeEntry( "AllApplets", all_applets, ',' ); | 165 | cfg.writeEntry( "AllApplets", all_applets, ',' ); |
166 | } | 166 | } |
167 | 167 | ||
168 | cfg.setGroup( "Autostart" ); | 168 | cfg.setGroup( "Autostart" ); |
169 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); | 169 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); |
170 | cfg.writeEntry( "autostart", m_autoStart ); | 170 | cfg.writeEntry( "autostart", m_autoStart ); |
171 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); | 171 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); |
172 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); | 172 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); |
173 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); | 173 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); |
174 | 174 | ||
175 | cfg.setGroup( "General" ); | 175 | cfg.setGroup( "General" ); |
176 | cfg.writeEntry( "IconSize", m_iconSize ); | 176 | cfg.writeEntry( "IconSize", m_iconSize ); |
177 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); | 177 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); |
178 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); | 178 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); |
179 | 179 | ||
180 | // set autostart settings | 180 | // set autostart settings |
181 | setAutoStart(); | 181 | setAutoStart(); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||