summaryrefslogtreecommitdiff
path: root/libopie2/opieui/okeyconfigwidget.cpp
Unidiff
Diffstat (limited to 'libopie2/opieui/okeyconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/okeyconfigwidget.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp
index ef6d713..eb7acbd 100644
--- a/libopie2/opieui/okeyconfigwidget.cpp
+++ b/libopie2/opieui/okeyconfigwidget.cpp
@@ -474,12 +474,12 @@ OKeyConfigManager::~OKeyConfigManager() {
474 * Load the Configuration from the OConfig 474 * Load the Configuration from the OConfig
475 * If a Key is restricted but was in the config we will 475 * If a Key is restricted but was in the config we will
476 * make it be the empty key paur 476 * make it be the empty key paur
477 * We will change the group of the OConfig Item! 477 * We will change the group but restore to the previous.
478 * 478 *
479 * @see OKeyPair::emptyKey 479 * @see OKeyPair::emptyKey
480 */ 480 */
481void OKeyConfigManager::load() { 481void OKeyConfigManager::load() {
482 m_conf->setGroup( m_group ); 482 Opie::Core::OConfigGroupSaver( m_conf, m_group );
483 483
484 /* 484 /*
485 * Read each item 485 * Read each item
@@ -500,10 +500,11 @@ void OKeyConfigManager::load() {
500 500
501/** 501/**
502 * We will save the current configuration 502 * We will save the current configuration
503 * to the OConfig. We will change the group. 503 * to the OConfig. We will change the group but restore
504 * to the previous
504 */ 505 */
505void OKeyConfigManager::save() { 506void OKeyConfigManager::save() {
506 m_conf->setGroup( m_group ); 507 Opie::Core::OConfigGroupSaver( m_conf, m_group );
507 508
508 /* 509 /*
509 * Write each item 510 * Write each item
@@ -544,7 +545,7 @@ OKeyConfigItem OKeyConfigManager::handleKeyEvent( QKeyEvent* e ) {
544 * case ascii 545 * case ascii
545 */ 546 */
546 int key, mod; 547 int key, mod;
547 Opie::Ui::Private::fixupKeys( key, mod, e ); 548 Opie::Ui::Internal::fixupKeys( key, mod, e );
548 549
549 OKeyConfigItem::List _keyList = keyList( key ); 550 OKeyConfigItem::List _keyList = keyList( key );
550 if ( _keyList.isEmpty() ) 551 if ( _keyList.isEmpty() )
@@ -716,7 +717,7 @@ OKeyConfigItem::List OKeyConfigManager::keyList( int keycode) {
716 717
717namespace Opie { 718namespace Opie {
718namespace Ui { 719namespace Ui {
719namespace Private { 720namespace Internal {
720 721
721 OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent) 722 OKeyListViewItem::OKeyListViewItem( const OKeyConfigItem& item, OKeyConfigManager* man, OListViewItem* parent)
722 : Opie::Ui::OListViewItem( parent ), m_manager( man ) { 723 : Opie::Ui::OListViewItem( parent ), m_manager( man ) {
@@ -938,7 +939,7 @@ OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const {
938 * insert these items before calling load 939 * insert these items before calling load
939 */ 940 */
940void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { 941void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) {
941 Opie::Ui::Private::OKeyConfigWidgetPrivate root( str, man ); 942 Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man );
942 m_list.append(root); 943 m_list.append(root);
943} 944}
944 945
@@ -947,12 +948,12 @@ void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) {
947 * loads the items and allows editing them 948 * loads the items and allows editing them
948 */ 949 */
949void OKeyConfigWidget::load() { 950void OKeyConfigWidget::load() {
950 Opie::Ui::Private::OKeyConfigWidgetPrivateList::Iterator it; 951 Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it;
951 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 952 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
952 OListViewItem *item = new OListViewItem( m_view, (*it).name ); 953 OListViewItem *item = new OListViewItem( m_view, (*it).name );
953 OKeyConfigItem::List list = (*it).manager->keyConfigList(); 954 OKeyConfigItem::List list = (*it).manager->keyConfigList();
954 for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) 955 for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt )
955 (void )new Opie::Ui::Private::OKeyListViewItem(*keyIt, (*it).manager, item ); 956 (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item );
956 957
957 } 958 }
958} 959}
@@ -969,7 +970,7 @@ void OKeyConfigWidget::save() {
969 QListViewItemIterator it( m_view ); 970 QListViewItemIterator it( m_view );
970 while ( it.current() ) { 971 while ( it.current() ) {
971 if (it.current()->parent() ) { 972 if (it.current()->parent() ) {
972 Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( it.current() ); 973 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() );
973 OKeyConfigManager *man = item->manager(); 974 OKeyConfigManager *man = item->manager();
974 man->removeKeyConfig( item->origItem() ); 975 man->removeKeyConfig( item->origItem() );
975 man->addKeyConfig( item->item() ); 976 man->addKeyConfig( item->item() );
@@ -993,7 +994,7 @@ void OKeyConfigWidget::slotListViewItem( QListViewItem* _item) {
993 m_cus ->setChecked( false ); 994 m_cus ->setChecked( false );
994 }else{ 995 }else{
995 m_box->setEnabled( true ); 996 m_box->setEnabled( true );
996 Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>( _item ); 997 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( _item );
997 OKeyConfigItem keyItem= item->item(); 998 OKeyConfigItem keyItem= item->item();
998 m_lbl->setText( tr("Default: " )+ item->text( 3 ) ); 999 m_lbl->setText( tr("Default: " )+ item->text( 3 ) );
999 if ( keyItem.keyPair().isEmpty() ) { 1000 if ( keyItem.keyPair().isEmpty() ) {
@@ -1024,7 +1025,7 @@ void OKeyConfigWidget::slotNoKey() {
1024 /* 1025 /*
1025 * If immediate we need to remove and readd the key 1026 * If immediate we need to remove and readd the key
1026 */ 1027 */
1027 Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); 1028 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem());
1028 updateItem( item, OKeyPair::emptyKey() ); 1029 updateItem( item, OKeyPair::emptyKey() );
1029} 1030}
1030 1031
@@ -1037,7 +1038,7 @@ void OKeyConfigWidget::slotDefaultKey() {
1037 if ( !m_view->currentItem() || !m_view->currentItem()->parent() ) 1038 if ( !m_view->currentItem() || !m_view->currentItem()->parent() )
1038 return; 1039 return;
1039 1040
1040 Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); 1041 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem());
1041 updateItem( item, item->item().defaultKeyPair() ); 1042 updateItem( item, item->item().defaultKeyPair() );
1042} 1043}
1043 1044
@@ -1063,14 +1064,14 @@ void OKeyConfigWidget::slotConfigure() {
1063 connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) ); 1064 connect(&dlg, SIGNAL(keyCaptured()), &dlg, SLOT(accept()) );
1064 1065
1065 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) { 1066 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) {
1066 Opie::Ui::Private::OKeyListViewItem *item = static_cast<Opie::Ui::Private::OKeyListViewItem*>(m_view->currentItem()); 1067 Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>(m_view->currentItem());
1067 updateItem( item, dlg.keyPair() ); 1068 updateItem( item, dlg.keyPair() );
1068 } 1069 }
1069 1070
1070 1071
1071} 1072}
1072 1073
1073bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item, 1074bool OKeyConfigWidget::sanityCheck( Opie::Ui::Internal::OKeyListViewItem* item,
1074 const OKeyPair& newItem ) { 1075 const OKeyPair& newItem ) {
1075 OKeyPair::List bList = item->manager()->blackList(); 1076 OKeyPair::List bList = item->manager()->blackList();
1076 for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) { 1077 for ( OKeyPair::List::Iterator it = bList.begin(); it != bList.end(); ++it ) {
@@ -1089,7 +1090,7 @@ bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item,
1089 /* if not our parent and not us */ 1090 /* if not our parent and not us */
1090 if (it.current()->parent() && it.current() != item) { 1091 if (it.current()->parent() && it.current() != item) {
1091 /* damn already given away*/ 1092 /* damn already given away*/
1092 if ( newItem == static_cast<Opie::Ui::Private::OKeyListViewItem*>(it.current() )->item().keyPair() ) { 1093 if ( newItem == static_cast<Opie::Ui::Internal::OKeyListViewItem*>(it.current() )->item().keyPair() ) {
1093 QMessageBox::warning( 0, tr("Key is already assigned" ), 1094 QMessageBox::warning( 0, tr("Key is already assigned" ),
1094 tr("<qt>The Key you choose is already taken by " 1095 tr("<qt>The Key you choose is already taken by "
1095 "a different Item of your config. Please try" 1096 "a different Item of your config. Please try"
@@ -1103,7 +1104,7 @@ bool OKeyConfigWidget::sanityCheck( Opie::Ui::Private::OKeyListViewItem* item,
1103 return true; 1104 return true;
1104} 1105}
1105 1106
1106void OKeyConfigWidget::updateItem( Opie::Ui::Private::OKeyListViewItem *item, 1107void OKeyConfigWidget::updateItem( Opie::Ui::Internal::OKeyListViewItem *item,
1107 const OKeyPair& newItem) { 1108 const OKeyPair& newItem) {
1108 /* sanity check 1109 /* sanity check
1109 * check against the blacklist of the manager 1110 * check against the blacklist of the manager
@@ -1165,7 +1166,7 @@ void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) {
1165 return; 1166 return;
1166 1167
1167 int mod, key; 1168 int mod, key;
1168 Opie::Ui::Private::fixupKeys( key,mod, ev ); 1169 Opie::Ui::Internal::fixupKeys( key,mod, ev );
1169 1170
1170 /* either we used software keyboard 1171 /* either we used software keyboard
1171 * or we've true support 1172 * or we've true support
@@ -1200,7 +1201,7 @@ void OKeyChooserConfigDialog::keyPressEvent( QKeyEvent* ev ) {
1200 m_keyPair = OKeyPair( m_key, m_mod ); 1201 m_keyPair = OKeyPair( m_key, m_mod );
1201 } 1202 }
1202 1203
1203 m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); 1204 m_lbl->setText( Opie::Ui::Internal::keyToString( m_keyPair ) );
1204 1205
1205} 1206}
1206 1207
@@ -1236,7 +1237,7 @@ void OKeyChooserConfigDialog::keyReleaseEvent( QKeyEvent* ev ) {
1236 else 1237 else
1237 m_key = key; 1238 m_key = key;
1238 m_keyPair = OKeyPair( m_key, m_mod ); 1239 m_keyPair = OKeyPair( m_key, m_mod );
1239 m_lbl->setText( Opie::Ui::Private::keyToString( m_keyPair ) ); 1240 m_lbl->setText( Opie::Ui::Internal::keyToString( m_keyPair ) );
1240 } 1241 }
1241} 1242}
1242 1243