summaryrefslogtreecommitdiff
path: root/core/launcher/startmenu.cpp
authormickeyl <mickeyl>2005-07-03 22:13:00 (UTC)
committer mickeyl <mickeyl>2005-07-03 22:13:00 (UTC)
commit2cabd9ad4b49eefccdf99ad59550c76546b473c9 (patch) (unidiff)
tree00bab275ac356aecc5a39b86ca22ce172d01f622 /core/launcher/startmenu.cpp
parent47011752d4457a1055894479e5bf855e100fddac (diff)
downloadopie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.zip
opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.gz
opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.bz2
Resource -> OResource
This is a large diff and I'd appreciate some additional pairs of eyes checking it
Diffstat (limited to 'core/launcher/startmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp79
1 files changed, 37 insertions, 42 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index ce7840e..24a9d7e 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -1,23 +1,30 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2                 This file is part of the Opie Project
3** 3 =. (C) 2000-2002 Trolltech AS
4** This file is part of the Qtopia Environment. 4 .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
5** 5           .>+-=
6** This file may be distributed and/or modified under the terms of the 6 _;:,     .>    :=|. This program is free software; you can
7** GNU General Public License version 2 as published by the Free Software 7.> <`_,   >  .   <= redistribute it and/or modify it under
8** Foundation and appearing in the file LICENSE.GPL included in the 8 :`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9** packaging of this file. 9.="- .-=="i,     .._ License as published by the Free Software
10** 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11     ._= =}       :
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .%`+i>       _;_.
13** 13    .i_,=:_.      -<s. This program is distributed in the hope that
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15** 15 : ..    .:,     . . . without even the implied warranty of
16** Contact info@trolltech.com if any conditions of this licensing are 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17** not clear to you. 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18** 18..}^=.=       =       ; Library General Public License for more
19**********************************************************************/ 19++=   -.     .`     .: details.
20 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27*/
21// TODO. During startup 28// TODO. During startup
22// Launcher::typeAdded 29// Launcher::typeAdded
23// is called for each new tab and calls then each time the refresh of startmenu 30// is called for each new tab and calls then each time the refresh of startmenu
@@ -27,17 +34,14 @@
27 34
28#include "startmenu.h" 35#include "startmenu.h"
29 36
37/* OPIE */
38#include <opie2/oresource.h>
39using namespace Opie::Core;
30#include <qtopia/qpeapplication.h> 40#include <qtopia/qpeapplication.h>
31#include <qtopia/config.h> 41#include <qtopia/config.h>
32#include <qtopia/resource.h>
33#include <qtopia/mimetype.h> 42#include <qtopia/mimetype.h>
34#include <qtopia/qlibrary.h> 43#include <qtopia/qlibrary.h>
35 44
36//#include <qpainter.h>
37
38//#include <stdlib.h>
39
40
41#define APPLNK_ID_OFFSET 250 45#define APPLNK_ID_OFFSET 250
42#define NO_ID -1 46#define NO_ID -1
43 47
@@ -61,7 +65,7 @@ StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
61 65
62 int sz = AppLnk::smallIconSize()+3; 66 int sz = AppLnk::smallIconSize()+3;
63 QPixmap pm; 67 QPixmap pm;
64 pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) ); 68 pm.convertFromImage(OResource::loadImage( startButtonPixmap, OResource::NoScale ).smoothScale( sz,sz) );
65 setPixmap(pm); 69 setPixmap(pm);
66 setFocusPolicy( NoFocus ); 70 setFocusPolicy( NoFocus );
67 71
@@ -145,13 +149,7 @@ void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file )
145 menu->insertSeparator(); 149 menu->insertSeparator();
146 delete applnk; 150 delete applnk;
147 } else { 151 } else {
148 QPixmap test; 152 QPixmap pixmap = OResource::loadPixmap( applnk->icon(), OResource::SmallIcon );
149 QImage img = Resource::loadImage( applnk->icon() );
150 if(!img.isNull() )
151 test.convertFromImage(
152 img.smoothScale(
153 AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 );
154
155 // Insert items ordered lexically 153 // Insert items ordered lexically
156 int current, left = 0, right = currentItem; 154 int current, left = 0, right = currentItem;
157 while( left != right ) { 155 while( left != right ) {
@@ -161,8 +159,8 @@ void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file )
161 else 159 else
162 right = current; 160 right = current;
163 } 161 }
164 162
165 menu->insertItem( test, applnk->name(), 163 menu->insertItem( pixmap, applnk->name(),
166 currentItem + APPLNK_ID_OFFSET, current ); 164 currentItem + APPLNK_ID_OFFSET, current );
167 appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); 165 appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk );
168 currentItem++; 166 currentItem++;
@@ -194,21 +192,18 @@ void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool l
194 192
195 // checks were ok 193 // checks were ok
196 194
197 QPixmap test; 195 QPixmap pixmap = OResource::loadPixmap( icon, OResource::SmallIcon );
198 test.convertFromImage( Resource::loadImage( icon ).smoothScale(
199 AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 );
200
201 if ( useWidePopupMenu ) { 196 if ( useWidePopupMenu ) {
202 // generate submenu 197 // generate submenu
203 QPopupMenu *submenu = new QPopupMenu( menu ); 198 QPopupMenu *submenu = new QPopupMenu( menu );
204 connect( submenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 199 connect( submenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
205 menu->insertItem( test, name, submenu, NO_ID ); 200 menu->insertItem( pixmap, name, submenu, NO_ID );
206 201
207 // ltabs is true cause else we wouldn't stuck around.. 202 // ltabs is true cause else we wouldn't stuck around..
208 createMenuEntries( submenu, subdir, true, lot ); 203 createMenuEntries( submenu, subdir, true, lot );
209 } else { 204 } else {
210 // no submenus - just bring corresponding tab to front 205 // no submenus - just bring corresponding tab to front
211 menu->insertItem( test, name, currentItem ); 206 menu->insertItem( pixmap, name, currentItem );
212 tabNames.insert( currentItem, new QString( file ) ); 207 tabNames.insert( currentItem, new QString( file ) );
213 currentItem++; 208 currentItem++;
214 } 209 }