author | schurig <schurig> | 2003-07-09 09:45:45 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-07-09 09:45:45 (UTC) |
commit | aa36a8c83f54c3380a512281e8821ed930854b4d (patch) (unidiff) | |
tree | 5a0f05181e33d1090c64793adbc1299ee33d7717 | |
parent | 4cc87752584c08d1267cc389142777db5faba302 (diff) | |
download | opie-aa36a8c83f54c3380a512281e8821ed930854b4d.zip opie-aa36a8c83f54c3380a512281e8821ed930854b4d.tar.gz opie-aa36a8c83f54c3380a512281e8821ed930854b4d.tar.bz2 |
forward port from branch
-rw-r--r-- | core/launcher/startmenu.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 28c8b97..d75e8be 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -1,142 +1,143 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define INCLUDE_MENUITEM_DEF | 21 | #define INCLUDE_MENUITEM_DEF |
22 | 22 | ||
23 | #include "startmenu.h" | 23 | #include "startmenu.h" |
24 | #include "sidething.h" | 24 | #include "sidething.h" |
25 | //#include "mrulist.h" | 25 | //#include "mrulist.h" |
26 | #include "info.h" | 26 | #include "info.h" |
27 | 27 | ||
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | #include <qpe/qlibrary.h> | 33 | #include <qpe/qlibrary.h> |
34 | 34 | ||
35 | #include <qintdict.h> | 35 | #include <qintdict.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | 39 | ||
40 | 40 | ||
41 | // #define USE_CONFIG_FILE | 41 | // #define USE_CONFIG_FILE |
42 | 42 | ||
43 | 43 | ||
44 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) | 44 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) |
45 | { | 45 | { |
46 | loadOptions(); | 46 | loadOptions(); |
47 | safety_tid = 1; // disable the timer... valgrind said it.. we don't use that option either -zecke | ||
47 | 48 | ||
48 | int sz = AppLnk::smallIconSize()+3; | 49 | int sz = AppLnk::smallIconSize()+3; |
49 | QPixmap pm; | 50 | QPixmap pm; |
50 | pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); | 51 | pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); |
51 | setPixmap(pm); | 52 | setPixmap(pm); |
52 | setFocusPolicy( NoFocus ); | 53 | setFocusPolicy( NoFocus ); |
53 | //setFlat( startButtonIsFlat ); | 54 | //setFlat( startButtonIsFlat ); |
54 | 55 | ||
55 | apps = 0; | 56 | apps = 0; |
56 | launchMenu = 0; | 57 | launchMenu = 0; |
57 | applets. setAutoDelete ( true ); | 58 | applets. setAutoDelete ( true ); |
58 | sepId = 0; | 59 | sepId = 0; |
59 | 60 | ||
60 | reloadApps ( ); | 61 | reloadApps ( ); |
61 | reloadApplets ( ); | 62 | reloadApplets ( ); |
62 | } | 63 | } |
63 | 64 | ||
64 | 65 | ||
65 | void StartMenu::mousePressEvent( QMouseEvent * ) | 66 | void StartMenu::mousePressEvent( QMouseEvent * ) |
66 | { | 67 | { |
67 | launch(); | 68 | launch(); |
68 | if (desktopInfo) | 69 | if (desktopInfo) |
69 | desktopInfo->menuClicked(); | 70 | desktopInfo->menuClicked(); |
70 | } | 71 | } |
71 | 72 | ||
72 | 73 | ||
73 | StartMenu::~StartMenu() | 74 | StartMenu::~StartMenu() |
74 | { | 75 | { |
75 | delete apps; | 76 | delete apps; |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | void StartMenu::loadOptions() | 80 | void StartMenu::loadOptions() |
80 | { | 81 | { |
81 | #ifdef USE_CONFIG_FILE | 82 | #ifdef USE_CONFIG_FILE |
82 | // Read configuration file | 83 | // Read configuration file |
83 | Config config("StartMenu"); | 84 | Config config("StartMenu"); |
84 | config.setGroup( "StartMenu" ); | 85 | config.setGroup( "StartMenu" ); |
85 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); | 86 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); |
86 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; | 87 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; |
87 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); | 88 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); |
88 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; | 89 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; |
89 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); | 90 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); |
90 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); | 91 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); |
91 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); | 92 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); |
92 | #else | 93 | #else |
93 | // Basically just #include the .qpe_menu.conf file settings | 94 | // Basically just #include the .qpe_menu.conf file settings |
94 | useWidePopupMenu = FALSE; | 95 | useWidePopupMenu = FALSE; |
95 | popupMenuSidePixmap = "launcher/sidebar"; | 96 | popupMenuSidePixmap = "launcher/sidebar"; |
96 | startButtonIsFlat = TRUE; | 97 | startButtonIsFlat = TRUE; |
97 | startButtonPixmap = "go"; // No tr | 98 | startButtonPixmap = "go"; // No tr |
98 | #endif | 99 | #endif |
99 | } | 100 | } |
100 | 101 | ||
101 | 102 | ||
102 | void StartMenu::createMenu() | 103 | void StartMenu::createMenu() |
103 | { | 104 | { |
104 | delete launchMenu; | 105 | delete launchMenu; |
105 | if ( useWidePopupMenu ) | 106 | if ( useWidePopupMenu ) |
106 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); | 107 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); |
107 | else | 108 | else |
108 | launchMenu = new StartPopupMenu( this ); | 109 | launchMenu = new StartPopupMenu( this ); |
109 | 110 | ||
110 | loadMenu ( apps, launchMenu ); | 111 | loadMenu ( apps, launchMenu ); |
111 | loadApplets ( ); | 112 | loadApplets ( ); |
112 | 113 | ||
113 | connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 114 | connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
114 | } | 115 | } |
115 | 116 | ||
116 | void StartMenu::reloadApps() | 117 | void StartMenu::reloadApps() |
117 | { | 118 | { |
118 | Config cfg("StartMenu"); | 119 | Config cfg("StartMenu"); |
119 | cfg.setGroup("Menu"); | 120 | cfg.setGroup("Menu"); |
120 | bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); | 121 | bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); |
121 | bool lot = cfg.readBoolEntry("LauncherOther",TRUE); | 122 | bool lot = cfg.readBoolEntry("LauncherOther",TRUE); |
122 | bool lt = ltabs || lot; | 123 | bool lt = ltabs || lot; |
123 | if ( launchMenu && apps && !lt ) | 124 | if ( launchMenu && apps && !lt ) |
124 | return; // nothing to do | 125 | return; // nothing to do |
125 | 126 | ||
126 | if ( lt ) { | 127 | if ( lt ) { |
127 | delete apps; | 128 | delete apps; |
128 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | 129 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); |
129 | } | 130 | } |
130 | if ( launchMenu ) { | 131 | if ( launchMenu ) { |
131 | launchMenu-> hide ( ); | 132 | launchMenu-> hide ( ); |
132 | 133 | ||
133 | for ( QIntDictIterator<QPopupMenu> it ( tabdict ); it. current ( ); ++it ) { | 134 | for ( QIntDictIterator<QPopupMenu> it ( tabdict ); it. current ( ); ++it ) { |
134 | launchMenu-> removeItem ( it. currentKey ( )); | 135 | launchMenu-> removeItem ( it. currentKey ( )); |
135 | delete it.current ( ); | 136 | delete it.current ( ); |
136 | } | 137 | } |
137 | tabdict. clear ( ); | 138 | tabdict. clear ( ); |
138 | loadMenu(apps,launchMenu); | 139 | loadMenu(apps,launchMenu); |
139 | } else { | 140 | } else { |
140 | createMenu(); | 141 | createMenu(); |
141 | } | 142 | } |
142 | } | 143 | } |