summaryrefslogtreecommitdiff
path: root/core/launcher/launcherview.cpp
Unidiff
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 6c7d487..71e8753 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,53 +1,56 @@
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#include "launcherview.h" 21#include "launcherview.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
23#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
24#include <qtopia/private/categories.h> 26#include <qtopia/private/categories.h>
25#include <qtopia/categoryselect.h> 27#include <qtopia/categoryselect.h>
26#include <qtopia/mimetype.h> 28#include <qtopia/mimetype.h>
27#include <qtopia/resource.h> 29#include <qtopia/resource.h>
28//#include <qtopia/private/palmtoprecord.h> 30using namespace Opie::Core;
29 31
32/* QT */
30#include <qtimer.h> 33#include <qtimer.h>
31#include <qfileinfo.h> 34#include <qfileinfo.h>
32#include <qiconview.h> 35#include <qiconview.h>
33#include <qobjectlist.h> 36#include <qobjectlist.h>
34 37
35 38
36// These define how the busy icon is animated and highlighted 39// These define how the busy icon is animated and highlighted
37#define BRIGHTEN_BUSY_ICON 40#define BRIGHTEN_BUSY_ICON
38//#define ALPHA_FADE_BUSY_ICON 41//#define ALPHA_FADE_BUSY_ICON
39//#define USE_ANIMATED_BUSY_ICON_OVERLAY 42//#define USE_ANIMATED_BUSY_ICON_OVERLAY
40#define BOUNCE_BUSY_ICON 43#define BOUNCE_BUSY_ICON
41 44
42 45
43class BgPixmap 46class BgPixmap
44{ 47{
45public: 48public:
46 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 49 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
47 QPixmap pm; 50 QPixmap pm;
48 int ref; 51 int ref;
49}; 52};
50 53
51 54
52static QMap<QString,BgPixmap*> *bgCache = 0; 55static QMap<QString,BgPixmap*> *bgCache = 0;
53 56
@@ -94,49 +97,49 @@ private:
94class LauncherIconView : public QIconView { 97class LauncherIconView : public QIconView {
95public: 98public:
96 LauncherIconView( QWidget* parent, const char* name=0 ) : 99 LauncherIconView( QWidget* parent, const char* name=0 ) :
97 QIconView(parent,name), 100 QIconView(parent,name),
98 tf(""), 101 tf(""),
99 cf(0), 102 cf(0),
100 bsy(0), 103 bsy(0),
101 busyTimer(0), 104 busyTimer(0),
102 bigIcns(TRUE), 105 bigIcns(TRUE),
103 bgColor(white) 106 bgColor(white)
104 { 107 {
105 sortmeth = Name; 108 sortmeth = Name;
106 hidden.setAutoDelete(TRUE); 109 hidden.setAutoDelete(TRUE);
107 ike = FALSE; 110 ike = FALSE;
108 calculateGrid( Bottom ); 111 calculateGrid( Bottom );
109 } 112 }
110 113
111 ~LauncherIconView() 114 ~LauncherIconView()
112 { 115 {
113#if 0 // debuggery 116#if 0 // debuggery
114 QListIterator<AppLnk> it(hidden); 117 QListIterator<AppLnk> it(hidden);
115 AppLnk* l; 118 AppLnk* l;
116 while ((l=it.current())) { 119 while ((l=it.current())) {
117 ++it; 120 ++it;
118 //qDebug("%p: hidden (should remove)",l); 121 //odebug << "" << l << ": hidden (should remove)" << oendl;
119 } 122 }
120#endif 123#endif
121 } 124 }
122 125
123 QIconViewItem* busyItem() const { return bsy; } 126 QIconViewItem* busyItem() const { return bsy; }
124#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 127#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
125 QPixmap busyPixmap() const { return busyPix; } 128 QPixmap busyPixmap() const { return busyPix; }
126#endif 129#endif
127 void setBigIcons( bool bi ) { 130 void setBigIcons( bool bi ) {
128 bigIcns = bi; 131 bigIcns = bi;
129#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 132#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
130 busyPix.resize(0,0); 133 busyPix.resize(0,0);
131#endif 134#endif
132 } 135 }
133 136
134 void updateCategoriesAndMimeTypes(); 137 void updateCategoriesAndMimeTypes();
135 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 138 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
136 void doAutoScroll() 139 void doAutoScroll()
137 { 140 {
138 // We don't want rubberbanding (yet) 141 // We don't want rubberbanding (yet)
139 } 142 }
140 143
141 void setBusy(bool on) 144 void setBusy(bool on)
142 { 145 {
@@ -1008,49 +1011,49 @@ void LauncherView::setUpdatesEnabled( bool u )
1008 1011
1009void LauncherView::sort() 1012void LauncherView::sort()
1010{ 1013{
1011 icons->sort(); 1014 icons->sort();
1012} 1015}
1013 1016
1014void LauncherView::addItem(AppLnk* app, bool resort) 1017void LauncherView::addItem(AppLnk* app, bool resort)
1015{ 1018{
1016 icons->addItem(app,resort); 1019 icons->addItem(app,resort);
1017} 1020}
1018 1021
1019void LauncherView::paletteChange( const QPalette &p ) 1022void LauncherView::paletteChange( const QPalette &p )
1020{ 1023{
1021 icons->unsetPalette(); 1024 icons->unsetPalette();
1022 QVBox::paletteChange( p ); 1025 QVBox::paletteChange( p );
1023 if ( bgType == Ruled ) 1026 if ( bgType == Ruled )
1024 setBackgroundType( Ruled, QString::null ); 1027 setBackgroundType( Ruled, QString::null );
1025 QColorGroup cg = icons->colorGroup(); 1028 QColorGroup cg = icons->colorGroup();
1026 cg.setColor( QColorGroup::Text, textCol ); 1029 cg.setColor( QColorGroup::Text, textCol );
1027 icons->setPalette( QPalette(cg,cg,cg) ); 1030 icons->setPalette( QPalette(cg,cg,cg) );
1028} 1031}
1029 1032
1030void LauncherView::fontChanged(const QFont&) 1033void LauncherView::fontChanged(const QFont&)
1031{ 1034{
1032 qDebug("LauncherView::fontChanged()"); 1035 odebug << "LauncherView::fontChanged()" << oendl;
1033 icons->hideOrShowItems( FALSE ); 1036 icons->hideOrShowItems( FALSE );
1034} 1037}
1035 1038
1036void LauncherView::relayout(void) 1039void LauncherView::relayout(void)
1037{ 1040{
1038 icons->hideOrShowItems(FALSE); 1041 icons->hideOrShowItems(FALSE);
1039} 1042}
1040 1043
1041void LauncherView::flushBgCache() 1044void LauncherView::flushBgCache()
1042{ 1045{
1043 if ( !bgCache ) 1046 if ( !bgCache )
1044 return; 1047 return;
1045 // remove unreferenced backgrounds. 1048 // remove unreferenced backgrounds.
1046 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 1049 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
1047 while ( it != bgCache->end() ) { 1050 while ( it != bgCache->end() ) {
1048 QMap<QString,BgPixmap*>::Iterator curr = it; 1051 QMap<QString,BgPixmap*>::Iterator curr = it;
1049 ++it; 1052 ++it;
1050 if ( (*curr)->ref == 0 ) { 1053 if ( (*curr)->ref == 0 ) {
1051 delete (*curr); 1054 delete (*curr);
1052 bgCache->remove( curr ); 1055 bgCache->remove( curr );
1053 } 1056 }
1054 } 1057 }
1055} 1058}
1056 1059