author | harlekin <harlekin> | 2002-05-15 17:18:38 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-05-15 17:18:38 (UTC) |
commit | f67dd09ba006b52a25ec1a0a828f6a72b70291e0 (patch) (unidiff) | |
tree | e82fdc38c6dc32bf1f5a4d28a5a64b7101e254f5 | |
parent | 443c88975417cb4dc080392abd07be7723c38c62 (diff) | |
download | opie-f67dd09ba006b52a25ec1a0a828f6a72b70291e0.zip opie-f67dd09ba006b52a25ec1a0a828f6a72b70291e0.tar.gz opie-f67dd09ba006b52a25ec1a0a828f6a72b70291e0.tar.bz2 |
sidebar is back for testing
-rw-r--r-- | core/launcher/startmenu.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 237a2de..15707b4 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -47,70 +47,70 @@ StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) | |||
47 | 47 | ||
48 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | 48 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); |
49 | 49 | ||
50 | createMenu(); | 50 | createMenu(); |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void StartMenu::mousePressEvent( QMouseEvent * ) | 54 | void StartMenu::mousePressEvent( QMouseEvent * ) |
55 | { | 55 | { |
56 | launch(); | 56 | launch(); |
57 | if (desktopInfo) | 57 | if (desktopInfo) |
58 | desktopInfo->menuClicked(); | 58 | desktopInfo->menuClicked(); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | StartMenu::~StartMenu() | 62 | StartMenu::~StartMenu() |
63 | { | 63 | { |
64 | delete apps; | 64 | delete apps; |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | void StartMenu::loadOptions() | 68 | void StartMenu::loadOptions() |
69 | { | 69 | { |
70 | #ifdef USE_CONFIG_FILE | 70 | #ifdef USE_CONFIG_FILE |
71 | // Read configuration file | 71 | // Read configuration file |
72 | Config config("StartMenu"); | 72 | Config config("StartMenu"); |
73 | config.setGroup( "StartMenu" ); | 73 | config.setGroup( "StartMenu" ); |
74 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); | 74 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); |
75 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; | 75 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; |
76 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); | 76 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); |
77 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; | 77 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; |
78 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); | 78 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); |
79 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "sidebar" ); | 79 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); |
80 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); | 80 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); |
81 | #else | 81 | #else |
82 | // Basically just #include the .qpe_menu.conf file settings | 82 | // Basically just #include the .qpe_menu.conf file settings |
83 | useWidePopupMenu = FALSE; | 83 | useWidePopupMenu = FALSE; |
84 | popupMenuSidePixmap = "go"; | 84 | popupMenuSidePixmap = "lauchner/sidebar"; |
85 | startButtonIsFlat = TRUE; | 85 | startButtonIsFlat = TRUE; |
86 | startButtonPixmap = "launcher/start_button"; | 86 | startButtonPixmap = "launcher/start_button"; |
87 | #endif | 87 | #endif |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | void StartMenu::createMenu() | 91 | void StartMenu::createMenu() |
92 | { | 92 | { |
93 | if ( useWidePopupMenu ) | 93 | if ( useWidePopupMenu ) |
94 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); | 94 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); |
95 | else | 95 | else |
96 | launchMenu = new StartPopupMenu( this ); | 96 | launchMenu = new StartPopupMenu( this ); |
97 | 97 | ||
98 | loadMenu( apps, launchMenu ); | 98 | loadMenu( apps, launchMenu ); |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | void StartMenu::itemSelected( int id ) | 102 | void StartMenu::itemSelected( int id ) |
103 | { | 103 | { |
104 | const AppLnk *app = apps->find( id ); | 104 | const AppLnk *app = apps->find( id ); |
105 | if ( app ) | 105 | if ( app ) |
106 | app->execute(); | 106 | app->execute(); |
107 | } | 107 | } |
108 | 108 | ||
109 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | 109 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) |
110 | { | 110 | { |
111 | bool result = FALSE; | 111 | bool result = FALSE; |
112 | 112 | ||
113 | QStringList typs = folder->types(); | 113 | QStringList typs = folder->types(); |
114 | QDict<QPopupMenu> typpop; | 114 | QDict<QPopupMenu> typpop; |
115 | for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) { | 115 | for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) { |
116 | if ( !(*tit).isEmpty() ) { | 116 | if ( !(*tit).isEmpty() ) { |
@@ -118,54 +118,54 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | |||
118 | typpop.insert(*tit, new_menu); | 118 | typpop.insert(*tit, new_menu); |
119 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 119 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
120 | menu->insertItem( folder->typePixmap(*tit), *tit, new_menu ); | 120 | menu->insertItem( folder->typePixmap(*tit), *tit, new_menu ); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | QListIterator<AppLnk> it( folder->children() ); | 124 | QListIterator<AppLnk> it( folder->children() ); |
125 | for ( ; it.current(); ++it ) { | 125 | for ( ; it.current(); ++it ) { |
126 | AppLnk *app = it.current(); | 126 | AppLnk *app = it.current(); |
127 | if ( app->type() == "Separator" ) { | 127 | if ( app->type() == "Separator" ) { |
128 | menu->insertSeparator(); | 128 | menu->insertSeparator(); |
129 | } else { | 129 | } else { |
130 | QString t = app->type(); | 130 | QString t = app->type(); |
131 | QPopupMenu* pmenu = typpop.find(t); | 131 | QPopupMenu* pmenu = typpop.find(t); |
132 | if ( !pmenu ) | 132 | if ( !pmenu ) |
133 | pmenu = menu; | 133 | pmenu = menu; |
134 | pmenu->insertItem( app->pixmap(), app->name(), app->id() ); | 134 | pmenu->insertItem( app->pixmap(), app->name(), app->id() ); |
135 | result=TRUE; | 135 | result=TRUE; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | if ( result ) | 139 | if ( result ) |
140 | connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 140 | connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
141 | 141 | ||
142 | return result; | 142 | return result; |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void StartMenu::launch() | 146 | void StartMenu::launch() |
147 | { | 147 | { |
148 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 148 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); |
149 | 149 | ||
150 | if ( launchMenu->isVisible() ) | 150 | if ( launchMenu->isVisible() ) |
151 | launchMenu->hide(); | 151 | launchMenu->hide(); |
152 | else | 152 | else |
153 | launchMenu->popup( QPoint( 1, y ) ); | 153 | launchMenu->popup( QPoint( 1, y ) ); |
154 | } | 154 | } |
155 | 155 | ||
156 | const AppLnk* StartMenu::execToLink(const QString& appname) | 156 | const AppLnk* StartMenu::execToLink(const QString& appname) |
157 | { | 157 | { |
158 | const AppLnk* a = apps->findExec( appname ); | 158 | const AppLnk* a = apps->findExec( appname ); |
159 | return a; | 159 | return a; |
160 | } | 160 | } |
161 | 161 | ||
162 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 162 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
163 | { | 163 | { |
164 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 164 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
165 | // "OK" button, little hacky | 165 | // "OK" button, little hacky |
166 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 166 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
167 | QPopupMenu::keyPressEvent( &ke ); | 167 | QPopupMenu::keyPressEvent( &ke ); |
168 | } else { | 168 | } else { |
169 | QPopupMenu::keyPressEvent( e ); | 169 | QPopupMenu::keyPressEvent( e ); |
170 | } | 170 | } |
171 | } | 171 | } |