Changeset View
Changeset View
Standalone View
Standalone View
kdecoration/config/breezeexceptionlistwidget.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 108 | { | |||
---|---|---|---|---|---|
137 | QModelIndex index( model().index( exception ) ); | 137 | QModelIndex index( model().index( exception ) ); | ||
138 | if( index != m_ui.exceptionListView->selectionModel()->currentIndex() ) | 138 | if( index != m_ui.exceptionListView->selectionModel()->currentIndex() ) | ||
139 | { | 139 | { | ||
140 | m_ui.exceptionListView->selectionModel()->select( index, QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | 140 | m_ui.exceptionListView->selectionModel()->select( index, QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | ||
141 | m_ui.exceptionListView->selectionModel()->setCurrentIndex( index, QItemSelectionModel::Current|QItemSelectionModel::Rows ); | 141 | m_ui.exceptionListView->selectionModel()->setCurrentIndex( index, QItemSelectionModel::Current|QItemSelectionModel::Rows ); | ||
142 | } | 142 | } | ||
143 | 143 | | |||
144 | resizeColumns(); | 144 | resizeColumns(); | ||
145 | return; | | |||
146 | 145 | | |||
147 | } | 146 | } | ||
148 | 147 | | |||
149 | //_______________________________________________________ | 148 | //_______________________________________________________ | ||
150 | void ExceptionListWidget::edit() | 149 | void ExceptionListWidget::edit() | ||
151 | { | 150 | { | ||
152 | 151 | | |||
153 | // retrieve selection | 152 | // retrieve selection | ||
Show All 22 Lines | |||||
176 | delete dialog; | 175 | delete dialog; | ||
177 | 176 | | |||
178 | // check new exception validity | 177 | // check new exception validity | ||
179 | checkException( exception ); | 178 | checkException( exception ); | ||
180 | resizeColumns(); | 179 | resizeColumns(); | ||
181 | 180 | | |||
182 | setChanged( true ); | 181 | setChanged( true ); | ||
183 | 182 | | |||
184 | return; | | |||
185 | | ||||
186 | } | 183 | } | ||
187 | 184 | | |||
188 | //_______________________________________________________ | 185 | //_______________________________________________________ | ||
189 | void ExceptionListWidget::remove() | 186 | void ExceptionListWidget::remove() | ||
190 | { | 187 | { | ||
191 | 188 | | |||
192 | // confirmation dialog | 189 | // confirmation dialog | ||
193 | { | 190 | { | ||
194 | QMessageBox messageBox( QMessageBox::Question, i18n("Question - Breeze Settings" ), i18n("Remove selected exception?"), QMessageBox::Yes | QMessageBox::Cancel ); | 191 | QMessageBox messageBox( QMessageBox::Question, i18n("Question - Breeze Settings" ), i18n("Remove selected exception?"), QMessageBox::Yes | QMessageBox::Cancel ); | ||
195 | messageBox.button( QMessageBox::Yes )->setText( i18n("Remove") ); | 192 | messageBox.button( QMessageBox::Yes )->setText( i18n("Remove") ); | ||
196 | messageBox.setDefaultButton( QMessageBox::Cancel ); | 193 | messageBox.setDefaultButton( QMessageBox::Cancel ); | ||
197 | if( messageBox.exec() == QMessageBox::Cancel ) return; | 194 | if( messageBox.exec() == QMessageBox::Cancel ) return; | ||
198 | } | 195 | } | ||
199 | 196 | | |||
200 | // remove | 197 | // remove | ||
201 | model().remove( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | 198 | model().remove( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | ||
202 | resizeColumns(); | 199 | resizeColumns(); | ||
203 | updateButtons(); | 200 | updateButtons(); | ||
204 | 201 | | |||
205 | setChanged( true ); | 202 | setChanged( true ); | ||
206 | 203 | | |||
207 | return; | | |||
208 | | ||||
209 | } | 204 | } | ||
210 | 205 | | |||
211 | //_______________________________________________________ | 206 | //_______________________________________________________ | ||
212 | void ExceptionListWidget::toggle( const QModelIndex& index ) | 207 | void ExceptionListWidget::toggle( const QModelIndex& index ) | ||
213 | { | 208 | { | ||
214 | 209 | | |||
215 | if( !model().contains( index ) ) return; | 210 | if( !model().contains( index ) ) return; | ||
216 | if( index.column() != ExceptionModel::ColumnEnabled ) return; | 211 | if( index.column() != ExceptionModel::ColumnEnabled ) return; | ||
217 | 212 | | |||
218 | // get matching exception | 213 | // get matching exception | ||
219 | InternalSettingsPtr exception( model().get( index ) ); | 214 | InternalSettingsPtr exception( model().get( index ) ); | ||
220 | exception->setEnabled( !exception->enabled() ); | 215 | exception->setEnabled( !exception->enabled() ); | ||
221 | setChanged( true ); | 216 | setChanged( true ); | ||
222 | return; | | |||
223 | 217 | | |||
224 | } | 218 | } | ||
225 | 219 | | |||
226 | //_______________________________________________________ | 220 | //_______________________________________________________ | ||
227 | void ExceptionListWidget::up() | 221 | void ExceptionListWidget::up() | ||
228 | { | 222 | { | ||
229 | 223 | | |||
230 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | 224 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | ||
Show All 29 Lines | |||||
260 | 254 | | |||
261 | // restore selection | 255 | // restore selection | ||
262 | m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | 256 | m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | ||
263 | for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) | 257 | for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) | ||
264 | { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } | 258 | { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } | ||
265 | 259 | | |||
266 | setChanged( true ); | 260 | setChanged( true ); | ||
267 | 261 | | |||
268 | return; | | |||
269 | | ||||
270 | } | 262 | } | ||
271 | 263 | | |||
272 | //_______________________________________________________ | 264 | //_______________________________________________________ | ||
273 | void ExceptionListWidget::down() | 265 | void ExceptionListWidget::down() | ||
274 | { | 266 | { | ||
275 | 267 | | |||
276 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | 268 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | ||
277 | if( selection.empty() ) | 269 | if( selection.empty() ) | ||
Show All 34 Lines | |||||
312 | 304 | | |||
313 | // restore selection | 305 | // restore selection | ||
314 | m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | 306 | m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows ); | ||
315 | for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) | 307 | for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter ) | ||
316 | { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } | 308 | { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); } | ||
317 | 309 | | |||
318 | setChanged( true ); | 310 | setChanged( true ); | ||
319 | 311 | | |||
320 | return; | | |||
321 | | ||||
322 | } | 312 | } | ||
323 | 313 | | |||
324 | //_______________________________________________________ | 314 | //_______________________________________________________ | ||
325 | void ExceptionListWidget::resizeColumns() const | 315 | void ExceptionListWidget::resizeColumns() const | ||
326 | { | 316 | { | ||
327 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnEnabled ); | 317 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnEnabled ); | ||
328 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnType ); | 318 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnType ); | ||
329 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnRegExp ); | 319 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnRegExp ); | ||
Show All 26 Lines |