author | harlekin <harlekin> | 2002-09-20 20:19:14 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-20 20:19:14 (UTC) |
commit | d2d73b6391fbc7f743199f48387d13e887bbac1e (patch) (unidiff) | |
tree | 7f289628796ee4bf0bf1f32d952b5455a42b17bd /core/pim/today/todayconfig.cpp | |
parent | 681e6e75efaa5577d376d0bb191afdf323cb4e75 (diff) | |
download | opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.zip opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.gz opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.bz2 |
fixed the crash when closing config dialog and also sorting of the plugins is working now
Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 51 |
1 files changed, 28 insertions, 23 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 | |||
@@ -35,7 +35,6 @@ class ToolButton : public QToolButton { | |||
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 ); |
@@ -69,29 +68,24 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags | |||
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" ) ); |
@@ -112,7 +106,7 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags | |||
112 | void TodayConfig::setAutoStart() { | 106 | void TodayConfig::setAutoStart() { |
113 | Config cfg( "today" ); | 107 | Config cfg( "today" ); |
114 | cfg.setGroup( "Autostart" ); | 108 | cfg.setGroup( "Autostart" ); |
115 | int autostart = cfg.readNumEntry( "autostart", 1); | 109 | int autostart = cfg.readNumEntry( "autostart", 1 ); |
116 | if ( autostart ) { | 110 | if ( autostart ) { |
117 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 111 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
118 | e << QString( "add" ); | 112 | e << QString( "add" ); |
@@ -136,7 +130,7 @@ void TodayConfig::readConfig() { | |||
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 | ||
@@ -145,25 +139,36 @@ void TodayConfig::readConfig() { | |||
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; |
152 | QMap <QString, QCheckListItem *>::Iterator it; | 146 | QStringList all_applets; |
153 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | 147 | |
154 | if ( !(*it)-> isOn () ) { | 148 | QListViewItemIterator list_it( m_appletListView ); |
155 | exclude << it.key(); | 149 | |
156 | } else { | 150 | // this makes sure the names get saved in the order selected |
157 | include << it.key(); | 151 | for ( ; list_it.current(); ++list_it ) { |
152 | QMap <QString, QCheckListItem *>::Iterator it; | ||
153 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | ||
154 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | ||
155 | exclude << it.key(); | ||
156 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | ||
157 | include << it.key(); | ||
158 | } | ||
159 | if ( list_it.current() == (*it) ) { | ||
160 | all_applets << it.key(); | ||
161 | } | ||
158 | } | 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(); |
168 | cfg.readEntry( "autostartdelay", m_autoStartTimer ); | 173 | cfg.readEntry( "autostartdelay", m_autoStartTimer ); |
169 | } | 174 | } |
@@ -171,7 +176,7 @@ void TodayConfig::writeConfig() { | |||
171 | 176 | ||
172 | void TodayConfig::moveSelectedUp() { | 177 | void TodayConfig::moveSelectedUp() { |
173 | QListViewItem *item = m_appletListView->selectedItem(); | 178 | QListViewItem *item = m_appletListView->selectedItem(); |
174 | if ( item && item->itemAbove() ) { | 179 | if ( item && item->itemAbove() ) { |
175 | item->itemAbove()->moveItem( item ); | 180 | item->itemAbove()->moveItem( item ); |
176 | } | 181 | } |
177 | } | 182 | } |
@@ -197,10 +202,10 @@ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon | |||
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 | ||