Changeset View
Changeset View
Standalone View
Standalone View
kdecoration/config/breezeexceptionlistwidget.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 37 | { | |||
---|---|---|---|---|---|
78 | void ExceptionListWidget::setExceptions( const InternalSettingsList& exceptions ) | 78 | void ExceptionListWidget::setExceptions( const InternalSettingsList& exceptions ) | ||
79 | { | 79 | { | ||
80 | model().set( exceptions ); | 80 | model().set( exceptions ); | ||
81 | resizeColumns(); | 81 | resizeColumns(); | ||
82 | setChanged( false ); | 82 | setChanged( false ); | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | //__________________________________________________________ | 85 | //__________________________________________________________ | ||
86 | InternalSettingsList ExceptionListWidget::exceptions( void ) | 86 | InternalSettingsList ExceptionListWidget::exceptions() | ||
87 | { | 87 | { | ||
88 | return model().get(); | 88 | return model().get(); | ||
89 | setChanged( false ); | 89 | setChanged( false ); | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | //__________________________________________________________ | 92 | //__________________________________________________________ | ||
93 | void ExceptionListWidget::updateButtons( void ) | 93 | void ExceptionListWidget::updateButtons() | ||
94 | { | 94 | { | ||
95 | 95 | | |||
96 | bool hasSelection( !m_ui.exceptionListView->selectionModel()->selectedRows().empty() ); | 96 | bool hasSelection( !m_ui.exceptionListView->selectionModel()->selectedRows().empty() ); | ||
97 | m_ui.removeButton->setEnabled( hasSelection ); | 97 | m_ui.removeButton->setEnabled( hasSelection ); | ||
98 | m_ui.editButton->setEnabled( hasSelection ); | 98 | m_ui.editButton->setEnabled( hasSelection ); | ||
99 | 99 | | |||
100 | m_ui.moveUpButton->setEnabled( hasSelection && !m_ui.exceptionListView->selectionModel()->isRowSelected( 0, QModelIndex() ) ); | 100 | m_ui.moveUpButton->setEnabled( hasSelection && !m_ui.exceptionListView->selectionModel()->isRowSelected( 0, QModelIndex() ) ); | ||
101 | m_ui.moveDownButton->setEnabled( hasSelection && !m_ui.exceptionListView->selectionModel()->isRowSelected( model().rowCount()-1, QModelIndex() ) ); | 101 | m_ui.moveDownButton->setEnabled( hasSelection && !m_ui.exceptionListView->selectionModel()->isRowSelected( model().rowCount()-1, QModelIndex() ) ); | ||
102 | 102 | | |||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | 105 | | |||
106 | //_______________________________________________________ | 106 | //_______________________________________________________ | ||
107 | void ExceptionListWidget::add( void ) | 107 | void ExceptionListWidget::add() | ||
108 | { | 108 | { | ||
109 | 109 | | |||
110 | 110 | | |||
111 | QPointer<ExceptionDialog> dialog = new ExceptionDialog( this ); | 111 | QPointer<ExceptionDialog> dialog = new ExceptionDialog( this ); | ||
112 | dialog->setWindowTitle( i18n( "New Exception - Breeze Settings" ) ); | 112 | dialog->setWindowTitle( i18n( "New Exception - Breeze Settings" ) ); | ||
113 | InternalSettingsPtr exception( new InternalSettings() ); | 113 | InternalSettingsPtr exception( new InternalSettings() ); | ||
114 | 114 | | |||
115 | exception->load(); | 115 | exception->load(); | ||
Show All 26 Lines | |||||
142 | } | 142 | } | ||
143 | 143 | | |||
144 | resizeColumns(); | 144 | resizeColumns(); | ||
145 | return; | 145 | return; | ||
146 | 146 | | |||
147 | } | 147 | } | ||
148 | 148 | | |||
149 | //_______________________________________________________ | 149 | //_______________________________________________________ | ||
150 | void ExceptionListWidget::edit( void ) | 150 | void ExceptionListWidget::edit() | ||
151 | { | 151 | { | ||
152 | 152 | | |||
153 | // retrieve selection | 153 | // retrieve selection | ||
154 | QModelIndex current( m_ui.exceptionListView->selectionModel()->currentIndex() ); | 154 | QModelIndex current( m_ui.exceptionListView->selectionModel()->currentIndex() ); | ||
155 | if( ! model().contains( current ) ) return; | 155 | if( ! model().contains( current ) ) return; | ||
156 | 156 | | |||
157 | InternalSettingsPtr exception( model().get( current ) ); | 157 | InternalSettingsPtr exception( model().get( current ) ); | ||
158 | 158 | | |||
Show All 22 Lines | |||||
181 | 181 | | |||
182 | setChanged( true ); | 182 | setChanged( true ); | ||
183 | 183 | | |||
184 | return; | 184 | return; | ||
185 | 185 | | |||
186 | } | 186 | } | ||
187 | 187 | | |||
188 | //_______________________________________________________ | 188 | //_______________________________________________________ | ||
189 | void ExceptionListWidget::remove( void ) | 189 | void ExceptionListWidget::remove() | ||
190 | { | 190 | { | ||
191 | 191 | | |||
192 | // confirmation dialog | 192 | // confirmation dialog | ||
193 | { | 193 | { | ||
194 | QMessageBox messageBox( QMessageBox::Question, i18n("Question - Breeze Settings" ), i18n("Remove selected exception?"), QMessageBox::Yes | QMessageBox::Cancel ); | 194 | QMessageBox messageBox( QMessageBox::Question, i18n("Question - Breeze Settings" ), i18n("Remove selected exception?"), QMessageBox::Yes | QMessageBox::Cancel ); | ||
195 | messageBox.button( QMessageBox::Yes )->setText( i18n("Remove") ); | 195 | messageBox.button( QMessageBox::Yes )->setText( i18n("Remove") ); | ||
196 | messageBox.setDefaultButton( QMessageBox::Cancel ); | 196 | messageBox.setDefaultButton( QMessageBox::Cancel ); | ||
197 | if( messageBox.exec() == QMessageBox::Cancel ) return; | 197 | if( messageBox.exec() == QMessageBox::Cancel ) return; | ||
Show All 21 Lines | 213 | { | |||
219 | InternalSettingsPtr exception( model().get( index ) ); | 219 | InternalSettingsPtr exception( model().get( index ) ); | ||
220 | exception->setEnabled( !exception->enabled() ); | 220 | exception->setEnabled( !exception->enabled() ); | ||
221 | setChanged( true ); | 221 | setChanged( true ); | ||
222 | return; | 222 | return; | ||
223 | 223 | | |||
224 | } | 224 | } | ||
225 | 225 | | |||
226 | //_______________________________________________________ | 226 | //_______________________________________________________ | ||
227 | void ExceptionListWidget::up( void ) | 227 | void ExceptionListWidget::up() | ||
228 | { | 228 | { | ||
229 | 229 | | |||
230 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | 230 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | ||
231 | if( selection.empty() ) { return; } | 231 | if( selection.empty() ) { return; } | ||
232 | 232 | | |||
233 | // retrieve selected indexes in list and store in model | 233 | // retrieve selected indexes in list and store in model | ||
234 | QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedRows() ); | 234 | QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedRows() ); | ||
235 | InternalSettingsList selectedExceptions( model().get( selectedIndices ) ); | 235 | InternalSettingsList selectedExceptions( model().get( selectedIndices ) ); | ||
Show All 29 Lines | |||||
265 | 265 | | |||
266 | setChanged( true ); | 266 | setChanged( true ); | ||
267 | 267 | | |||
268 | return; | 268 | return; | ||
269 | 269 | | |||
270 | } | 270 | } | ||
271 | 271 | | |||
272 | //_______________________________________________________ | 272 | //_______________________________________________________ | ||
273 | void ExceptionListWidget::down( void ) | 273 | void ExceptionListWidget::down() | ||
274 | { | 274 | { | ||
275 | 275 | | |||
276 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | 276 | InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) ); | ||
277 | if( selection.empty() ) | 277 | if( selection.empty() ) | ||
278 | { return; } | 278 | { return; } | ||
279 | 279 | | |||
280 | // retrieve selected indexes in list and store in model | 280 | // retrieve selected indexes in list and store in model | ||
281 | QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedIndexes() ); | 281 | QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedIndexes() ); | ||
Show All 35 Lines | |||||
317 | 317 | | |||
318 | setChanged( true ); | 318 | setChanged( true ); | ||
319 | 319 | | |||
320 | return; | 320 | return; | ||
321 | 321 | | |||
322 | } | 322 | } | ||
323 | 323 | | |||
324 | //_______________________________________________________ | 324 | //_______________________________________________________ | ||
325 | void ExceptionListWidget::resizeColumns( void ) const | 325 | void ExceptionListWidget::resizeColumns() const | ||
326 | { | 326 | { | ||
327 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnEnabled ); | 327 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnEnabled ); | ||
328 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnType ); | 328 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnType ); | ||
329 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnRegExp ); | 329 | m_ui.exceptionListView->resizeColumnToContents( ExceptionModel::ColumnRegExp ); | ||
330 | } | 330 | } | ||
331 | 331 | | |||
332 | //_______________________________________________________ | 332 | //_______________________________________________________ | ||
333 | bool ExceptionListWidget::checkException( InternalSettingsPtr exception ) | 333 | bool ExceptionListWidget::checkException( InternalSettingsPtr exception ) | ||
Show All 22 Lines |