Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 4f23471..532d126 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -32,13 +32,12 @@ | |||
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 | // setTextLabel( name ); | ||
39 | setPixmap( Resource::loadPixmap( icon ) ); | 38 | setPixmap( Resource::loadPixmap( icon ) ); |
40 | setAutoRaise( TRUE ); | 39 | setAutoRaise( TRUE ); |
41 | setFocusPolicy( QWidget::NoFocus ); | 40 | setFocusPolicy( QWidget::NoFocus ); |
42 | setToggleButton( t ); | 41 | setToggleButton( t ); |
43 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 42 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
44 | } | 43 | } |
@@ -66,35 +65,30 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags | |||
66 | 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 ); |
67 | tab2Layout->addWidget( l ); | 66 | tab2Layout->addWidget( l ); |
68 | QHBox *hbox1 = new QHBox( tab_2 ); | 67 | QHBox *hbox1 = new QHBox( tab_2 ); |
69 | m_appletListView = new QListView( hbox1 ); | 68 | m_appletListView = new QListView( hbox1 ); |
70 | m_appletListView->addColumn( "PluginList" ); | 69 | m_appletListView->addColumn( "PluginList" ); |
71 | m_appletListView->header()->hide(); | 70 | m_appletListView->header()->hide(); |
71 | m_appletListView->setSorting( -1 ); | ||
72 | QVBox *vbox1 = new QVBox( hbox1 ); | 72 | QVBox *vbox1 = new QVBox( hbox1 ); |
73 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); | 73 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); |
74 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); | 74 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); |
75 | tab2Layout->addWidget( hbox1 ); | 75 | tab2Layout->addWidget( hbox1 ); |
76 | |||
77 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); | 76 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); |
77 | |||
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 | QHBox *hbox_clip = new QHBox( tab_3 ); | 80 | tab3Layout->setMargin( 20 ); |
81 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); | ||
82 | TextLabel1->setText( tr( "Clip after how\n" | ||
83 | "many letters" ) ); | ||
84 | SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" ); | ||
85 | SpinBox7->setMaxValue( 80 ); | ||
86 | QHBox *hbox_auto = new QHBox( tab_3 ); | 81 | QHBox *hbox_auto = new QHBox( tab_3 ); |
87 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | 82 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); |
88 | TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) ); | 83 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); |
89 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | 84 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); |
90 | QHBox *hbox_inactive = new QHBox( tab_3 ); | 85 | QHBox *hbox_inactive = new QHBox( tab_3 ); |
91 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); | 86 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); |
92 | TimeLabel->setText( tr( "minutes inactive" ) ); | 87 | TimeLabel->setText( tr( "minutes inactive" ) ); |
93 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); | 88 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); |
94 | tab3Layout->addWidget( hbox_clip ); | ||
95 | tab3Layout->addWidget( hbox_auto ); | 89 | tab3Layout->addWidget( hbox_auto ); |
96 | tab3Layout->addWidget( hbox_inactive ); | 90 | tab3Layout->addWidget( hbox_inactive ); |
97 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); | 91 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); |
98 | 92 | ||
99 | m_applets_changed = false; | 93 | m_applets_changed = false; |
100 | 94 | ||
@@ -133,35 +127,46 @@ void TodayConfig::readConfig() { | |||
133 | cfg.setGroup( "Autostart" ); | 127 | cfg.setGroup( "Autostart" ); |
134 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 128 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
135 | CheckBoxAuto->setChecked( m_autoStart ); | 129 | CheckBoxAuto->setChecked( m_autoStart ); |
136 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); | 130 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); |
137 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); | 131 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); |
138 | 132 | ||
139 | cfg.setGroup( "Applets" ); | 133 | cfg.setGroup( "Plugins" ); |
140 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 134 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
141 | } | 135 | } |
142 | 136 | ||
143 | /** | 137 | /** |
144 | * Write the config part | 138 | * Write the config part |
145 | */ | 139 | */ |
146 | void TodayConfig::writeConfig() { | 140 | void TodayConfig::writeConfig() { |
147 | Config cfg( "today" ); | 141 | Config cfg( "today" ); |
148 | cfg. setGroup ( "Applets" ); | 142 | cfg.setGroup( "Plugins" ); |
149 | if ( m_applets_changed ) { | 143 | if ( m_applets_changed ) { |
150 | QStringList exclude; | 144 | QStringList exclude; |
151 | QStringList include; | 145 | QStringList include; |
146 | QStringList all_applets; | ||
147 | |||
148 | QListViewItemIterator list_it( m_appletListView ); | ||
149 | |||
150 | // this makes sure the names get saved in the order selected | ||
151 | for ( ; list_it.current(); ++list_it ) { | ||
152 | QMap <QString, QCheckListItem *>::Iterator it; | 152 | QMap <QString, QCheckListItem *>::Iterator it; |
153 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | 153 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { |
154 | if ( !(*it)-> isOn () ) { | 154 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { |
155 | exclude << it.key(); | 155 | exclude << it.key(); |
156 | } else { | 156 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ |
157 | include << it.key(); | 157 | include << it.key(); |
158 | } | 158 | } |
159 | if ( list_it.current() == (*it) ) { | ||
160 | all_applets << it.key(); | ||
161 | } | ||
162 | } | ||
159 | } | 163 | } |
160 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 164 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
161 | cfg.writeEntry( "IncludeApplets", include, ',' ); | 165 | cfg.writeEntry( "IncludeApplets", include, ',' ); |
166 | cfg.writeEntry( "AllApplets", all_applets, ',' ); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | cfg.setGroup( "Autostart" ); | 169 | cfg.setGroup( "Autostart" ); |
165 | m_autoStart = CheckBoxAuto->isChecked(); | 170 | m_autoStart = CheckBoxAuto->isChecked(); |
166 | cfg.writeEntry( "autostart", m_autoStart ); | 171 | cfg.writeEntry( "autostart", m_autoStart ); |
167 | m_autoStartTimer = SpinBoxTime->value(); | 172 | m_autoStartTimer = SpinBoxTime->value(); |
@@ -194,16 +199,16 @@ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon | |||
194 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); | 199 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); |
195 | 200 | ||
196 | if ( !icon.isNull() ) { | 201 | if ( !icon.isNull() ) { |
197 | item->setPixmap( 0, icon ); | 202 | item->setPixmap( 0, icon ); |
198 | } | 203 | } |
199 | 204 | ||
200 | qDebug (" SUCHNAME: " + name ); | ||
201 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { | 205 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { |
202 | item->setOn( TRUE ); | 206 | item->setOn( TRUE ); |
203 | } | 207 | } |
208 | |||
204 | m_applets[libName] = item; | 209 | m_applets[libName] = item; |
205 | } | 210 | } |
206 | 211 | ||
207 | 212 | ||
208 | void TodayConfig::appletChanged() { | 213 | void TodayConfig::appletChanged() { |
209 | m_applets_changed = true; | 214 | m_applets_changed = true; |