From 6883415ff48494b8838006a1417f30b4aad6589e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 13 Feb 2007 00:27:24 +0000 Subject: [PATCH] KListBox->K3ListBox svn path=/branches/work/kwin_composite/; revision=633055 --- kcmkwin/kwinrules/CMakeLists.txt | 4 +- kcmkwin/kwinrules/ruleslist.cpp | 63 +++++----- kcmkwin/kwinrules/ruleslistbase.ui | 172 ++++++++++++++------------- kcmkwin/kwinrules/ruleswidgetbase.ui | 8 +- scene.h | 2 +- 5 files changed, 122 insertions(+), 127 deletions(-) diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt index 0155a04dd9..883eda0f2a 100644 --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -12,7 +12,7 @@ kde4_automoc(kwin_rules_dialog ${kwin_rules_dialog_KDEINIT_SRCS}) kde4_add_kdeinit_executable( kwin_rules_dialog ${kwin_rules_dialog_KDEINIT_SRCS}) -target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ) +target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} ) install(TARGETS kdeinit_kwin_rules_dialog DESTINATION ${LIB_INSTALL_DIR} ) @@ -29,7 +29,7 @@ kde4_add_plugin(kcm_kwinrules ${kcm_kwinrules_PART_SRCS}) kde4_install_libtool_file( ${PLUGIN_INSTALL_DIR} kcm_kwinrules ) -target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ) +target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} ) install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp index ab9bc24452..19d0330735 100644 --- a/kcmkwin/kwinrules/ruleslist.cpp +++ b/kcmkwin/kwinrules/ruleslist.cpp @@ -18,7 +18,6 @@ #include "ruleslist.h" -#include #include #include #include @@ -29,14 +28,14 @@ namespace KWinInternal { -KCMRulesList::KCMRulesList( QWidget* parent) -: KCMRulesListBase( parent) +KCMRulesList::KCMRulesList( QWidget* parent, const char* name ) +: KCMRulesListBase( parent, name ) { // connect both current/selected, so that current==selected (stupid QListBox :( ) - connect( rules_listbox, SIGNAL( currentChanged( QListWidgetItem* )), - SLOT( activeChanged( QListWidgetItem*))); - connect( rules_listbox, SIGNAL( selectionChanged( QListWidgetItem* )), - SLOT( activeChanged( QListWidgetItem*))); + connect( rules_listbox, SIGNAL( currentChanged( Q3ListBoxItem* )), + SLOT( activeChanged( Q3ListBoxItem*))); + connect( rules_listbox, SIGNAL( selectionChanged( Q3ListBoxItem* )), + SLOT( activeChanged( Q3ListBoxItem*))); connect( new_button, SIGNAL( clicked()), SLOT( newClicked())); connect( modify_button, SIGNAL( clicked()), @@ -47,7 +46,7 @@ KCMRulesList::KCMRulesList( QWidget* parent) SLOT( moveupClicked())); connect( movedown_button, SIGNAL( clicked()), SLOT( movedownClicked())); - connect( rules_listbox, SIGNAL( doubleClicked ( QListWidgetItem * ) ), + connect( rules_listbox, SIGNAL( doubleClicked ( Q3ListBoxItem * ) ), SLOT( modifyClicked())); load(); } @@ -61,16 +60,14 @@ KCMRulesList::~KCMRulesList() rules.clear(); } -void KCMRulesList::activeChanged( QListWidgetItem* item ) +void KCMRulesList::activeChanged( Q3ListBoxItem* item ) { - int itemRow = rules_listbox->row(item); - if( item != NULL ) - item->setSelected( true ); // make current==selected + rules_listbox->setSelected( item, true ); // make current==selected modify_button->setEnabled( item != NULL ); delete_button->setEnabled( item != NULL ); - moveup_button->setEnabled( item != NULL && itemRow > 0 ); - movedown_button->setEnabled( item != NULL && itemRow < (rules_listbox->count()-1) ); + moveup_button->setEnabled( item != NULL && item->prev() != NULL ); + movedown_button->setEnabled( item != NULL && item->next() != NULL ); } void KCMRulesList::newClicked() @@ -79,16 +76,16 @@ void KCMRulesList::newClicked() Rules* rule = dlg.edit( NULL, 0, false ); if( rule == NULL ) return; - int pos = rules_listbox->currentRow() + 1; - rules_listbox->insertItem( pos , rule->description ); - rules_listbox->item(pos)->setSelected( true ); + int pos = rules_listbox->currentItem() + 1; + rules_listbox->insertItem( rule->description, pos ); + rules_listbox->setSelected( pos, true ); rules.insert( rules.begin() + pos, rule ); emit changed( true ); } void KCMRulesList::modifyClicked() { - int pos = rules_listbox->currentRow(); + int pos = rules_listbox->currentItem(); if ( pos == -1 ) return; RulesDialog dlg; @@ -97,29 +94,29 @@ void KCMRulesList::modifyClicked() return; delete rules[ pos ]; rules[ pos ] = rule; - rules_listbox->item(pos)->setText( rule->description ); + rules_listbox->changeItem( rule->description, pos ); emit changed( true ); } void KCMRulesList::deleteClicked() { - int pos = rules_listbox->currentRow(); + int pos = rules_listbox->currentItem(); assert( pos != -1 ); - delete rules_listbox->takeItem( pos ); + rules_listbox->removeItem( pos ); rules.erase( rules.begin() + pos ); emit changed( true ); } void KCMRulesList::moveupClicked() { - int pos = rules_listbox->currentRow(); + int pos = rules_listbox->currentItem(); assert( pos != -1 ); if( pos > 0 ) { - QString txt = rules_listbox->item(pos)->text(); - delete rules_listbox->takeItem( pos ); - rules_listbox->insertItem( pos - 1 , txt ); - rules_listbox->item(pos-1)->setSelected( true ); + QString txt = rules_listbox->text( pos ); + rules_listbox->removeItem( pos ); + rules_listbox->insertItem( txt, pos - 1 ); + rules_listbox->setSelected( pos - 1, true ); Rules* rule = rules[ pos ]; rules[ pos ] = rules[ pos - 1 ]; rules[ pos - 1 ] = rule; @@ -129,14 +126,14 @@ void KCMRulesList::moveupClicked() void KCMRulesList::movedownClicked() { - int pos = rules_listbox->currentRow(); + int pos = rules_listbox->currentItem(); assert( pos != -1 ); if( pos < int( rules_listbox->count()) - 1 ) { - QString txt = rules_listbox->item(pos)->text(); - delete rules_listbox->takeItem( pos ); - rules_listbox->insertItem( pos + 1 , txt); - rules_listbox->item(pos+1)->setSelected( true ); + QString txt = rules_listbox->text( pos ); + rules_listbox->removeItem( pos ); + rules_listbox->insertItem( txt, pos + 1 ); + rules_listbox->setSelected( pos + 1, true ); Rules* rule = rules[ pos ]; rules[ pos ] = rules[ pos + 1 ]; rules[ pos + 1 ] = rule; @@ -163,10 +160,10 @@ void KCMRulesList::load() cfg.setGroup( QString::number( i )); Rules* rule = new Rules( cfg ); rules.append( rule ); - rules_listbox->addItem( rule->description ); + rules_listbox->insertItem( rule->description ); } if( rules.count() > 0 ) - rules_listbox->item(0)->setSelected( true ); + rules_listbox->setSelected( 0, true ); else activeChanged( NULL ); } diff --git a/kcmkwin/kwinrules/ruleslistbase.ui b/kcmkwin/kwinrules/ruleslistbase.ui index c9f0f3beb4..6bedc59dd5 100644 --- a/kcmkwin/kwinrules/ruleslistbase.ui +++ b/kcmkwin/kwinrules/ruleslistbase.ui @@ -1,91 +1,95 @@ - - - - - KWinInternal::KCMRulesListBase - - - - 0 - 0 - 600 - 480 - + +KWinInternal::KCMRulesListBase + + + KCMRulesListBase - - - 0 - - - - - - - - &New... - + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + 0 + + + + rules_listbox + - - - - - &Modify... - + + + new_button + + + &New... + - - - - - Delete - - - - + + + modify_button + + + &Modify... + - - - - - Move &Up - + + + delete_button + + + Delete + + + + - - - - - Move &Down - + + + moveup_button + + + Move &Up + - - - - - - 20 - 294 - - - - Expanding - - - Vertical - + + + movedown_button + + + Move &Down + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 294 + + - - - - - - qPixmapFromMimeSource - - - KListWidget - QListWidget -
klistwidget.h
-
-
- - kdialog.h - -
+ +
+ + + + kdialog.h + + +
diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 37d5c48d4a..4ec59a85c7 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -329,7 +329,7 @@ types - + Normal Window @@ -2541,10 +2541,4 @@ - - kpushbutton.h - klistbox.h - kcombobox.h - krestrictedline.h - diff --git a/scene.h b/scene.h index 93bce24ed6..70e90ab324 100644 --- a/scene.h +++ b/scene.h @@ -146,7 +146,7 @@ class Scene::Window // Window will not be painted because of which desktop it's on PAINT_DISABLED_BY_DESKTOP = 1 << 2, // Window will not be painted because it is minimized - PAINT_DISABLED_BY_MINIMIZE = 1 << 3, + PAINT_DISABLED_BY_MINIMIZE = 1 << 3 }; void enablePainting( int reason ); void disablePainting( int reason );