summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro19
-rw-r--r--libopie/odevice.h2
-rw-r--r--libopie/ofileselector.cc13
-rw-r--r--libopie/ofileview.h28
-rw-r--r--libopie/ofontmenu.h2
5 files changed, 39 insertions, 25 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 891c03e..6c47e86 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,25 +1,40 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h oclickablelabel.h oprocctrl.h oprocess.h odevice.h otimepicker.h otabwidget.h otabbar.h otabinfo.h 3HEADERS = ofontmenu.h ofileselector.h \
4SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp oclickablelabel.cpp oprocctrl.cpp oprocess.cpp odevice.cpp otimepicker.cpp otabwidget.cpp otabbar.cpp 4 ofiledialog.h tododb.h \
5 todoevent.h todoresource.h \
6 todovcalresource.h xmltree.h \
7 colordialog.h colorpopupmenu.h \
8 oclickablelabel.h oprocctrl.h \
9 oprocess.h odevice.h \
10 otimepicker.h otabwidget.h \
11 otabbar.h otabinfo.h
12SOURCES = ofontmenu.cc ofileselector.cc \
13 ofiledialog.cc xmltree.cc \
14 tododb.cpp todoevent.cpp \
15 todovcalresource.cpp colordialog.cpp \
16 colorpopupmenu.cpp oclickablelabel.cpp \
17 oprocctrl.cpp oprocess.cpp \
18 odevice.cpp otimepicker.cpp \
19 otabwidget.cpp otabbar.cpp
5TARGET = opie 20TARGET = opie
6INCLUDEPATH += $(OPIEDIR)/include 21INCLUDEPATH += $(OPIEDIR)/include
7DESTDIR = $(QTDIR)/lib$(PROJMAK) 22DESTDIR = $(QTDIR)/lib$(PROJMAK)
8#VERSION = 1.0.0 23#VERSION = 1.0.0
9 24
10INTERFACES = otimepickerbase.ui 25INTERFACES = otimepickerbase.ui
11 26
12TRANSLATIONS = ../i18n/de/libopie.ts \ 27TRANSLATIONS = ../i18n/de/libopie.ts \
13 ../i18n/en/libopie.ts \ 28 ../i18n/en/libopie.ts \
14 ../i18n/es/libopie.ts \ 29 ../i18n/es/libopie.ts \
15 ../i18n/fr/libopie.ts \ 30 ../i18n/fr/libopie.ts \
16 ../i18n/hu/libopie.ts \ 31 ../i18n/hu/libopie.ts \
17 ../i18n/ja/libopie.ts \ 32 ../i18n/ja/libopie.ts \
18 ../i18n/ko/libopie.ts \ 33 ../i18n/ko/libopie.ts \
19 ../i18n/no/libopie.ts \ 34 ../i18n/no/libopie.ts \
20 ../i18n/pl/libopie.ts \ 35 ../i18n/pl/libopie.ts \
21 ../i18n/pt/libopie.ts \ 36 ../i18n/pt/libopie.ts \
22 ../i18n/pt_BR/libopie.ts \ 37 ../i18n/pt_BR/libopie.ts \
23 ../i18n/sl/libopie.ts \ 38 ../i18n/sl/libopie.ts \
24 ../i18n/zh_CN/libopie.ts \ 39 ../i18n/zh_CN/libopie.ts \
25 ../i18n/zh_TW/libopie.ts 40 ../i18n/zh_TW/libopie.ts
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 9dda68e..2f676ff 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -1,119 +1,117 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _LIBOPIE_ODEVICE_H_ 20#ifndef _LIBOPIE_ODEVICE_H_
21#define _LIBOPIE_ODEVICE_H_ 21#define _LIBOPIE_ODEVICE_H_
22 22
23#include <qstring.h> 23#include <qstring.h>
24 24
25 25
26class ODeviceData; 26class ODeviceData;
27 27
28enum OModel { 28enum OModel {
29 OMODEL_Unknown, 29 OMODEL_Unknown,
30 30
31 OMODEL_iPAQ_H31xx, 31 OMODEL_iPAQ_H31xx,
32 OMODEL_iPAQ_H36xx, 32 OMODEL_iPAQ_H36xx,
33 OMODEL_iPAQ_H37xx, 33 OMODEL_iPAQ_H37xx,
34 OMODEL_iPAQ_H38xx, 34 OMODEL_iPAQ_H38xx,
35 35
36 OMODEL_Zaurus_SL5000 36 OMODEL_Zaurus_SL5000
37}; 37};
38 38
39 enum OVendor { 39 enum OVendor {
40 OVENDOR_Unknown, 40 OVENDOR_Unknown,
41 41
42 OVENDOR_HP, 42 OVENDOR_HP,
43 OVENDOR_Sharp 43 OVENDOR_Sharp
44 }; 44 };
45 45
46enum OSystem { 46enum OSystem {
47 OSYSTEM_Unknown, 47 OSYSTEM_Unknown,
48 48
49 OSYSTEM_Familiar, 49 OSYSTEM_Familiar,
50 OSYSTEM_Zaurus, 50 OSYSTEM_Zaurus,
51 OSYSTEM_OpenZaurus 51 OSYSTEM_OpenZaurus
52}; 52};
53 53
54enum OLedState { 54enum OLedState {
55 OLED_Off, 55 OLED_Off,
56 OLED_On, 56 OLED_On,
57 OLED_BlinkSlow, 57 OLED_BlinkSlow,
58 OLED_BlinkFast 58 OLED_BlinkFast
59}; 59};
60 60
61 61
62class ODevice 62class ODevice
63{ 63{
64public: 64public:
65
66public:
67 static ODevice *inst ( ); 65 static ODevice *inst ( );
68 66
69 // system 67 // system
70 enum PowerButtonHandler { 68 enum PowerButtonHandler {
71 KERNEL, 69 KERNEL,
72 OPIE 70 OPIE
73 }; 71 };
74 72
75 virtual bool setPowerButtonHandler ( PowerButtonHandler h ); 73 virtual bool setPowerButtonHandler ( PowerButtonHandler h );
76 virtual bool suspend ( ); 74 virtual bool suspend ( );
77 75
78 virtual bool setDisplayStatus ( bool on ); 76 virtual bool setDisplayStatus ( bool on );
79 virtual bool setDisplayBrightness ( int brightness ); 77 virtual bool setDisplayBrightness ( int brightness );
80 virtual int displayBrightnessResolution ( ) const; 78 virtual int displayBrightnessResolution ( ) const;
81 79
82// information 80// information
83 81
84 QString modelString ( ); 82 QString modelString ( );
85 OModel model ( ); 83 OModel model ( );
86 84
87 QString vendorString ( ); 85 QString vendorString ( );
88 OVendor vendor ( ); 86 OVendor vendor ( );
89 87
90 QString systemString ( ); 88 QString systemString ( );
91 OSystem system ( ); 89 OSystem system ( );
92 90
93 QString systemVersionString ( ); 91 QString systemVersionString ( );
94 92
95// input / output 93// input / output
96 94
97 virtual void alarmSound ( ); 95 virtual void alarmSound ( );
98 virtual void keySound ( ); 96 virtual void keySound ( );
99 virtual void touchSound ( ); 97 virtual void touchSound ( );
100 98
101 virtual uint hasLeds ( ) const; 99 virtual uint hasLeds ( ) const;
102 virtual OLedState led ( uint which ) const; 100 virtual OLedState led ( uint which ) const;
103 virtual bool setLed ( uint which, OLedState st ); 101 virtual bool setLed ( uint which, OLedState st );
104 102
105 virtual ~ODevice ( ); 103 virtual ~ODevice ( );
106 104
107protected: 105protected:
108 ODevice ( ); 106 ODevice ( );
109 virtual void init ( ); 107 virtual void init ( );
110 108
111 ODeviceData *d; 109 ODeviceData *d;
112 110
113private: 111private:
114 ODevice ( const ODevice & ); 112 ODevice ( const ODevice & );
115}; 113};
116 114
117#endif 115#endif
118 116
119 117
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 3c3a6c4..b3aacd6 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -1,1307 +1,1300 @@
1 1
2 2
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qabstractlayout.h> 7#include <qabstractlayout.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qlistview.h> 10#include <qlistview.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <qpainter.h> 12#include <qpainter.h>
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qwidgetstack.h> 14#include <qwidgetstack.h>
15#include <qpopupmenu.h> 15#include <qpopupmenu.h>
16#include <qdir.h> 16#include <qdir.h>
17#include <qfile.h> 17#include <qfile.h>
18#include <qfileinfo.h> 18#include <qfileinfo.h>
19#include <qtimer.h> 19#include <qtimer.h>
20 20
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qpe/fileselector.h> 23#include <qpe/fileselector.h>
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/mimetype.h> 25#include <qpe/mimetype.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/storage.h> 27#include <qpe/storage.h>
28 28
29#include <unistd.h> 29#include <unistd.h>
30#include <stdlib.h> 30#include <stdlib.h>
31#include <sys/stat.h> 31#include <sys/stat.h>
32 32
33#include "ofileselector.h" 33#include "ofileselector.h"
34 34
35 35
36QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 36QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
37 37
38namespace { 38namespace {
39 int indexByString( const QComboBox *box, const QString &str ){ 39 int indexByString( const QComboBox *box, const QString &str ){
40 int index= 0; 40 int index= 0;
41 for(int i= 0; i < box->count(); i++ ){ 41 for(int i= 0; i < box->count(); i++ ){
42 if( str == box->text(i ) ){ 42 if( str == box->text(i ) ){
43 index= i; 43 index= i;
44 break; 44 break;
45 } 45 }
46 } 46 }
47 return index; 47 return index;
48 } 48 }
49 class OFileSelectorItem : public QListViewItem { 49 class OFileSelectorItem : public QListViewItem {
50 public: 50 public:
51 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, 51 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path,
52 const QString &date, const QString &size, const QString &mDir, 52 const QString &date, const QString &size, const QString &mDir,
53 bool isLocked=false, bool isDir=false ): QListViewItem(view) { 53 bool isLocked=false, bool isDir=false ): QListViewItem(view) {
54 setPixmap(0, pixmap ); 54 setPixmap(0, pixmap );
55 setText(1, path ); 55 setText(1, path );
56 setText(2, size ); 56 setText(2, size );
57 setText(3, date ); 57 setText(3, date );
58 //setText(4, mDir ); 58 //setText(4, mDir );
59 m_dir = mDir; 59 m_dir = mDir;
60 dir = isDir; 60 dir = isDir;
61 mLocked = isLocked; 61 mLocked = isLocked;
62 } 62 }
63 bool isLocked() const{ 63 bool isLocked() const{
64 return mLocked; 64 return mLocked;
65 } 65 }
66 QString directory()const{ 66 QString directory()const{
67 return m_dir; 67 return m_dir;
68 } 68 }
69 bool isDir()const{ 69 bool isDir()const{
70 return dir; 70 return dir;
71 } 71 }
72 QString path()const{ 72 QString path()const{
73 return text(1 ); 73 return text(1 );
74 } 74 }
75 QString key(int id, bool )const { 75 QString key(int id, bool )const {
76 QString ke; 76 QString ke;
77 if( id == 0 || id == 1 ){ // name 77 if( id == 0 || id == 1 ){ // name
78 if( dir ){ 78 if( dir ){
79 ke.append("0" ); 79 ke.append("0" );
80 ke.append( text(1) ); 80 ke.append( text(1) );
81 }else{ 81 }else{
82 ke.append("1" ); 82 ke.append("1" );
83 ke.append( text(1) ); 83 ke.append( text(1) );
84 } 84 }
85 }else if( id == 2 ){ // size 85 }else if( id == 2 ){ // size
86 return text(2); 86 return text(2);
87 }else if( id == 3 ){ // date 87 }else if( id == 3 ){ // date
88 return text(3); 88 return text(3);
89 } 89 }
90 return ke; 90 return ke;
91 }; 91 };
92 private: 92 private:
93 bool mLocked:1; 93 bool mLocked:1;
94 bool dir:1; 94 bool dir:1;
95 QString m_dir; 95 QString m_dir;
96 }; 96 };
97}; 97};
98 98
99 99
100OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, 100OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
101 const QString &dirName, 101 const QString &dirName,
102 const QString &fileName, 102 const QString &fileName,
103 const QMap<QString,QStringList>& mimeTypes) 103 const QMap<QString,QStringList>& mimeTypes)
104 : QWidget( wid, "OFileSelector") 104 : QWidget( wid, "OFileSelector")
105{ 105{
106 m_mimetypes = mimeTypes; 106 m_mimetypes = mimeTypes;
107 if (mode == SAVE ) 107 if (mode == SAVE )
108 m_name = fileName; 108 m_name = fileName;
109 initVars(); 109 initVars();
110 m_mode = mode; 110 m_mode = mode;
111 m_selector = selector; 111 m_selector = selector;
112 m_currentDir = dirName; 112 m_currentDir = dirName;
113 init(); 113 init();
114 //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); 114 //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) );
115} 115}
116 116
117OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, 117OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
118 const char *name, bool newVisible, 118 const char *name, bool newVisible,
119 bool closeVisible ) 119 bool closeVisible )
120 : QWidget( parent, name ) 120 : QWidget( parent, name )
121{ 121{
122 if (!mimeFilter.isEmpty() ) { 122 if (!mimeFilter.isEmpty() ) {
123 QStringList list = QStringList::split(";", mimeFilter ); 123 QStringList list = QStringList::split(";", mimeFilter );
124 m_mimetypes.insert(mimeFilter, list ); 124 m_mimetypes.insert(mimeFilter, list );
125 } 125 }
126 initVars(); 126 initVars();
127 m_currentDir = QPEApplication::documentDir(); 127 m_currentDir = QPEApplication::documentDir();
128 m_mode = FILESELECTOR; 128 m_mode = FILESELECTOR;
129 m_selector = NORMAL; 129 m_selector = NORMAL;
130 m_shClose = closeVisible; 130 m_shClose = closeVisible;
131 m_shNew = newVisible; 131 m_shNew = newVisible;
132 m_shLne = false; 132 m_shLne = false;
133 m_shPerm = false; 133 m_shPerm = false;
134 m_shYesNo = false; 134 m_shYesNo = false;
135 init(); 135 init();
136 136
137 137
138} 138}
139 139
140OFileSelector::~OFileSelector() 140OFileSelector::~OFileSelector()
141{ 141{
142 142
143 143
144} 144}
145 145
146void OFileSelector::setNewVisible( bool visible ) 146void OFileSelector::setNewVisible( bool visible )
147{ 147{
148 m_shNew = visible; 148 m_shNew = visible;
149 if( m_selector == NORMAL ){ 149 if( m_selector == NORMAL ){
150 delete m_select; 150 delete m_select;
151 // we need to initialize but keep the selected mimetype 151 // we need to initialize but keep the selected mimetype
152 QString mime = currentMimeType(); 152 QString mime = currentMimeType();
153 m_select = new FileSelector( mime , 153 m_select = new FileSelector( mime ,
154 m_stack, "fileselector", 154 m_stack, "fileselector",
155 m_shNew, m_shClose); 155 m_shNew, m_shClose);
156 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 156 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
157 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 157 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
158 connect(m_select, SIGNAL(closeMe() ), 158 connect(m_select, SIGNAL(closeMe() ),
159 this, SIGNAL(closeMe() ) ); 159 this, SIGNAL(closeMe() ) );
160 //connect to close me and other signals as well 160 //connect to close me and other signals as well
161 m_stack->addWidget( m_select, NORMAL ); 161 m_stack->addWidget( m_select, NORMAL );
162 }else{ 162 }else{
163 m_new->show(); 163 m_new->show();
164 } 164 }
165} 165}
166void OFileSelector::setCloseVisible( bool visible ) 166void OFileSelector::setCloseVisible( bool visible )
167{ 167{
168 m_shClose = visible; 168 m_shClose = visible;
169 if( m_selector == NORMAL ){ 169 if( m_selector == NORMAL ){
170 setNewVisible( m_shNew ); // yeah baby 170 setNewVisible( m_shNew ); // yeah baby
171 }else{ 171 }else{
172 m_close->show(); 172 m_close->show();
173 } 173 }
174} 174}
175void OFileSelector::reread() 175void OFileSelector::reread()
176{ 176{
177 if( m_selector == NORMAL ){ 177 if( m_selector == NORMAL ){
178 setNewVisible( m_shNew ); // make it a initializeSelector 178 setNewVisible( m_shNew ); // make it a initializeSelector
179 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 179 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
180 reparse(); 180 reparse();
181 //}else{ 181 //}else{
182 //; 182 //;
183 } 183 }
184} 184}
185 185
186const DocLnk *OFileSelector::selected() 186const DocLnk *OFileSelector::selected()
187{ 187{
188 if( m_selector == NORMAL ){
189 return m_select->selected();
190 }else{
191 DocLnk *lnk = new DocLnk(selectedDocument() ); 188 DocLnk *lnk = new DocLnk(selectedDocument() );
192 return lnk; 189 return lnk;
193 }
194} 190}
195 191
196void OFileSelector::setYesCancelVisible( bool show ) 192void OFileSelector::setYesCancelVisible( bool show )
197{ 193{
198 initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( 194 initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :(
199 m_shYesNo = show; 195 m_shYesNo = show;
200 if( m_shYesNo ) 196 if( m_shYesNo )
201 m_boxOk->show(); 197 m_boxOk->show();
202 else 198 else
203 m_boxOk->hide(); 199 m_boxOk->hide();
204 200
205} 201}
206void OFileSelector::setToolbarVisible( bool show ) 202void OFileSelector::setToolbarVisible( bool show )
207{ 203{
208 m_shTool = show; 204 m_shTool = show;
209 initializeListView(); // FIXME see above waste of memory 205 initializeListView(); // FIXME see above waste of memory
210 if(!m_shTool ){ 206 if(!m_shTool ){
211 m_location->hide(); 207 m_location->hide();
212 m_up->hide(); 208 m_up->hide();
213 m_homeButton->hide(); 209 m_homeButton->hide();
214 m_docButton->hide(); 210 m_docButton->hide();
215 }else{ 211 }else{
216 m_location->show(); 212 m_location->show();
217 m_up->show(); 213 m_up->show();
218 m_homeButton->show(); 214 m_homeButton->show();
219 m_docButton->show(); 215 m_docButton->show();
220 } 216 }
221} 217}
222void OFileSelector::setPermissionBarVisible( bool show ) 218void OFileSelector::setPermissionBarVisible( bool show )
223{ 219{
224 m_shPerm = show; 220 m_shPerm = show;
225 initializePerm(); 221 initializePerm();
226 if( m_shPerm ) 222 if( m_shPerm )
227 m_checkPerm->show(); 223 m_checkPerm->show();
228 else 224 else
229 m_checkPerm->hide(); 225 m_checkPerm->hide();
230} 226}
231void OFileSelector::setLineEditVisible( bool show ) 227void OFileSelector::setLineEditVisible( bool show )
232{ 228{
233 if( show ){ 229 if( show ){
234 initializeName(); 230 initializeName();
235 m_boxName->show(); 231 m_boxName->show();
236 }else{ 232 }else{
237 if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go 233 if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go
238 m_boxName->hide(); 234 m_boxName->hide();
239 } 235 }
240 } 236 }
241 m_shLne = show; 237 m_shLne = show;
242} 238}
243 239
244void OFileSelector::setChooserVisible( bool show ) 240void OFileSelector::setChooserVisible( bool show )
245{ 241{
246 m_shChooser = show; 242 m_shChooser = show;
247 initializeChooser(); 243 initializeChooser();
248 if( m_shChooser ){ 244 if( m_shChooser ){
249 m_boxView->hide(); 245 m_boxView->hide();
250 }else{ 246 }else{
251 m_boxView->show(); 247 m_boxView->show();
252 } 248 }
253} 249}
254 250
255QCheckBox* OFileSelector::permissionCheckbox() 251QCheckBox* OFileSelector::permissionCheckbox()
256{ 252{
257 if( m_selector == NORMAL ) 253 if( m_selector == NORMAL )
258 return 0l; 254 return 0l;
259 else 255 else
260 return m_checkPerm; 256 return m_checkPerm;
261} 257}
262bool OFileSelector::setPermission()const 258bool OFileSelector::setPermission()const
263{ 259{
264 return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); 260 return m_checkPerm == 0 ? false : m_checkPerm->isChecked();
265} 261}
266void OFileSelector::setPermissionChecked( bool check ) 262void OFileSelector::setPermissionChecked( bool check )
267{ 263{
268 if( m_checkPerm ) 264 if( m_checkPerm )
269 m_checkPerm->setChecked( check ); 265 m_checkPerm->setChecked( check );
270} 266}
271 267
272void OFileSelector::setMode(int mode) // FIXME do direct raising 268void OFileSelector::setMode(int mode) // FIXME do direct raising
273{ 269{
274 m_mode = mode; 270 m_mode = mode;
275 if( m_selector == NORMAL ) 271 if( m_selector == NORMAL )
276 return; 272 return;
277} 273}
278void OFileSelector::setShowDirs(bool ) 274void OFileSelector::setShowDirs(bool )
279{ 275{
280 m_dir = true; 276 m_dir = true;
281 reparse(); 277 reparse();
282} 278}
283void OFileSelector::setCaseSensetive(bool caSe ) 279void OFileSelector::setCaseSensetive(bool caSe )
284{ 280{
285 m_case = caSe; 281 m_case = caSe;
286 reparse(); 282 reparse();
287} 283}
288void OFileSelector::setShowFiles(bool show ) 284void OFileSelector::setShowFiles(bool show )
289{ 285{
290 m_files = show; 286 m_files = show;
291 reparse(); 287 reparse();
292} 288}
293/// 289///
294bool OFileSelector::cd(const QString &path ) 290bool OFileSelector::cd(const QString &path )
295{ 291{
296 m_currentDir = path; 292 m_currentDir = path;
297 reparse(); 293 reparse();
298 return true; 294 return true;
299} 295}
300void OFileSelector::setSelector(int mode ) 296void OFileSelector::setSelector(int mode )
301{ 297{
302QString text; 298QString text;
303 switch( mode ){ 299 switch( mode ){
304 case NORMAL: 300 case NORMAL:
305 text = tr("Documents"); 301 text = tr("Documents");
306 break; 302 break;
307 case EXTENDED: 303 case EXTENDED:
308 text = tr("Files"); 304 text = tr("Files");
309 break; 305 break;
310 case EXTENDED_ALL: 306 case EXTENDED_ALL:
311 text = tr("All Files"); 307 text = tr("All Files");
312 break; 308 break;
313 } 309 }
314 slotViewCheck( text ); 310 slotViewCheck( text );
315} 311}
316 312
317void OFileSelector::setPopupMenu(QPopupMenu *popup ) 313void OFileSelector::setPopupMenu(QPopupMenu *popup )
318{ 314{
319 m_custom = popup; 315 m_custom = popup;
320 m_showPopup = true; 316 m_showPopup = true;
321} 317}
322 318
323//void OFileSelector::updateL 319//void OFileSelector::updateL
324 320
325QString OFileSelector::selectedName() const 321QString OFileSelector::selectedName() const
326{ 322{
327 QString name; 323 QString name;
328 if( m_selector == NORMAL ){ 324 if( m_selector == NORMAL ){
329 const DocLnk *lnk = m_select->selected(); 325 DocLnk lnk = m_select->selectedDocument();
330 name = lnk->file(); 326 name = lnk.file();
331 delete lnk;
332 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 327 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
333 if ( m_shLne ) { 328 if ( m_shLne ) {
334 name = m_currentDir + "/" +m_edit->text(); 329 name = m_currentDir + "/" +m_edit->text();
335 }else{ 330 }else{
336 QListViewItem *item = m_View->currentItem(); 331 QListViewItem *item = m_View->currentItem();
337 if( item != 0 ) 332 if( item != 0 )
338 name = m_currentDir + "/" + item->text( 1 ); 333 name = m_currentDir + "/" + item->text( 1 );
339 } 334 }
340 }else { // installed view 335 }else { // installed view
341 ; 336 ;
342 } 337 }
343 return name; 338 return name;
344} 339}
345QStringList OFileSelector::selectedNames()const 340QStringList OFileSelector::selectedNames()const
346{ 341{
347 QStringList list; 342 QStringList list;
348 if( m_selector == NORMAL ){ 343 if( m_selector == NORMAL ){
349 list << selectedName(); 344 list << selectedName();
350 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 345 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
351 list << selectedName(); // FIXME implement multiple Selections 346 list << selectedName(); // FIXME implement multiple Selections
352 } 347 }
353 return list; 348 return list;
354} 349}
355/** If mode is set to the Dir selection this will return the selected path. 350/** If mode is set to the Dir selection this will return the selected path.
356 * 351 *
357 * 352 *
358 */ 353 */
359QString OFileSelector::selectedPath()const 354QString OFileSelector::selectedPath()const
360{ 355{
361 QString path; 356 QString path;
362 if( m_selector == NORMAL ){ 357 if( m_selector == NORMAL ){
363 path = QPEApplication::documentDir(); 358 path = QPEApplication::documentDir();
364 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 359 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
365 ; 360 ;
366 } 361 }
367 return path; 362 return path;
368} 363}
369QStringList OFileSelector::selectedPaths() const 364QStringList OFileSelector::selectedPaths() const
370{ 365{
371 QStringList list; 366 QStringList list;
372 list << selectedPath(); 367 list << selectedPath();
373 return list; 368 return list;
374} 369}
375QString OFileSelector::directory()const 370QString OFileSelector::directory()const
376{ 371{
377 if( m_selector == NORMAL ) 372 if( m_selector == NORMAL )
378 return QPEApplication::documentDir(); 373 return QPEApplication::documentDir();
379 374
380 return QDir(m_currentDir).absPath(); 375 return QDir(m_currentDir).absPath();
381} 376}
382 377
383int OFileSelector::fileCount() 378int OFileSelector::fileCount()
384{ 379{
385 int count; 380 int count;
386 switch( m_selector ){ 381 switch( m_selector ){
387 case NORMAL: 382 case NORMAL:
388 count = m_select->fileCount(); 383 count = m_select->fileCount();
389 break; 384 break;
390 //case CUSTOM: 385 //case CUSTOM:
391 case EXTENDED: 386 case EXTENDED:
392 case EXTENDED_ALL: 387 case EXTENDED_ALL:
393 default: 388 default:
394 count = m_View->childCount(); 389 count = m_View->childCount();
395 break; 390 break;
396 } 391 }
397 return count; 392 return count;
398} 393}
399DocLnk OFileSelector::selectedDocument() const 394DocLnk OFileSelector::selectedDocument() const
400{ 395{
401 DocLnk lnk; 396 DocLnk lnk;
402 switch( m_selector ){ 397 switch( m_selector ){
403 case NORMAL:{ 398 case NORMAL:{
404 const DocLnk *lnk2 = m_select->selected(); 399 lnk = m_select->selectedDocument();
405 lnk = DocLnk(*lnk2 ); // copy
406 delete lnk2;
407 break; 400 break;
408 } 401 }
409 case EXTENDED: 402 case EXTENDED:
410 case EXTENDED_ALL: 403 case EXTENDED_ALL:
411 default: 404 default:
412 lnk = DocLnk( selectedName() ); // new DocLnk 405 lnk = DocLnk( selectedName() ); // new DocLnk
413 break; 406 break;
414 } 407 }
415 return lnk; 408 return lnk;
416} 409}
417QValueList<DocLnk> OFileSelector::selectedDocuments() const 410QValueList<DocLnk> OFileSelector::selectedDocuments() const
418{ 411{
419 QValueList<DocLnk> docs; 412 QValueList<DocLnk> docs;
420 docs.append( selectedDocument() ); 413 docs.append( selectedDocument() );
421 return docs; 414 return docs;
422} 415}
423 416
424 417
425// slots internal 418// slots internal
426 419
427void OFileSelector::slotOk() 420void OFileSelector::slotOk()
428{ 421{
429 emit ok(); 422 emit ok();
430} 423}
431void OFileSelector::slotCancel() 424void OFileSelector::slotCancel()
432{ 425{
433 emit cancel(); 426 emit cancel();
434} 427}
435void OFileSelector::slotViewCheck(const QString &sel) 428void OFileSelector::slotViewCheck(const QString &sel)
436{ 429{
437 if( sel == tr("Documents" ) ){ 430 if( sel == tr("Documents" ) ){
438 if( m_select == 0 ){ 431 if( m_select == 0 ){
439 // autMime? fix cause now we use All and not the current 432 // autMime? fix cause now we use All and not the current
440 // yes currentMime fixes that for us 433 // yes currentMime fixes that for us
441 QString mime = currentMimeType(); 434 QString mime = currentMimeType();
442 m_select = new FileSelector(mime, 435 m_select = new FileSelector(mime,
443 m_stack, "fileselector", 436 m_stack, "fileselector",
444 m_shNew, m_shClose); 437 m_shNew, m_shClose);
445 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 438 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
446 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 439 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
447 connect(m_select, SIGNAL(closeMe() ), 440 connect(m_select, SIGNAL(closeMe() ),
448 this, SIGNAL(closeMe() ) ); 441 this, SIGNAL(closeMe() ) );
449 //connect to close me and other signals as well 442 //connect to close me and other signals as well
450 443
451 m_stack->addWidget( m_select, NORMAL ); 444 m_stack->addWidget( m_select, NORMAL );
452 } 445 }
453 m_stack->raiseWidget( NORMAL ); 446 m_stack->raiseWidget( NORMAL );
454 m_selector = NORMAL; 447 m_selector = NORMAL;
455 }else if( sel == tr("Files") ){ 448 }else if( sel == tr("Files") ){
456 m_selector = EXTENDED; 449 m_selector = EXTENDED;
457 initializeListView(); 450 initializeListView();
458 reparse(); 451 reparse();
459 m_stack->raiseWidget( EXTENDED ); 452 m_stack->raiseWidget( EXTENDED );
460 }else if( sel == tr("All Files") ){ 453 }else if( sel == tr("All Files") ){
461 m_selector = EXTENDED_ALL; 454 m_selector = EXTENDED_ALL;
462 initializeListView(); 455 initializeListView();
463 reparse(); 456 reparse();
464 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter 457 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter
465 } 458 }
466} 459}
467// not yet finished..... 460// not yet finished.....
468QString OFileSelector::currentMimeType() const{ 461QString OFileSelector::currentMimeType() const{
469 QString mime; 462 QString mime;
470 QString currentText; 463 QString currentText;
471 if (m_shChooser ) 464 if (m_shChooser )
472 currentText = m_mimeCheck->currentText(); 465 currentText = m_mimeCheck->currentText();
473 466
474 if (tr("All") == currentText ) return QString::null; 467 if (tr("All") == currentText ) return QString::null;
475 else if (currentText.isEmpty() ) { 468 else if (currentText.isEmpty() ) {
476 ; 469 ;
477 }else { 470 }else {
478 QMap<QString, QStringList>::ConstIterator it; 471 QMap<QString, QStringList>::ConstIterator it;
479 it = m_mimetypes.find( currentText ); 472 it = m_mimetypes.find( currentText );
480 if ( it == m_mimetypes.end() ) { 473 if ( it == m_mimetypes.end() ) {
481 mime = it.data().join(";"); 474 mime = it.data().join(";");
482 }else{ 475 }else{
483 mime = currentText; 476 mime = currentText;
484 } 477 }
485 } 478 }
486 return mime; 479 return mime;
487} 480}
488void OFileSelector::slotMimeCheck(const QString &mime) 481void OFileSelector::slotMimeCheck(const QString &mime)
489{ 482{
490 if( m_selector == NORMAL ){ 483 if( m_selector == NORMAL ){
491 //if( m_autoMime ){ 484 //if( m_autoMime ){
492 QString newMimeType; 485 QString newMimeType;
493 if (mime != tr("All") ) { 486 if (mime != tr("All") ) {
494 QMap<QString, QStringList>::Iterator it; 487 QMap<QString, QStringList>::Iterator it;
495 it = m_mimetypes.find(mime); 488 it = m_mimetypes.find(mime);
496 if ( it != m_mimetypes.end() ) { 489 if ( it != m_mimetypes.end() ) {
497 newMimeType = it.data().join(";"); 490 newMimeType = it.data().join(";");
498 }else{ 491 }else{
499 newMimeType = mime; 492 newMimeType = mime;
500 } 493 }
501 } 494 }
502 delete m_select; 495 delete m_select;
503 m_select = new FileSelector( newMimeType, 496 m_select = new FileSelector( newMimeType,
504 m_stack, "fileselector", 497 m_stack, "fileselector",
505 m_shNew, m_shClose); 498 m_shNew, m_shClose);
506 499
507 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 500 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
508 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 501 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
509 connect(m_select, SIGNAL(closeMe() ), 502 connect(m_select, SIGNAL(closeMe() ),
510 this, SIGNAL(closeMe() ) ); 503 this, SIGNAL(closeMe() ) );
511 //connect to close me and other signals as well 504 //connect to close me and other signals as well
512 m_stack->addWidget( m_select, NORMAL ); 505 m_stack->addWidget( m_select, NORMAL );
513 m_stack->raiseWidget( NORMAL ); 506 m_stack->raiseWidget( NORMAL );
514 updateMimes(); 507 updateMimes();
515 updateMimeCheck(); 508 updateMimeCheck();
516 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 509 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
517 //} 510 //}
518 }else{ // others 511 }else{ // others
519 qWarning("Mime %s", mime.latin1() ); 512 qWarning("Mime %s", mime.latin1() );
520 if(m_shChooser ){ 513 if(m_shChooser ){
521 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); 514 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
522 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 515 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
523 } 516 }
524 reparse(); 517 reparse();
525 } 518 }
526 519
527} 520}
528/* 521/*
529 * Ok if a non dir gets inserted into this combobox 522 * Ok if a non dir gets inserted into this combobox
530 * we need to change it 523 * we need to change it
531 * QFileInfo and dirPath will give us the right Dir 524 * QFileInfo and dirPath will give us the right Dir
532 */ 525 */
533void OFileSelector::slotLocationActivated(const QString &file) 526void OFileSelector::slotLocationActivated(const QString &file)
534{ 527{
535 qWarning("slotLocationActivated"); 528 qWarning("slotLocationActivated");
536 QString name = file.left( file.find("<-", 0, TRUE ) ); 529 QString name = file.left( file.find("<-", 0, TRUE ) );
537 QFileInfo info( name ); 530 QFileInfo info( name );
538 if ( info.isFile() ) 531 if ( info.isFile() )
539 cd(info.dirPath( TRUE ) ); //absolute 532 cd(info.dirPath( TRUE ) ); //absolute
540 else 533 else
541 cd(name ); 534 cd(name );
542 reparse(); 535 reparse();
543} 536}
544void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count) 537void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count)
545{ 538{
546 QStringList pathList; 539 QStringList pathList;
547 bool underDog = FALSE; 540 bool underDog = FALSE;
548 for(int i=0;i<count;i++) { 541 for(int i=0;i<count;i++) {
549 pathList << m_location->text(i); 542 pathList << m_location->text(i);
550 if( m_location->text(i) == currentPath) 543 if( m_location->text(i) == currentPath)
551 underDog = TRUE; 544 underDog = TRUE;
552 } 545 }
553 if( !underDog) { 546 if( !underDog) {
554 m_location->clear(); 547 m_location->clear();
555 if( currentPath.left(2)=="//") 548 if( currentPath.left(2)=="//")
556 pathList.append( currentPath.right(currentPath.length()-1) ); 549 pathList.append( currentPath.right(currentPath.length()-1) );
557 else 550 else
558 pathList.append( currentPath ); 551 pathList.append( currentPath );
559 m_location->insertStringList( pathList,-1); 552 m_location->insertStringList( pathList,-1);
560 } 553 }
561} 554}
562/* 555/*
563 * Do not crash anymore 556 * Do not crash anymore
564 * don't try to change dir to a file 557 * don't try to change dir to a file
565 */ 558 */
566void OFileSelector::locationComboChanged() 559void OFileSelector::locationComboChanged()
567{ 560{
568 QFileInfo info( m_location->lineEdit()->text() ); 561 QFileInfo info( m_location->lineEdit()->text() );
569 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() ); 562 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() );
570 if (info.isFile() ) 563 if (info.isFile() )
571 cd(info.dirPath(TRUE) ); //absolute path 564 cd(info.dirPath(TRUE) ); //absolute path
572 else 565 else
573 cd( m_location->lineEdit()->text() ); 566 cd( m_location->lineEdit()->text() );
574 567
575 reparse(); 568 reparse();
576} 569}
577void OFileSelector::init() 570void OFileSelector::init()
578{ 571{
579 m_lay = new QVBoxLayout( this ); 572 m_lay = new QVBoxLayout( this );
580 m_lay->setSpacing(0 ); 573 m_lay->setSpacing(0 );
581 574
582 m_stack = new QWidgetStack( this ); 575 m_stack = new QWidgetStack( this );
583 if( m_selector == NORMAL ){ 576 if( m_selector == NORMAL ){
584 QString mime; 577 QString mime;
585 if (!m_autoMime) { 578 if (!m_autoMime) {
586 if (!m_mimetypes.isEmpty() ) { 579 if (!m_mimetypes.isEmpty() ) {
587 QMap<QString, QStringList>::Iterator it; 580 QMap<QString, QStringList>::Iterator it;
588 it = m_mimetypes.begin(); // cause we're in the init 581 it = m_mimetypes.begin(); // cause we're in the init
589 mime = it.data().join(";"); 582 mime = it.data().join(";");
590 } 583 }
591 } 584 }
592 m_select = new FileSelector(mime, 585 m_select = new FileSelector(mime,
593 m_stack, "fileselector", 586 m_stack, "fileselector",
594 m_shNew, m_shClose); 587 m_shNew, m_shClose);
595 588
596 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 589 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
597 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 590 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
598 connect(m_select, SIGNAL(closeMe() ), 591 connect(m_select, SIGNAL(closeMe() ),
599 this, SIGNAL( closeMe() ) ); 592 this, SIGNAL( closeMe() ) );
600 //connect to close me and other signals as well 593 //connect to close me and other signals as well
601 594
602 m_stack->addWidget( m_select, NORMAL ); 595 m_stack->addWidget( m_select, NORMAL );
603 m_stack->raiseWidget( NORMAL ); 596 m_stack->raiseWidget( NORMAL );
604 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL 597 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
605 // and initializeListview will take care of those 598 // and initializeListview will take care of those
606 // toolbar get's generade in initializeListView 599 // toolbar get's generade in initializeListView
607 initializeListView( ); // will raise the widget as well 600 initializeListView( ); // will raise the widget as well
608 m_stack->raiseWidget( EXTENDED ); 601 m_stack->raiseWidget( EXTENDED );
609 } 602 }
610 m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch 603 m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch
611 604
612 if( m_shLne ) // the LineEdit with the current FileName 605 if( m_shLne ) // the LineEdit with the current FileName
613 initializeName(); 606 initializeName();
614 607
615 if( m_shPerm ) // the Permission QCheckBox 608 if( m_shPerm ) // the Permission QCheckBox
616 initializePerm(); 609 initializePerm();
617 610
618 if( m_shChooser ) // the Chooser for the view and Mimetypes 611 if( m_shChooser ) // the Chooser for the view and Mimetypes
619 initializeChooser(); 612 initializeChooser();
620 613
621 if( m_shYesNo ) // the Yes No button row 614 if( m_shYesNo ) // the Yes No button row
622 initializeYes( ); 615 initializeYes( );
623 616
624 if (m_selector != NORMAL ) 617 if (m_selector != NORMAL )
625 reparse(); 618 reparse();
626} 619}
627void OFileSelector::updateMimes() 620void OFileSelector::updateMimes()
628{ 621{
629 if( m_autoMime ){ 622 if( m_autoMime ){
630 m_mimetypes.clear(); 623 m_mimetypes.clear();
631 m_mimetypes.insert( tr("All"), QString::null ); 624 m_mimetypes.insert( tr("All"), QString::null );
632 if( m_selector == NORMAL ){ 625 if( m_selector == NORMAL ){
633 DocLnkSet set; 626 DocLnkSet set;
634 Global::findDocuments(&set, QString::null ); 627 Global::findDocuments(&set, QString::null );
635 QListIterator<DocLnk> dit( set.children() ); 628 QListIterator<DocLnk> dit( set.children() );
636 for( ; dit.current(); ++dit ){ 629 for( ; dit.current(); ++dit ){
637 if( !m_mimetypes.contains( (*dit)->type() ) ) 630 if( !m_mimetypes.contains( (*dit)->type() ) )
638 m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); 631 m_mimetypes.insert( (*dit)->type(), (*dit)->type() );
639 } 632 }
640 }// else done in reparse 633 }// else done in reparse
641 } 634 }
642} 635}
643void OFileSelector::initVars() 636void OFileSelector::initVars()
644{ 637{
645 if( m_mimetypes.isEmpty() ) 638 if( m_mimetypes.isEmpty() )
646 m_autoMime = true; 639 m_autoMime = true;
647 else 640 else
648 m_autoMime = false; 641 m_autoMime = false;
649 m_shClose = false; 642 m_shClose = false;
650 m_shNew = false; 643 m_shNew = false;
651 m_shTool = true; 644 m_shTool = true;
652 m_shPerm = false; 645 m_shPerm = false;
653 m_shLne = true; 646 m_shLne = true;
654 m_shChooser = true; 647 m_shChooser = true;
655 m_shYesNo = true; 648 m_shYesNo = true;
656 m_case = false; 649 m_case = false;
657 m_dir = true; 650 m_dir = true;
658 m_files = true; 651 m_files = true;
659 m_showPopup = false; 652 m_showPopup = false;
660 if(m_pixmaps == 0 ) // init the pixmaps 653 if(m_pixmaps == 0 ) // init the pixmaps
661 initPics(); 654 initPics();
662 655
663 // pointers 656 // pointers
664 m_location = 0; 657 m_location = 0;
665 m_mimeCheck = 0; 658 m_mimeCheck = 0;
666 m_viewCheck = 0; 659 m_viewCheck = 0;
667 m_homeButton = 0; 660 m_homeButton = 0;
668 m_docButton = 0; 661 m_docButton = 0;
669 m_hideButton = 0; 662 m_hideButton = 0;
670 m_ok = 0; 663 m_ok = 0;
671 m_cancel = 0; 664 m_cancel = 0;
672 m_reread = 0; 665 m_reread = 0;
673 m_up = 0; 666 m_up = 0;
674 m_View = 0; 667 m_View = 0;
675 m_checkPerm = 0; 668 m_checkPerm = 0;
676 m_pseudo = 0; 669 m_pseudo = 0;
677 m_pseudoLayout = 0; 670 m_pseudoLayout = 0;
678 m_select = 0; 671 m_select = 0;
679 m_stack = 0; 672 m_stack = 0;
680 m_lay = 0; 673 m_lay = 0;
681 m_Oselector = 0; 674 m_Oselector = 0;
682 m_boxToolbar = 0; 675 m_boxToolbar = 0;
683 m_boxOk = 0; 676 m_boxOk = 0;
684 m_boxName = 0; 677 m_boxName = 0;
685 m_boxView = 0; 678 m_boxView = 0;
686 m_custom = 0; 679 m_custom = 0;
687 m_edit = 0; 680 m_edit = 0;
688 m_fnLabel = 0; 681 m_fnLabel = 0;
689 m_new = 0; 682 m_new = 0;
690 m_close = 0; 683 m_close = 0;
691} 684}
692void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) 685void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink)
693{ 686{
694 if(!m_files) 687 if(!m_files)
695 return; 688 return;
696 // if( !compliesMime(info->absFilePath(), mime ) ) 689 // if( !compliesMime(info->absFilePath(), mime ) )
697 // return; 690 // return;
698 MimeType type( info->absFilePath() ); 691 MimeType type( info->absFilePath() );
699 if (!compliesMime( type.id() ) ) 692 if (!compliesMime( type.id() ) )
700 return; 693 return;
701 694
702 QPixmap pix = type.pixmap(); 695 QPixmap pix = type.pixmap();
703 QString dir; 696 QString dir;
704 QString name; 697 QString name;
705 bool locked; 698 bool locked;
706 if( pix.isNull() ) 699 if( pix.isNull() )
707 pix = Resource::loadPixmap( "UnknownDocument-14"); 700 pix = Resource::loadPixmap( "UnknownDocument-14");
708 dir = info->dirPath( true ); 701 dir = info->dirPath( true );
709 if( symlink ) 702 if( symlink )
710 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); 703 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink();
711 else { 704 else {
712 name = info->fileName(); 705 name = info->fileName();
713 if( ( m_mode == OPEN && !info->isReadable() )|| 706 if( ( m_mode == OPEN && !info->isReadable() )||
714 ( m_mode == SAVE && !info->isWritable() ) ){ 707 ( m_mode == SAVE && !info->isWritable() ) ){
715 708
716 locked = true; pix = Resource::loadPixmap("locked"); 709 locked = true; pix = Resource::loadPixmap("locked");
717 } 710 }
718 } 711 }
719 new OFileSelectorItem( m_View, pix, name, 712 new OFileSelectorItem( m_View, pix, name,
720 info->lastModified().toString(), 713 info->lastModified().toString(),
721 QString::number( info->size() ), 714 QString::number( info->size() ),
722 dir, locked ); 715 dir, locked );
723} 716}
724void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 717void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
725{ 718{
726 if(!m_dir) 719 if(!m_dir)
727 return; 720 return;
728 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ 721 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){
729 bool locked = false; 722 bool locked = false;
730 QString name; 723 QString name;
731 QPixmap pix; 724 QPixmap pix;
732 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 725 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
733 locked = true; 726 locked = true;
734 if( symlink ) 727 if( symlink )
735 pix = (*m_pixmaps)["symlinkedlocked"]; 728 pix = (*m_pixmaps)["symlinkedlocked"];
736 else 729 else
737 pix = Resource::loadPixmap("lockedfolder"); 730 pix = Resource::loadPixmap("lockedfolder");
738 }else { // readable 731 }else { // readable
739 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; 732 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ;
740 } 733 }
741 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; 734 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ;
742 new OFileSelectorItem( m_View, pix, name, 735 new OFileSelectorItem( m_View, pix, name,
743 info->lastModified().toString(), 736 info->lastModified().toString(),
744 QString::number( info->size() ), 737 QString::number( info->size() ),
745 info->dirPath( true ), locked, 738 info->dirPath( true ), locked,
746 true ); 739 true );
747 740
748 }// else CUSTOM View 741 }// else CUSTOM View
749} 742}
750void OFileSelector::delItems() 743void OFileSelector::delItems()
751{ 744{
752 745
753} 746}
754void OFileSelector::initializeName() 747void OFileSelector::initializeName()
755{ 748{
756 /** Name Layout Line 749 /** Name Layout Line
757 * This is the Layout line arranged in 750 * This is the Layout line arranged in
758 * horizontal way each components 751 * horizontal way each components
759 * are next to each other 752 * are next to each other
760 * but we will only do this if 753 * but we will only do this if
761 * we didn't initialize a while ago. 754 * we didn't initialize a while ago.
762 */ 755 */
763 if( m_boxName == 0 ){ 756 if( m_boxName == 0 ){
764 m_boxName = new QHBox( this ); // remove this this? or use a QHBox 757 m_boxName = new QHBox( this ); // remove this this? or use a QHBox
765 m_fnLabel = new QLabel( m_boxName ); 758 m_fnLabel = new QLabel( m_boxName );
766 m_fnLabel->setText( tr("Name:") ); 759 m_fnLabel->setText( tr("Name:") );
767 m_edit = new QLineEdit( m_boxName ); 760 m_edit = new QLineEdit( m_boxName );
768 m_edit->setText( m_name ); 761 m_edit->setText( m_name );
769 //m_boxName->addWidget( m_fnLabel ); 762 //m_boxName->addWidget( m_fnLabel );
770 m_boxName->setMargin( 5 ); 763 m_boxName->setMargin( 5 );
771 m_boxName->setSpacing( 8 ); 764 m_boxName->setSpacing( 8 );
772 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor 765 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor
773 766
774 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout 767 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout
775 }// else we already initialized 768 }// else we already initialized
776 // maybe show the components? 769 // maybe show the components?
777 // 770 //
778} 771}
779void OFileSelector::initializeYes() 772void OFileSelector::initializeYes()
780{ 773{
781 /** The Save Cancel bar 774 /** The Save Cancel bar
782 * 775 *
783 */ 776 */
784 if( m_boxOk == 0 ){ 777 if( m_boxOk == 0 ){
785 m_boxOk = new QHBox( this ); 778 m_boxOk = new QHBox( this );
786 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); 779 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" );
787 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); 780 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" );
788 781
789 //m_boxOk->addWidget( m_ok ); 782 //m_boxOk->addWidget( m_ok );
790 //m_boxOk->addWidget( m_cancel ); 783 //m_boxOk->addWidget( m_cancel );
791 m_boxOk->setMargin( 5 ); 784 m_boxOk->setMargin( 5 );
792 m_boxOk->setSpacing( 10 ); 785 m_boxOk->setSpacing( 10 );
793 m_lay->addWidget( m_boxOk, 0 ); 786 m_lay->addWidget( m_boxOk, 0 );
794 787
795 connect( m_ok, SIGNAL( clicked() ), 788 connect( m_ok, SIGNAL( clicked() ),
796 this, SLOT(slotOk() ) ); 789 this, SLOT(slotOk() ) );
797 connect( m_cancel, SIGNAL( clicked() ), 790 connect( m_cancel, SIGNAL( clicked() ),
798 this, SLOT( slotCancel() ) ); 791 this, SLOT( slotCancel() ) );
799 } 792 }
800} 793}
801/* 794/*
802 * OK m_mimeCheck is a QComboBox we now want to fill 795 * OK m_mimeCheck is a QComboBox we now want to fill
803 * out that combobox 796 * out that combobox
804 * if automime we need to update the mimetypes 797 * if automime we need to update the mimetypes
805 */ 798 */
806void OFileSelector::updateMimeCheck() { 799void OFileSelector::updateMimeCheck() {
807 m_mimeCheck->clear(); 800 m_mimeCheck->clear();
808 if (m_autoMime ) { 801 if (m_autoMime ) {
809 //m_mimeCheck->insertItem( tr("All") ); 802 //m_mimeCheck->insertItem( tr("All") );
810 updateMimes(); 803 updateMimes();
811 } 804 }
812 805
813 QMap<QString, QStringList>::Iterator it; 806 QMap<QString, QStringList>::Iterator it;
814 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { 807 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) {
815 m_mimeCheck->insertItem( it.key() ); 808 m_mimeCheck->insertItem( it.key() );
816 } 809 }
817} 810}
818 811
819void OFileSelector::initializeChooser() 812void OFileSelector::initializeChooser()
820{ 813{
821 if( m_boxView == 0 ){ 814 if( m_boxView == 0 ){
822 m_boxView = new QHBox( this ); 815 m_boxView = new QHBox( this );
823 m_viewCheck = new QComboBox( m_boxView, "view check"); 816 m_viewCheck = new QComboBox( m_boxView, "view check");
824 m_mimeCheck = new QComboBox( m_boxView, "mime check"); 817 m_mimeCheck = new QComboBox( m_boxView, "mime check");
825 m_boxView->setSpacing( 8 ); 818 m_boxView->setSpacing( 8 );
826 m_lay->addWidget(m_boxView, 0 ); 819 m_lay->addWidget(m_boxView, 0 );
827 820
828 m_viewCheck->insertItem( tr("Documents") ); 821 m_viewCheck->insertItem( tr("Documents") );
829 m_viewCheck->insertItem( tr("Files") ); 822 m_viewCheck->insertItem( tr("Files") );
830 m_viewCheck->insertItem( tr("All Files") ); 823 m_viewCheck->insertItem( tr("All Files") );
831 updateMimeCheck(); 824 updateMimeCheck();
832 825
833 connect( m_viewCheck, SIGNAL( activated(const QString & ) ), 826 connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
834 this, SLOT( slotViewCheck(const QString & ) ) ); 827 this, SLOT( slotViewCheck(const QString & ) ) );
835 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), 828 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ),
836 this, SLOT( slotMimeCheck( const QString & ) ) ); 829 this, SLOT( slotMimeCheck( const QString & ) ) );
837 } 830 }
838} 831}
839void OFileSelector::initializeListView() 832void OFileSelector::initializeListView()
840{ 833{
841 qWarning("initializeListView"); 834 qWarning("initializeListView");
842 if( m_pseudo == 0 ){ 835 if( m_pseudo == 0 ){
843 qWarning("init"); 836 qWarning("init");
844 m_pseudo = new QWidget( m_stack, "Pseudo Widget"); 837 m_pseudo = new QWidget( m_stack, "Pseudo Widget");
845 m_pseudoLayout = new QVBoxLayout( m_pseudo ); 838 m_pseudoLayout = new QVBoxLayout( m_pseudo );
846 // toolbar 839 // toolbar
847 m_boxToolbar = new QHBox( m_pseudo ); 840 m_boxToolbar = new QHBox( m_pseudo );
848 m_boxToolbar->setSpacing(0 ); // next to each other please 841 m_boxToolbar->setSpacing(0 ); // next to each other please
849 842
850 // toolbar members 843 // toolbar members
851 { 844 {
852 // location QComboBox 845 // location QComboBox
853 m_location = new QComboBox( m_boxToolbar ); 846 m_location = new QComboBox( m_boxToolbar );
854 m_location->setEditable( TRUE ); 847 m_location->setEditable( TRUE );
855 m_location->setDuplicatesEnabled( FALSE ); 848 m_location->setDuplicatesEnabled( FALSE );
856 connect( m_location, SIGNAL(activated(const QString &) ), 849 connect( m_location, SIGNAL(activated(const QString &) ),
857 this, SLOT( slotLocationActivated(const QString &) ) ); 850 this, SLOT( slotLocationActivated(const QString &) ) );
858 connect( m_location->lineEdit(), SIGNAL(returnPressed() ), 851 connect( m_location->lineEdit(), SIGNAL(returnPressed() ),
859 this, SLOT(locationComboChanged() ) ); 852 this, SLOT(locationComboChanged() ) );
860 // UP Button 853 // UP Button
861 m_up = new QPushButton(Resource::loadIconSet("up"),"", 854 m_up = new QPushButton(Resource::loadIconSet("up"),"",
862 m_boxToolbar,"cdUpButton"); 855 m_boxToolbar,"cdUpButton");
863 m_up->setFixedSize( QSize( 20, 20 ) ); 856 m_up->setFixedSize( QSize( 20, 20 ) );
864 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 857 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
865 m_up->setFlat(TRUE); 858 m_up->setFlat(TRUE);
866 859
867 // Home Button 860 // Home Button
868 m_homeButton = new QPushButton(Resource::loadIconSet("home") , 861 m_homeButton = new QPushButton(Resource::loadIconSet("home") ,
869 "", m_boxToolbar); 862 "", m_boxToolbar);
870 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 863 m_homeButton->setFixedSize( QSize( 20, 20 ) );
871 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 864 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
872 m_homeButton->setFlat(TRUE); 865 m_homeButton->setFlat(TRUE);
873 // Documents Button 866 // Documents Button
874 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", 867 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",
875 m_boxToolbar,"docsButton"); 868 m_boxToolbar,"docsButton");
876 m_docButton->setFixedSize( QSize( 20, 20 ) ); 869 m_docButton->setFixedSize( QSize( 20, 20 ) );
877 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 870 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
878 m_docButton->setFlat(TRUE); 871 m_docButton->setFlat(TRUE);
879 872
880 // Close button 873 // Close button
881 m_close = new QPushButton( Resource::loadIconSet( "close"), "", 874 m_close = new QPushButton( Resource::loadIconSet( "close"), "",
882 m_boxToolbar ); 875 m_boxToolbar );
883 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); 876 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) );
884 m_close->setFixedSize( 20, 20 ); 877 m_close->setFixedSize( 20, 20 );
885 878
886 m_boxToolbar->setFixedHeight( 20 ); 879 m_boxToolbar->setFixedHeight( 20 );
887 m_pseudoLayout->addWidget(m_boxToolbar ); 880 m_pseudoLayout->addWidget(m_boxToolbar );
888 881
889 // let;s fill the Location ComboBox 882 // let;s fill the Location ComboBox
890 StorageInfo storage; 883 StorageInfo storage;
891 const QList<FileSystem> &fs = storage.fileSystems(); 884 const QList<FileSystem> &fs = storage.fileSystems();
892 QListIterator<FileSystem> it ( fs ); 885 QListIterator<FileSystem> it ( fs );
893 for( ; it.current(); ++it ){ 886 for( ; it.current(); ++it ){
894 const QString disk = (*it)->name(); 887 const QString disk = (*it)->name();
895 const QString path = (*it)->path(); 888 const QString path = (*it)->path();
896 m_location->insertItem(path+ "<-"+disk ); 889 m_location->insertItem(path+ "<-"+disk );
897 } 890 }
898 int count = m_location->count(); 891 int count = m_location->count();
899 m_location->insertItem( m_currentDir ); 892 m_location->insertItem( m_currentDir );
900 m_location->setCurrentItem( count ); 893 m_location->setCurrentItem( count );
901 // due to the New and Close button we can not simply hide m_boxToolBar to not show it 894 // due to the New and Close button we can not simply hide m_boxToolBar to not show it
902 if( !m_shTool ){ 895 if( !m_shTool ){
903 m_location->hide( ); 896 m_location->hide( );
904 m_up->hide( ); 897 m_up->hide( );
905 m_homeButton->hide( ); 898 m_homeButton->hide( );
906 m_docButton->hide( ); 899 m_docButton->hide( );
907 } 900 }
908 if(!m_shClose ) 901 if(!m_shClose )
909 m_close->hide(); 902 m_close->hide();
910 //if(!m_shNew) 903 //if(!m_shNew)
911 //m_close->hide(); 904 //m_close->hide();
912 905
913 } // off toolbar 906 } // off toolbar
914 // the Main ListView 907 // the Main ListView
915 // make a QWidgetStack first so Views can share the Toolbar 908 // make a QWidgetStack first so Views can share the Toolbar
916 m_View = new QListView( m_pseudo, "Extended view"); 909 m_View = new QListView( m_pseudo, "Extended view");
917 QPEApplication::setStylusOperation( m_View->viewport(), 910 QPEApplication::setStylusOperation( m_View->viewport(),
918 QPEApplication::RightOnHold); 911 QPEApplication::RightOnHold);
919 m_View->addColumn(" " ); 912 m_View->addColumn(" " );
920 m_View->addColumn(tr("Name"), 135 ); 913 m_View->addColumn(tr("Name"), 135 );
921 m_View->addColumn(tr("Size"), -1 ); 914 m_View->addColumn(tr("Size"), -1 );
922 m_View->addColumn(tr("Date"), 60 ); 915 m_View->addColumn(tr("Date"), 60 );
923 m_View->addColumn(tr("Mime Type"), -1 ); 916 m_View->addColumn(tr("Mime Type"), -1 );
924 QHeader *header = m_View->header(); 917 QHeader *header = m_View->header();
925 header->hide(); 918 header->hide();
926 m_View->setSorting( 1 ); 919 m_View->setSorting( 1 );
927 m_View->setAllColumnsShowFocus( TRUE ); 920 m_View->setAllColumnsShowFocus( TRUE );
928 921
929 connect(m_View, SIGNAL(selectionChanged() ), 922 connect(m_View, SIGNAL(selectionChanged() ),
930 this, SLOT(slotSelectionChanged() ) ); 923 this, SLOT(slotSelectionChanged() ) );
931 924
932 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), 925 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ),
933 this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 926 this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
934 927
935 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 928 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
936 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 929 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
937 930
938 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 931 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
939 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 932 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
940 933
941 m_pseudoLayout->addWidget( m_View, 288 ); 934 m_pseudoLayout->addWidget( m_View, 288 );
942 m_stack->addWidget( m_pseudo, EXTENDED ); 935 m_stack->addWidget( m_pseudo, EXTENDED );
943 } 936 }
944} 937}
945void OFileSelector::initializePerm() 938void OFileSelector::initializePerm()
946{ 939{
947 if( m_checkPerm == 0 ){ 940 if( m_checkPerm == 0 ){
948 m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); 941 m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm");
949 m_checkPerm->setChecked( false ); 942 m_checkPerm->setChecked( false );
950 m_lay->addWidget( m_checkPerm ); 943 m_lay->addWidget( m_checkPerm );
951 944
952 } 945 }
953} 946}
954void OFileSelector::initPics() 947void OFileSelector::initPics()
955{ 948{
956 m_pixmaps = new QMap<QString,QPixmap>; 949 m_pixmaps = new QMap<QString,QPixmap>;
957 QPixmap pm = Resource::loadPixmap( "folder" ); 950 QPixmap pm = Resource::loadPixmap( "folder" );
958 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 951 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
959 QPainter painter( &pm ); 952 QPainter painter( &pm );
960 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 953 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
961 pm.setMask( pm.createHeuristicMask( FALSE ) ); 954 pm.setMask( pm.createHeuristicMask( FALSE ) );
962 m_pixmaps->insert("dirsymlink", pm ); 955 m_pixmaps->insert("dirsymlink", pm );
963 956
964 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 957 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
965 QPainter pen(&pm2 ); 958 QPainter pen(&pm2 );
966 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 959 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
967 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 960 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
968 m_pixmaps->insert("symlinkedlocked", pm2 ); 961 m_pixmaps->insert("symlinkedlocked", pm2 );
969} 962}
970// if a mime complies with the m_mimeCheck->currentItem 963// if a mime complies with the m_mimeCheck->currentItem
971bool OFileSelector::compliesMime( const QString &path, const QString &mime ) 964bool OFileSelector::compliesMime( const QString &path, const QString &mime )
972{ 965{
973 if( mime == "All" ) 966 if( mime == "All" )
974 return true; 967 return true;
975 MimeType type( path ); 968 MimeType type( path );
976 if( type.id() == mime ) 969 if( type.id() == mime )
977 return true; 970 return true;
978 return false; 971 return false;
979} 972}
980/* check if the mimetype in mime 973/* check if the mimetype in mime
981 * complies with the one which is current 974 * complies with the one which is current
982 */ 975 */
983/* 976/*
984 * We've the mimetype of the file 977 * We've the mimetype of the file
985 * We need to get the stringlist of the current mimetype 978 * We need to get the stringlist of the current mimetype
986 * 979 *
987 * mime = image/jpeg 980 * mime = image/jpeg
988 * QStringList = 'image/*' 981 * QStringList = 'image/*'
989 * or QStringList = image/jpeg;image/png;application/x-ogg 982 * or QStringList = image/jpeg;image/png;application/x-ogg
990 * or QStringList = application/x-ogg;image/*; 983 * or QStringList = application/x-ogg;image/*;
991 * with all these mime filters it should get acceptes 984 * with all these mime filters it should get acceptes
992 * to do so we need to look if mime is contained inside 985 * to do so we need to look if mime is contained inside
993 * the stringlist 986 * the stringlist
994 * if it's contained return true 987 * if it's contained return true
995 * if not ( I'm no RegExp expert at all ) we'll look if a '/*' 988 * if not ( I'm no RegExp expert at all ) we'll look if a '/*'
996 * is contained in the mimefilter and then we will 989 * is contained in the mimefilter and then we will
997 * look if both are equal until the '/' 990 * look if both are equal until the '/'
998 */ 991 */
999bool OFileSelector::compliesMime( const QString& mime ) { 992bool OFileSelector::compliesMime( const QString& mime ) {
1000 qWarning("mimetype is %s", mime.latin1() ); 993 qWarning("mimetype is %s", mime.latin1() );
1001 QString currentText; 994 QString currentText;
1002 if (m_shChooser ) 995 if (m_shChooser )
1003 currentText = m_mimeCheck->currentText(); 996 currentText = m_mimeCheck->currentText();
1004 997
1005 qWarning("current text is %s", currentText.latin1() ); 998 qWarning("current text is %s", currentText.latin1() );
1006 QMap<QString, QStringList>::Iterator it; 999 QMap<QString, QStringList>::Iterator it;
1007 QStringList list; 1000 QStringList list;
1008 if ( currentText == tr("All") ) return true; 1001 if ( currentText == tr("All") ) return true;
1009 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { 1002 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) {
1010 it = m_mimetypes.begin(); 1003 it = m_mimetypes.begin();
1011 list = it.data(); 1004 list = it.data();
1012 }else if ( currentText.isEmpty() ) return true; 1005 }else if ( currentText.isEmpty() ) return true;
1013 else{ 1006 else{
1014 it = m_mimetypes.find(currentText ); 1007 it = m_mimetypes.find(currentText );
1015 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; 1008 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText;
1016 else qWarning("found"), list = it.data(); 1009 else qWarning("found"), list = it.data();
1017 } 1010 }
1018 // dump it now 1011 // dump it now
1019 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 1012 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
1020 // qWarning( "%s", (*it).latin1() ); 1013 // qWarning( "%s", (*it).latin1() );
1021 //} 1014 //}
1022 1015
1023 1016
1024 if ( list.contains(mime) ) return true; 1017 if ( list.contains(mime) ) return true;
1025 qWarning("list doesn't contain it "); 1018 qWarning("list doesn't contain it ");
1026 QStringList::Iterator it2; 1019 QStringList::Iterator it2;
1027 int pos; 1020 int pos;
1028 int pos2; 1021 int pos2;
1029 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { 1022 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) {
1030 pos = (*it2).findRev("/*"); 1023 pos = (*it2).findRev("/*");
1031 if ( pos >= 0 ) { 1024 if ( pos >= 0 ) {
1032 if ( mime.contains( (*it2).left(pos) ) ) return true; 1025 if ( mime.contains( (*it2).left(pos) ) ) return true;
1033 } 1026 }
1034 } 1027 }
1035 return false; 1028 return false;
1036} 1029}
1037void OFileSelector::slotFileSelected( const QString &string ) 1030void OFileSelector::slotFileSelected( const QString &string )
1038{ 1031{
1039 if( m_shLne ) 1032 if( m_shLne )
1040 m_edit->setText( string ); 1033 m_edit->setText( string );
1041 emit fileSelected( string ); 1034 emit fileSelected( string );
1042} 1035}
1043void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 1036void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
1044{ 1037{
1045 slotFileSelected( lnk.name() ); 1038 slotFileSelected( lnk.name() );
1046 // emit fileSelected( lnk ); 1039 // emit fileSelected( lnk );
1047} 1040}
1048void OFileSelector::slotSelectionChanged() 1041void OFileSelector::slotSelectionChanged()
1049{ 1042{
1050 1043
1051} 1044}
1052void OFileSelector::slotCurrentChanged(QListViewItem* item ) 1045void OFileSelector::slotCurrentChanged(QListViewItem* item )
1053{ 1046{
1054 if( item == 0 ) 1047 if( item == 0 )
1055 return; 1048 return;
1056 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 1049 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
1057 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 1050 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
1058 qWarning("current changed"); 1051 qWarning("current changed");
1059 if(!sel->isDir() ){ 1052 if(!sel->isDir() ){
1060 if( m_shLne ) 1053 if( m_shLne )
1061 m_edit->setText( sel->text(1) ); 1054 m_edit->setText( sel->text(1) );
1062 1055
1063 if (m_mode == FILESELECTOR ) { 1056 if (m_mode == FILESELECTOR ) {
1064 QStringList str = QStringList::split("->", sel->text(1) ); 1057 QStringList str = QStringList::split("->", sel->text(1) );
1065 QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); 1058 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
1066 emit fileSelected(path ); 1059 emit fileSelected(path );
1067 DocLnk lnk( path ); 1060 DocLnk lnk( path );
1068 emit fileSelected(lnk ); 1061 emit fileSelected(lnk );
1069 } 1062 }
1070 } 1063 }
1071 } 1064 }
1072} 1065}
1073void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 1066void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
1074{ 1067{
1075 if ( item == 0 ) 1068 if ( item == 0 )
1076 return; 1069 return;
1077 1070
1078 if( button != Qt::LeftButton ) 1071 if( button != Qt::LeftButton )
1079 return; 1072 return;
1080 1073
1081 switch( m_selector ){ 1074 switch( m_selector ){
1082 default: 1075 default:
1083 break; 1076 break;
1084 case EXTENDED: // fall through 1077 case EXTENDED: // fall through
1085 case EXTENDED_ALL:{ 1078 case EXTENDED_ALL:{
1086 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1079 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1087 if(!sel->isLocked() ){ 1080 if(!sel->isLocked() ){
1088 QStringList str = QStringList::split("->", sel->text(1) ); 1081 QStringList str = QStringList::split("->", sel->text(1) );
1089 if( sel->isDir() ){ 1082 if( sel->isDir() ){
1090 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1083 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1091 // if MODE Dir m_shLne set the Text 1084 // if MODE Dir m_shLne set the Text
1092 }else{ 1085 }else{
1093 if( m_shLne ) 1086 if( m_shLne )
1094 m_edit->setText( str[0].stripWhiteSpace() ); 1087 m_edit->setText( str[0].stripWhiteSpace() );
1095 qWarning("selected here in slot clicked"); 1088 qWarning("selected here in slot clicked");
1096 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1089 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
1097 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1090 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1098 qWarning("file selected"); 1091 qWarning("file selected");
1099 emit fileSelected( lnk ); 1092 emit fileSelected( lnk );
1100 } 1093 }
1101 } 1094 }
1102 break; 1095 break;
1103 } 1096 }
1104 } 1097 }
1105} 1098}
1106void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1099void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1107{ 1100{
1108 if( item == 0 ) 1101 if( item == 0 )
1109 return; 1102 return;
1110 1103
1111 if( button != Qt::RightButton ) 1104 if( button != Qt::RightButton )
1112 return; 1105 return;
1113 slotContextMenu( item ); 1106 slotContextMenu( item );
1114} 1107}
1115void OFileSelector::slotContextMenu( QListViewItem *item) 1108void OFileSelector::slotContextMenu( QListViewItem *item)
1116{ 1109{
1117 1110
1118} 1111}
1119void OFileSelector::slotChangedDir() 1112void OFileSelector::slotChangedDir()
1120{ 1113{
1121 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1114 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1122 if(sel->isDir() ){ 1115 if(sel->isDir() ){
1123 QStringList str = QStringList::split("->", sel->text(1) ); 1116 QStringList str = QStringList::split("->", sel->text(1) );
1124 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1117 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1125 } 1118 }
1126} 1119}
1127void OFileSelector::slotOpen() 1120void OFileSelector::slotOpen()
1128{ 1121{
1129 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1122 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1130 if(!sel->isDir() ){ 1123 if(!sel->isDir() ){
1131 QStringList str = QStringList::split("->", sel->text(1) ); 1124 QStringList str = QStringList::split("->", sel->text(1) );
1132 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 1125 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
1133 qWarning("slot open"); 1126 qWarning("slot open");
1134 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1127 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1135 //emit fileSelected( lnk ); 1128 //emit fileSelected( lnk );
1136 } 1129 }
1137} 1130}
1138void OFileSelector::slotRescan() 1131void OFileSelector::slotRescan()
1139{ 1132{
1140 1133
1141} 1134}
1142void OFileSelector::slotRename() 1135void OFileSelector::slotRename()
1143{ 1136{
1144 reparse(); 1137 reparse();
1145} 1138}
1146void OFileSelector::slotDelete() 1139void OFileSelector::slotDelete()
1147{ 1140{
1148 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1141 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1149 QStringList list = QStringList::split("->", sel->text(1) ); 1142 QStringList list = QStringList::split("->", sel->text(1) );
1150 if( sel->isDir() ){ 1143 if( sel->isDir() ){
1151 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry 1144 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry
1152 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 1145 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
1153 tr("Yes"),tr("No"),0,1,1) ) { 1146 tr("Yes"),tr("No"),0,1,1) ) {
1154 case 0: 1147 case 0:
1155 ::system(str.utf8().data() ); 1148 ::system(str.utf8().data() );
1156 break; 1149 break;
1157 } 1150 }
1158 } else { 1151 } else {
1159 QFile::remove( list[0] ); 1152 QFile::remove( list[0] );
1160 } 1153 }
1161 m_View->takeItem( sel ); 1154 m_View->takeItem( sel );
1162 delete sel; 1155 delete sel;
1163} 1156}
1164void OFileSelector::cdUP() 1157void OFileSelector::cdUP()
1165{ 1158{
1166 QDir dir( m_currentDir ); 1159 QDir dir( m_currentDir );
1167 dir.cdUp(); 1160 dir.cdUp();
1168 if(dir.exists() ){ 1161 if(dir.exists() ){
1169 m_currentDir = dir.absPath(); 1162 m_currentDir = dir.absPath();
1170 reparse(); 1163 reparse();
1171 int count = m_location->count(); 1164 int count = m_location->count();
1172 slotInsertLocationPath( m_currentDir, count); 1165 slotInsertLocationPath( m_currentDir, count);
1173 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 1166 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
1174 //this wont work in all instances 1167 //this wont work in all instances
1175 // FIXME 1168 // FIXME
1176 } 1169 }
1177} 1170}
1178void OFileSelector::slotHome() 1171void OFileSelector::slotHome()
1179{ 1172{
1180 cd(QDir::homeDirPath() ); 1173 cd(QDir::homeDirPath() );
1181} 1174}
1182void OFileSelector::slotDoc() 1175void OFileSelector::slotDoc()
1183{ 1176{
1184 cd(QPEApplication::documentDir() ); 1177 cd(QPEApplication::documentDir() );
1185} 1178}
1186void OFileSelector::slotNavigate( ) 1179void OFileSelector::slotNavigate( )
1187{ 1180{
1188 1181
1189} 1182}
1190// fill the View with life 1183// fill the View with life
1191void OFileSelector::reparse() 1184void OFileSelector::reparse()
1192{ 1185{
1193 if( m_selector == NORMAL ) 1186 if( m_selector == NORMAL )
1194 return; 1187 return;
1195 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) 1188 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL )
1196 m_View->clear(); 1189 m_View->clear();
1197 else // custom view 1190 else // custom view
1198 ; // currentView()->clear(); 1191 ; // currentView()->clear();
1199 if( m_shChooser) 1192 if( m_shChooser)
1200 qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); 1193 qWarning("reparse %s", m_mimeCheck->currentText().latin1() );
1201 1194
1202 QString currentMimeType; 1195 QString currentMimeType;
1203 // let's update the mimetype 1196 // let's update the mimetype
1204 if( m_autoMime ){ 1197 if( m_autoMime ){
1205 m_mimetypes.clear(); 1198 m_mimetypes.clear();
1206 // ok we can change mimetype so we need to be able to give a selection 1199 // ok we can change mimetype so we need to be able to give a selection
1207 if( m_shChooser ) { 1200 if( m_shChooser ) {
1208 currentMimeType = m_mimeCheck->currentText(); 1201 currentMimeType = m_mimeCheck->currentText();
1209 m_mimeCheck->clear(); 1202 m_mimeCheck->clear();
1210 1203
1211 // let's find possible mimetypes 1204 // let's find possible mimetypes
1212 QDir dir( m_currentDir ); 1205 QDir dir( m_currentDir );
1213 dir.setFilter( QDir::Files | QDir::Readable ); 1206 dir.setFilter( QDir::Files | QDir::Readable );
1214 dir.setSorting( QDir::Size ); 1207 dir.setSorting( QDir::Size );
1215 const QFileInfoList *list = dir.entryInfoList(); 1208 const QFileInfoList *list = dir.entryInfoList();
1216 QFileInfoListIterator it( *list ); 1209 QFileInfoListIterator it( *list );
1217 QFileInfo *fi; 1210 QFileInfo *fi;
1218 while( (fi=it.current() ) ) { 1211 while( (fi=it.current() ) ) {
1219 if( fi->extension() == QString::fromLatin1("desktop") ){ 1212 if( fi->extension() == QString::fromLatin1("desktop") ){
1220 ++it; 1213 ++it;
1221 continue; 1214 continue;
1222 } 1215 }
1223 MimeType type( fi->absFilePath() ); 1216 MimeType type( fi->absFilePath() );
1224 if( !m_mimetypes.contains( type.id() ) ){ 1217 if( !m_mimetypes.contains( type.id() ) ){
1225 //qWarning("Type %s", type.id().latin1() ); 1218 //qWarning("Type %s", type.id().latin1() );
1226 m_mimetypes.insert( type.id(), type.id() ); 1219 m_mimetypes.insert( type.id(), type.id() );
1227 } 1220 }
1228 1221
1229 ++it; 1222 ++it;
1230 } 1223 }
1231 // add them to the chooser 1224 // add them to the chooser
1232 updateMimeCheck(); 1225 updateMimeCheck();
1233 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); 1226 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
1234 currentMimeType = m_mimeCheck->currentText(); 1227 currentMimeType = m_mimeCheck->currentText();
1235 } 1228 }
1236 }else { // no autoMime 1229 }else { // no autoMime
1237 // let the mimetype be set from out side the m_mimeCheck FEATURE 1230 // let the mimetype be set from out side the m_mimeCheck FEATURE
1238 1231
1239 if( m_shChooser ){ 1232 if( m_shChooser ){
1240 currentMimeType = m_mimeCheck->currentText(); 1233 currentMimeType = m_mimeCheck->currentText();
1241// updateMimeCheck(); 1234// updateMimeCheck();
1242 } 1235 }
1243 } 1236 }
1244 // now we got our mimetypes we can add the files 1237 // now we got our mimetypes we can add the files
1245 1238
1246 QDir dir( m_currentDir ); 1239 QDir dir( m_currentDir );
1247 1240
1248 int sort; 1241 int sort;
1249 if ( m_case ) 1242 if ( m_case )
1250 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); 1243 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed);
1251 else 1244 else
1252 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); 1245 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed);
1253 dir.setSorting( sort ); 1246 dir.setSorting( sort );
1254 1247
1255 int filter; 1248 int filter;
1256 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){ 1249 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){
1257 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 1250 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
1258 }else 1251 }else
1259 filter = QDir::Files | QDir::Dirs | QDir::All; 1252 filter = QDir::Files | QDir::Dirs | QDir::All;
1260 dir.setFilter( filter ); 1253 dir.setFilter( filter );
1261 1254
1262 // now go through all files 1255 // now go through all files
1263 const QFileInfoList *list = dir.entryInfoList(); 1256 const QFileInfoList *list = dir.entryInfoList();
1264 QFileInfoListIterator it( *list ); 1257 QFileInfoListIterator it( *list );
1265 QFileInfo *fi; 1258 QFileInfo *fi;
1266 while( (fi=it.current() ) ){ 1259 while( (fi=it.current() ) ){
1267 //qWarning("True and only" ); 1260 //qWarning("True and only" );
1268 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 1261 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
1269 //qWarning(".. or ." ); 1262 //qWarning(".. or ." );
1270 ++it; 1263 ++it;
1271 continue; 1264 continue;
1272 } 1265 }
1273 if( fi->isSymLink() ){ 1266 if( fi->isSymLink() ){
1274 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 1267 QString file = fi->dirPath( true ) + "/" + fi->readLink();
1275 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos 1268 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
1276 QFileInfo info( file ); 1269 QFileInfo info( file );
1277 if( !info.exists() ){ 1270 if( !info.exists() ){
1278 addSymlink( currentMimeType, fi, TRUE ); 1271 addSymlink( currentMimeType, fi, TRUE );
1279 break; 1272 break;
1280 }else if( info.isDir() ){ 1273 }else if( info.isDir() ){
1281 addDir( currentMimeType, fi, TRUE ); 1274 addDir( currentMimeType, fi, TRUE );
1282 break; 1275 break;
1283 }else if( info.isFile() ){ 1276 }else if( info.isFile() ){
1284 addFile( currentMimeType, fi, TRUE ); 1277 addFile( currentMimeType, fi, TRUE );
1285 break; 1278 break;
1286 }else if( info.isSymLink() ){ 1279 }else if( info.isSymLink() ){
1287 file = info.dirPath(true ) + "/" + info.readLink() ; 1280 file = info.dirPath(true ) + "/" + info.readLink() ;
1288 break; 1281 break;
1289 }else if( i == 4){ 1282 }else if( i == 4){
1290 addSymlink( currentMimeType, fi ); 1283 addSymlink( currentMimeType, fi );
1291 } 1284 }
1292 } // off for loop 1285 } // off for loop
1293 }else if( fi->isDir() ){ 1286 }else if( fi->isDir() ){
1294 addDir( currentMimeType, fi ); 1287 addDir( currentMimeType, fi );
1295 }else if( fi->isFile() ){ 1288 }else if( fi->isFile() ){
1296 addFile( currentMimeType, fi ); 1289 addFile( currentMimeType, fi );
1297 } 1290 }
1298 //qWarning( "%s", fi->fileName().latin1() ); 1291 //qWarning( "%s", fi->fileName().latin1() );
1299 ++it; 1292 ++it;
1300 } // of while loop 1293 } // of while loop
1301 m_View->sort(); 1294 m_View->sort();
1302 if( m_shTool ){ 1295 if( m_shTool ){
1303 m_location->insertItem( m_currentDir ); 1296 m_location->insertItem( m_currentDir );
1304 1297
1305 } 1298 }
1306 // reenable painting and updates 1299 // reenable painting and updates
1307} 1300}
diff --git a/libopie/ofileview.h b/libopie/ofileview.h
index ed256f1..e072477 100644
--- a/libopie/ofileview.h
+++ b/libopie/ofileview.h
@@ -1,79 +1,87 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef ofileview_h 29#ifndef ofileview_h
30#define ofileview_h 30#define ofileview_h
31 31
32#include <qobject.h> 32#include <qobject.h>
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35class QFileInfo; 35class QFileInfo;
36class QDir; 36class QDir;
37class DocLnk; 37class DocLnk;
38class OFileSelectorView : public QWidget { 38
39/**
40 * A OFileView is a specialised View for the
41 * OFileSelector
42 * With a View you can chage the user visible
43 * representation of a OFileLister
44 * OFileView is just a basic interface which helps you to
45 * write new views
46 */
47class OFileView {
39 Q_OBJECT 48 Q_OBJECT
40 public: 49 public:
41 OFileSelectorView(QWidget *widget, 50 OFileView(QWidget *widget,
42 const char *name ) 51 const char *name );
43 : QWidget(widget, name ) 52 virtual OFileView();
44{ };
45 virtual ~OFileSelectorView() = 0; 53 virtual ~OFileSelectorView() = 0;
46 54
47 virtual void addFile(const QString &mine, 55 virtual void addFile(const QString &mine,
48 QFileInfo *info, 56 QFileInfo *info,
49 bool isSymlink = FALSE ) = 0; 57 bool isSymlink = FALSE ) = 0;
50 58
51 virtual void addDir (const QString &mine, 59 virtual void addDir (const QString &mine,
52 QFileInfo *info, 60 QFileInfo *info,
53 bool isSymlink = FALSE ) = 0; 61 bool isSymlink = FALSE ) = 0;
54 62
55 virtual void addSymlink(const QString &mime, 63 virtual void addSymlink(const QString &mime,
56 QFileInfo *info, 64 QFileInfo *info,
57 bool isSymlink = FALSE ) = 0; 65 bool isSymlink = FALSE ) = 0;
58 66
59 virtual void cd(const QString &path ) = 0; 67 virtual void cd(const QString &path ) = 0;
60 signals: 68 signals:
61 void fileSelected(const QString &); 69 void fileSelected(const QString &);
62 void fileSelected(const DocLnk & ); 70 void fileSelected(const DocLnk & );
63 void contextMenu(); 71 void contextMenu();
64 void changedDir(const QString &); 72 void changedDir(const QString &);
65 void changedDir(const QDir & ); 73 void changedDir(const QDir & );
66}; 74};
67 75
68class OFileViewFactory { 76class OFileViewFactory {
69 // Q_OBJECT 77 // Q_OBJECT
70 public: 78 public:
71 OFileViewFactory() {} ; 79 OFileViewFactory() {} ;
72 virtual ~OFileViewFactory() = 0; 80 virtual ~OFileViewFactory() = 0;
73 81
74 OFileSelectorView* newView(QWidget *parent, const char *name ); 82 OFileSelectorView* newView(QWidget *parent, const char *name );
75 QString name()const; 83 QString name()const;
76}; 84};
77 85
78 86
79#endif 87#endif
diff --git a/libopie/ofontmenu.h b/libopie/ofontmenu.h
index 609f240..5fd515f 100644
--- a/libopie/ofontmenu.h
+++ b/libopie/ofontmenu.h
@@ -1,83 +1,83 @@
1 1
2/* 2/*
3 3
4               =. This file is part of the OPIE Project 4               =. This file is part of the OPIE Project
5             .=l. Copyright (c) 2002 zekce <zecke@handhelds.org> 5             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This library is free software; you can 7 _;:,     .>    :=|. This library is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This library is distributed in the hope that 14    .i_,=:_.      -<s. This library is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31 31
32 32
33 33
34#ifndef ofontmenu_h 34#ifndef ofontmenu_h
35#define ofontmenu_h 35#define ofontmenu_h
36 36
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qlist.h> 38#include <qlist.h>
39 39
40 40
41namespace { 41namespace {
42 struct WidSize { 42 struct WidSize {
43 QWidget *wid; 43 QWidget *wid;
44 int size; 44 int size;
45 }; 45 };
46 46
47}; 47};
48 48
49// if i would be on kde this would be a KActionMenu... 49// if i would be on kde this would be a KActionMenu...
50class Config; 50class Config;
51class OFontMenu : public QPopupMenu { 51class OFontMenu : public QPopupMenu {
52 Q_OBJECT 52 Q_OBJECT
53 public: 53 public:
54 OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); 54 OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list );
55 void save(Config *cfg ); 55 void save(Config *cfg );
56 void restore(Config *cfg ); 56 void restore(Config *cfg );
57 void setWidgets(const QList<QWidget> &list ); 57 void setWidgets(const QList<QWidget> &list );
58 void addWidget(QWidget *wid ); 58 void addWidget(QWidget *wid );
59 void forceSize(QWidget *wid, int size ); 59 void forceSize(QWidget *wid, int size );
60 void removeWidget(QWidget *wid ); 60 void removeWidget(QWidget *wid );
61 const QList<QWidget> &widgets()const; 61 const QList<QWidget> &widgets()const;
62 62
63 signals: 63 signals:
64 void fontChanged(int size ); 64 void fontChanged(int size );
65 private: 65 private:
66 QList<QWidget> m_list; 66 QList<QWidget> m_list;
67 QList<WidSize> m_wids; 67 QList<WidSize> m_wids;
68 int m_size; 68 int m_size;
69 class OFontMenuPrivate; 69 class OFontMenuPrivate;
70 OFontMenuPrivate *d; 70 OFontMenuPrivate *d;
71 private slots: 71 private slots:
72 virtual void slotSmall(); 72 virtual void slotSmall();
73 virtual void slotMedium(); 73 virtual void slotMedium();
74 virtual void slotLarge(); 74 virtual void slotLarge();
75 void setFontSize(int size ); 75 void setFontSize(int size );
76}; 76};
77 77
78#endif 78#endif
79 79
80 80
81 81
82 82
83 83