summaryrefslogtreecommitdiff
path: root/library/fileselector.cpp
Unidiff
Diffstat (limited to 'library/fileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/fileselector.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/fileselector.cpp b/library/fileselector.cpp
index 7ff09b4..052a29e 100644
--- a/library/fileselector.cpp
+++ b/library/fileselector.cpp
@@ -1,138 +1,138 @@
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// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FSLP 23#define QTOPIA_INTERNAL_FSLP
24 24
25#include "fileselector.h" 25#include "fileselector.h"
26#include "fileselector_p.h" 26#include "fileselector_p.h"
27#include "global.h" 27#include "global.h"
28#include "resource.h" 28#include "resource.h"
29#include "config.h" 29#include "config.h"
30#include "applnk.h" 30#include "applnk.h"
31#include "storage.h" 31#include "storage.h"
32#include "qpemenubar.h" 32#include "qpemenubar.h"
33#ifdef QWS 33#ifdef QWS
34#include "qcopchannel_qws.h" 34#include <qcopchannel_qws.h>
35#endif 35#endif
36#include "lnkproperties.h" 36#include "lnkproperties.h"
37#include "applnk.h" 37#include "applnk.h"
38#include "qpeapplication.h" 38#include <qpe/qpeapplication.h>
39#include "categorymenu.h" 39#include "categorymenu.h"
40#include "categoryselect.h" 40#include "categoryselect.h"
41#include "mimetype.h" 41#include "mimetype.h"
42#include "categories.h" 42#include <qpe/categories.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45 45
46#include <qdir.h> 46#include <qdir.h>
47#include <qwidget.h> 47#include <qwidget.h>
48#include <qpopupmenu.h> 48#include <qpopupmenu.h>
49#include <qtoolbutton.h> 49#include <qtoolbutton.h>
50#include <qpushbutton.h> 50#include <qpushbutton.h>
51#include <qheader.h> 51#include <qheader.h>
52#include <qtooltip.h> 52#include <qtooltip.h>
53#include <qwhatsthis.h> 53#include <qwhatsthis.h>
54 54
55class TypeCombo : public QComboBox 55class TypeCombo : public QComboBox
56{ 56{
57 Q_OBJECT 57 Q_OBJECT
58public: 58public:
59 TypeCombo( QWidget *parent, const char *name=0 ) 59 TypeCombo( QWidget *parent, const char *name=0 )
60 : QComboBox( parent, name ) 60 : QComboBox( parent, name )
61 { 61 {
62 connect( this, SIGNAL(activated(int)), this, SLOT(selectType(int)) ); 62 connect( this, SIGNAL(activated(int)), this, SLOT(selectType(int)) );
63 } 63 }
64 64
65 void reread( DocLnkSet &files, const QString &filter ); 65 void reread( DocLnkSet &files, const QString &filter );
66 66
67signals: 67signals:
68 void selected( const QString & ); 68 void selected( const QString & );
69 69
70protected slots: 70protected slots:
71 void selectType( int idx ) { 71 void selectType( int idx ) {
72 emit selected( typelist[idx] ); 72 emit selected( typelist[idx] );
73 } 73 }
74 74
75protected: 75protected:
76 QStringList typelist; 76 QStringList typelist;
77 QString prev; 77 QString prev;
78}; 78};
79 79
80void TypeCombo::reread( DocLnkSet &files, const QString &filter ) 80void TypeCombo::reread( DocLnkSet &files, const QString &filter )
81{ 81{
82 typelist.clear(); 82 typelist.clear();
83 QStringList filters = QStringList::split( ';', filter ); 83 QStringList filters = QStringList::split( ';', filter );
84 int pos = filter.find( '/' ); 84 int pos = filter.find( '/' );
85 //### do for each filter 85 //### do for each filter
86 if ( filters.count() == 1 && pos >= 0 && filter[pos+1] != '*' ) { 86 if ( filters.count() == 1 && pos >= 0 && filter[pos+1] != '*' ) {
87 typelist.append( filter ); 87 typelist.append( filter );
88 clear(); 88 clear();
89 QString minor = filter.mid( pos+1 ); 89 QString minor = filter.mid( pos+1 );
90 minor[0] = minor[0].upper(); 90 minor[0] = minor[0].upper();
91 insertItem( tr("%1 files").arg(minor) ); 91 insertItem( tr("%1 files").arg(minor) );
92 setCurrentItem(0); 92 setCurrentItem(0);
93 setEnabled( FALSE ); 93 setEnabled( FALSE );
94 return; 94 return;
95 } 95 }
96 96
97 QListIterator<DocLnk> dit( files.children() ); 97 QListIterator<DocLnk> dit( files.children() );
98 for ( ; dit.current(); ++dit ) { 98 for ( ; dit.current(); ++dit ) {
99 if ( !typelist.contains( (*dit)->type() ) ) 99 if ( !typelist.contains( (*dit)->type() ) )
100 typelist.append( (*dit)->type() ); 100 typelist.append( (*dit)->type() );
101 } 101 }
102 102
103 QStringList types; 103 QStringList types;
104 QStringList::ConstIterator it; 104 QStringList::ConstIterator it;
105 for (it = typelist.begin(); it!=typelist.end(); ++it) { 105 for (it = typelist.begin(); it!=typelist.end(); ++it) {
106 QString t = *it; 106 QString t = *it;
107 if ( t.left(12) == "application/" ) { 107 if ( t.left(12) == "application/" ) {
108 MimeType mt(t); 108 MimeType mt(t);
109 const AppLnk* app = mt.application(); 109 const AppLnk* app = mt.application();
110 if ( app ) 110 if ( app )
111 t = app->name(); 111 t = app->name();
112 else 112 else
113 t = t.mid(12); 113 t = t.mid(12);
114 } else { 114 } else {
115 QString major, minor; 115 QString major, minor;
116 int pos = t.find( '/' ); 116 int pos = t.find( '/' );
117 if ( pos >= 0 ) { 117 if ( pos >= 0 ) {
118 major = t.left( pos ); 118 major = t.left( pos );
119 minor = t.mid( pos+1 ); 119 minor = t.mid( pos+1 );
120 } 120 }
121 if ( minor.find( "x-" ) == 0 ) 121 if ( minor.find( "x-" ) == 0 )
122 minor = minor.mid( 2 ); 122 minor = minor.mid( 2 );
123 minor[0] = minor[0].upper(); 123 minor[0] = minor[0].upper();
124 major[0] = major[0].upper(); 124 major[0] = major[0].upper();
125 if ( filters.count() > 1 ) 125 if ( filters.count() > 1 )
126 t = tr("%1 %2", "minor mimetype / major mimetype").arg(minor).arg(major); 126 t = tr("%1 %2", "minor mimetype / major mimetype").arg(minor).arg(major);
127 else 127 else
128 t = minor; 128 t = minor;
129 } 129 }
130 types += tr("%1 files").arg(t); 130 types += tr("%1 files").arg(t);
131 } 131 }
132 for (it = filters.begin(); it!=filters.end(); ++it) { 132 for (it = filters.begin(); it!=filters.end(); ++it) {
133 typelist.append( *it ); 133 typelist.append( *it );
134 int pos = (*it).find( '/' ); 134 int pos = (*it).find( '/' );
135 if ( pos >= 0 ) { 135 if ( pos >= 0 ) {
136 QString maj = (*it).left( pos ); 136 QString maj = (*it).left( pos );
137 maj[0] = maj[0].upper(); 137 maj[0] = maj[0].upper();
138 types << tr("All %1 files").arg(maj); 138 types << tr("All %1 files").arg(maj);