author | harlekin <harlekin> | 2002-09-21 08:38:29 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-21 08:38:29 (UTC) |
commit | 0bb8b359d20f7d5ead88c260c5560ab7b60358b9 (patch) (unidiff) | |
tree | 24ddf4c4baf2f13bddac23220d12ec11094492b8 | |
parent | 7e4aba1d1bd06ca3c62b52077283d2e0c77b0e92 (diff) | |
download | opie-0bb8b359d20f7d5ead88c260c5560ab7b60358b9.zip opie-0bb8b359d20f7d5ead88c260c5560ab7b60358b9.tar.gz opie-0bb8b359d20f7d5ead88c260c5560ab7b60358b9.tar.bz2 |
use libqpes up down arrows instead of the up down from opieplayer1 .-)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 472da50..9ff9ba6 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,222 +1,220 @@ | |||
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 | 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, WFlags fl ) | 52 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) |
53 | : QDialog( parent, name, modal, fl ) { | 53 | : QDialog( parent, name, modal, fl ) { |
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 | QVBox *vbox1 = new QVBox( hbox1 ); | 70 | QVBox *vbox1 = new QVBox( hbox1 ); |
71 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); | 71 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); |
72 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); | 72 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
73 | tab2Layout->addWidget( hbox1 ); | 73 | tab2Layout->addWidget( hbox1 ); |
74 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); | 74 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); |
75 | 75 | ||
76 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 76 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
77 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 77 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
78 | tab3Layout->setMargin( 20 ); | 78 | tab3Layout->setMargin( 20 ); |
79 | QHBox *hbox_auto = new QHBox( tab_3 ); | 79 | QHBox *hbox_auto = new QHBox( tab_3 ); |
80 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | 80 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); |
81 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); | 81 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); |
82 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | 82 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); |
83 | QHBox *hbox_inactive = new QHBox( tab_3 ); | 83 | QHBox *hbox_inactive = new QHBox( tab_3 ); |
84 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); | 84 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); |
85 | TimeLabel->setText( tr( "minutes inactive" ) ); | 85 | TimeLabel->setText( tr( "minutes inactive" ) ); |
86 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); | 86 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); |
87 | tab3Layout->addWidget( hbox_auto ); | 87 | tab3Layout->addWidget( hbox_auto ); |
88 | tab3Layout->addWidget( hbox_inactive ); | 88 | tab3Layout->addWidget( hbox_inactive ); |
89 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); | 89 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); |
90 | 90 | ||
91 | m_applets_changed = false; | 91 | m_applets_changed = false; |
92 | 92 | ||
93 | // TabWidget3->setCurrentTab( tab_2 ); | ||
94 | |||
95 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 93 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
96 | 94 | ||
97 | readConfig(); | 95 | readConfig(); |
98 | showMaximized(); | 96 | showMaximized(); |
99 | } | 97 | } |
100 | 98 | ||
101 | 99 | ||
102 | /** | 100 | /** |
103 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 101 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
104 | * If registered against that today ist started on each resume. | 102 | * If registered against that today ist started on each resume. |
105 | */ | 103 | */ |
106 | void TodayConfig::setAutoStart() { | 104 | void TodayConfig::setAutoStart() { |
107 | Config cfg( "today" ); | 105 | Config cfg( "today" ); |
108 | cfg.setGroup( "Autostart" ); | 106 | cfg.setGroup( "Autostart" ); |
109 | int autostart = cfg.readNumEntry( "autostart", 1 ); | 107 | int autostart = cfg.readNumEntry( "autostart", 1 ); |
110 | if ( autostart ) { | 108 | if ( autostart ) { |
111 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 109 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
112 | e << QString( "add" ); | 110 | e << QString( "add" ); |
113 | e << QString( "today" ); | 111 | e << QString( "today" ); |
114 | e << m_autoStartTimer; | 112 | e << m_autoStartTimer; |
115 | } else { | 113 | } else { |
116 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 114 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
117 | e << QString( "remove" ); | 115 | e << QString( "remove" ); |
118 | e << QString( "today" ); | 116 | e << QString( "today" ); |
119 | } | 117 | } |
120 | } | 118 | } |
121 | 119 | ||
122 | /** | 120 | /** |
123 | * Read the config part | 121 | * Read the config part |
124 | */ | 122 | */ |
125 | void TodayConfig::readConfig() { | 123 | void TodayConfig::readConfig() { |
126 | Config cfg( "today" ); | 124 | Config cfg( "today" ); |
127 | cfg.setGroup( "Autostart" ); | 125 | cfg.setGroup( "Autostart" ); |
128 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 126 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
129 | CheckBoxAuto->setChecked( m_autoStart ); | 127 | CheckBoxAuto->setChecked( m_autoStart ); |
130 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); | 128 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); |
131 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); | 129 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); |
132 | 130 | ||
133 | cfg.setGroup( "Plugins" ); | 131 | cfg.setGroup( "Plugins" ); |
134 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 132 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
135 | } | 133 | } |
136 | 134 | ||
137 | /** | 135 | /** |
138 | * Write the config part | 136 | * Write the config part |
139 | */ | 137 | */ |
140 | void TodayConfig::writeConfig() { | 138 | void TodayConfig::writeConfig() { |
141 | Config cfg( "today" ); | 139 | Config cfg( "today" ); |
142 | cfg.setGroup( "Plugins" ); | 140 | cfg.setGroup( "Plugins" ); |
143 | if ( m_applets_changed ) { | 141 | if ( m_applets_changed ) { |
144 | QStringList exclude; | 142 | QStringList exclude; |
145 | QStringList include; | 143 | QStringList include; |
146 | QStringList all_applets; | 144 | QStringList all_applets; |
147 | 145 | ||
148 | QListViewItemIterator list_it( m_appletListView ); | 146 | QListViewItemIterator list_it( m_appletListView ); |
149 | 147 | ||
150 | // this makes sure the names get saved in the order selected | 148 | // this makes sure the names get saved in the order selected |
151 | for ( ; list_it.current(); ++list_it ) { | 149 | for ( ; list_it.current(); ++list_it ) { |
152 | QMap <QString, QCheckListItem *>::Iterator it; | 150 | QMap <QString, QCheckListItem *>::Iterator it; |
153 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | 151 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { |
154 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | 152 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { |
155 | exclude << it.key(); | 153 | exclude << it.key(); |
156 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | 154 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ |
157 | include << it.key(); | 155 | include << it.key(); |
158 | } | 156 | } |
159 | if ( list_it.current() == (*it) ) { | 157 | if ( list_it.current() == (*it) ) { |
160 | all_applets << it.key(); | 158 | all_applets << it.key(); |
161 | } | 159 | } |
162 | } | 160 | } |
163 | } | 161 | } |
164 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 162 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
165 | cfg.writeEntry( "IncludeApplets", include, ',' ); | 163 | cfg.writeEntry( "IncludeApplets", include, ',' ); |
166 | cfg.writeEntry( "AllApplets", all_applets, ',' ); | 164 | cfg.writeEntry( "AllApplets", all_applets, ',' ); |
167 | } | 165 | } |
168 | 166 | ||
169 | cfg.setGroup( "Autostart" ); | 167 | cfg.setGroup( "Autostart" ); |
170 | m_autoStart = CheckBoxAuto->isChecked(); | 168 | m_autoStart = CheckBoxAuto->isChecked(); |
171 | cfg.writeEntry( "autostart", m_autoStart ); | 169 | cfg.writeEntry( "autostart", m_autoStart ); |
172 | m_autoStartTimer = SpinBoxTime->value(); | 170 | m_autoStartTimer = SpinBoxTime->value(); |
173 | cfg.readEntry( "autostartdelay", m_autoStartTimer ); | 171 | cfg.readEntry( "autostartdelay", m_autoStartTimer ); |
174 | } | 172 | } |
175 | 173 | ||
176 | 174 | ||
177 | void TodayConfig::moveSelectedUp() { | 175 | void TodayConfig::moveSelectedUp() { |
178 | QListViewItem *item = m_appletListView->selectedItem(); | 176 | QListViewItem *item = m_appletListView->selectedItem(); |
179 | if ( item && item->itemAbove() ) { | 177 | if ( item && item->itemAbove() ) { |
180 | item->itemAbove()->moveItem( item ); | 178 | item->itemAbove()->moveItem( item ); |
181 | } | 179 | } |
182 | } | 180 | } |
183 | 181 | ||
184 | 182 | ||
185 | void TodayConfig::moveSelectedDown() { | 183 | void TodayConfig::moveSelectedDown() { |
186 | QListViewItem *item = m_appletListView->selectedItem(); | 184 | QListViewItem *item = m_appletListView->selectedItem(); |
187 | if ( item && item->itemBelow() ) { | 185 | if ( item && item->itemBelow() ) { |
188 | item->moveItem( item->itemBelow() ); | 186 | item->moveItem( item->itemBelow() ); |
189 | } | 187 | } |
190 | } | 188 | } |
191 | 189 | ||
192 | 190 | ||
193 | /** | 191 | /** |
194 | * Set up the | 192 | * Set up the icons in the order/active tab |
195 | */ | 193 | */ |
196 | void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { | 194 | void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { |
197 | 195 | ||
198 | QCheckListItem *item; | 196 | QCheckListItem *item; |
199 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); | 197 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); |
200 | 198 | ||
201 | if ( !icon.isNull() ) { | 199 | if ( !icon.isNull() ) { |
202 | item->setPixmap( 0, icon ); | 200 | item->setPixmap( 0, icon ); |
203 | } | 201 | } |
204 | 202 | ||
205 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { | 203 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { |
206 | item->setOn( TRUE ); | 204 | item->setOn( TRUE ); |
207 | } | 205 | } |
208 | 206 | ||
209 | m_applets[libName] = item; | 207 | m_applets[libName] = item; |
210 | 208 | ||
211 | // kind of hack to get the first tab as default. | 209 | // kind of hack to get the first tab as default. |
212 | TabWidget3->setCurrentTab( tab_2 ); | 210 | TabWidget3->setCurrentTab( tab_2 ); |
213 | } | 211 | } |
214 | 212 | ||
215 | void TodayConfig::appletChanged() { | 213 | void TodayConfig::appletChanged() { |
216 | m_applets_changed = true; | 214 | m_applets_changed = true; |
217 | } | 215 | } |
218 | 216 | ||
219 | 217 | ||
220 | TodayConfig::~TodayConfig() { | 218 | TodayConfig::~TodayConfig() { |
221 | } | 219 | } |
222 | 220 | ||