-rw-r--r-- | core/settings/button/buttonsettings.cpp | 8 | ||||
-rw-r--r-- | core/settings/button/buttonsettings.h | 1 | ||||
-rw-r--r-- | core/settings/button/buttonutils.cpp | 22 | ||||
-rw-r--r-- | core/settings/button/remapdlg.cpp | 27 | ||||
-rw-r--r-- | core/settings/button/remapdlg.h | 4 |
5 files changed, 48 insertions, 14 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index c71514c..8b0b0a8 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp @@ -62,2 +62,3 @@ ButtonSettings::ButtonSettings ( ) const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); + (void) ButtonUtils::inst ( ); // initialise @@ -135,2 +136,3 @@ ButtonSettings::ButtonSettings ( ) m_last_button = 0; + m_lock = false; @@ -210,2 +212,6 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold ) + if ( m_lock ) + return; + m_lock = true; + RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); @@ -229,2 +235,4 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold ) delete d; + + m_lock = false; } diff --git a/core/settings/button/buttonsettings.h b/core/settings/button/buttonsettings.h index f571825..d41a209 100644 --- a/core/settings/button/buttonsettings.h +++ b/core/settings/button/buttonsettings.h @@ -69,2 +69,3 @@ private: QList <buttoninfo> m_infos; + bool m_lock; }; diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp index bb70047..91d2af3 100644 --- a/core/settings/button/buttonutils.cpp +++ b/core/settings/button/buttonutils.cpp @@ -103,4 +103,6 @@ void ButtonUtils::insertAppLnks ( QListViewItem *here ) { - QStringList types = m_apps-> types ( ); + QStringList types = m_apps-> types ( ); + QListViewItem *typeitem [types. count ( )]; + int i = 0; for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { @@ -108,11 +110,17 @@ void ButtonUtils::insertAppLnks ( QListViewItem *here ) item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); - - for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { - AppLnk *l = *appit; - + + typeitem [i++] = item; + } + + for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { + AppLnk *l = *appit; + + int i = 0; + for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { if ( l-> type ( ) == *it ) { - QListViewItem *sub = new QListViewItem ( item, l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); + QListViewItem *sub = new QListViewItem ( typeitem [i], l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); sub-> setPixmap ( 0, l-> pixmap ( )); } - } + i++; + } } diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp index 511d0e7..a251bd4 100644 --- a/core/settings/button/remapdlg.cpp +++ b/core/settings/button/remapdlg.cpp @@ -3,2 +3,3 @@ #include <qcombobox.h> +#include <qtimer.h> @@ -48,2 +49,7 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); + + m_current = 0; + + static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; + w_channel-> insertStrList ((const char **) def_channels ); @@ -61,4 +67,3 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c - it = new NoSortItem ( w_list, 4, tr( "Show" )); - ButtonUtils::inst ( )-> insertAppLnks ( it ); + m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); @@ -67,7 +72,3 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c - static const char * const def_channels [] = { - "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 - }; - - w_channel-> insertStrList ((const char **) def_channels ); + QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); } @@ -78,2 +79,14 @@ RemapDlg::~RemapDlg ( ) +void RemapDlg::delayedInit ( ) +{ + bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); + w_list-> viewport ( )-> setUpdatesEnabled ( false ); + + ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); + + w_list-> viewport ( )-> setUpdatesEnabled ( b ); + + m_map_show-> repaint ( ); +} + void RemapDlg::itemChanged ( QListViewItem *it ) diff --git a/core/settings/button/remapdlg.h b/core/settings/button/remapdlg.h index 8c9cc02..046a22f 100644 --- a/core/settings/button/remapdlg.h +++ b/core/settings/button/remapdlg.h @@ -22,2 +22,5 @@ public slots: virtual void textChanged ( const QString & ); + +private slots: + void delayedInit ( ); @@ -32,2 +35,3 @@ private: QListViewItem *m_map_custom; + QListViewItem *m_map_show; }; |