summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-27 23:12:20 (UTC)
committer zecke <zecke>2002-04-27 23:12:20 (UTC)
commita64cc0ad0574ae1e15c4965d2557c3e06cc3fd65 (patch) (unidiff)
tree80a622e1e82e46a24dc5968b7b89180d4420476c
parentdb95cde435e507833f58111237f86cb9f9ac927a (diff)
downloadopie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.zip
opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.gz
opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.bz2
compile it for Max
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc4
-rw-r--r--libopie/ofileview.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 0e508af..9cf3f36 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -1,1194 +1,1194 @@
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 Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 Holger Freyther <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#include <qnamespace.h> 29#include <qnamespace.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qhbox.h> 32#include <qhbox.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qcheckbox.h> 37#include <qcheckbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qcursor.h> 44#include <qcursor.h>
45#include <qstringlist.h> 45#include <qstringlist.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47 47
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#include <qpe/fileselector.h> 49#include <qpe/fileselector.h>
50#include <qpe/applnk.h> 50#include <qpe/applnk.h>
51#include <qpe/global.h> 51#include <qpe/global.h>
52#include <qpe/mimetype.h> 52#include <qpe/mimetype.h>
53#include <qpe/resource.h> 53#include <qpe/resource.h>
54#include <qpe/storage.h> 54#include <qpe/storage.h>
55 55
56#include <unistd.h> 56#include <unistd.h>
57#include <stdlib.h> 57#include <stdlib.h>
58#include <sys/stat.h> 58#include <sys/stat.h>
59 59
60#include "ofileselector.h" 60#include "ofileselector.h"
61//#include "ofileview.h" 61//#include "ofileview.h"
62 62
63QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 63QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
64 64
65namespace { 65namespace {
66 66
67 int indexByString( const QComboBox *box, const QString &str ){ 67 int indexByString( const QComboBox *box, const QString &str ){
68 int index= -1; 68 int index= -1;
69 for(int i= 0; i < box->count(); i++ ){ 69 for(int i= 0; i < box->count(); i++ ){
70 if( str == box->text(i ) ){ 70 if( str == box->text(i ) ){
71 index= i; 71 index= i;
72 break; 72 break;
73 } 73 }
74 } 74 }
75 return index; 75 return index;
76 } 76 }
77 class OFileSelectorItem : public QListViewItem { 77 class OFileSelectorItem : public QListViewItem {
78 public: 78 public:
79 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, 79 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path,
80 const QString &date, const QString &size, const QString &mDir, 80 const QString &date, const QString &size, const QString &mDir,
81 bool isLocked=false, bool isDir=false ): QListViewItem(view) { 81 bool isLocked=false, bool isDir=false ): QListViewItem(view) {
82 setPixmap(0, pixmap ); 82 setPixmap(0, pixmap );
83 setText(1, path ); 83 setText(1, path );
84 setText(2, size ); 84 setText(2, size );
85 setText(3, date ); 85 setText(3, date );
86 //setText(4, mDir ); 86 //setText(4, mDir );
87 m_dir = mDir; 87 m_dir = mDir;
88 dir = isDir; 88 dir = isDir;
89 mLocked = isLocked; 89 mLocked = isLocked;
90 } 90 }
91 bool isLocked() const{ 91 bool isLocked() const{
92 return mLocked; 92 return mLocked;
93 } 93 }
94 QString directory()const{ 94 QString directory()const{
95 return m_dir; 95 return m_dir;
96 } 96 }
97 bool isDir()const{ 97 bool isDir()const{
98 return dir; 98 return dir;
99 } 99 }
100 QString path()const{ 100 QString path()const{
101 return text(1 ); 101 return text(1 );
102 } 102 }
103 QString key(int id, bool )const { 103 QString key(int id, bool )const {
104 QString ke; 104 QString ke;
105 if( id == 0 || id == 1 ){ // name 105 if( id == 0 || id == 1 ){ // name
106 if( dir ){ 106 if( dir ){
107 ke.append("0" ); 107 ke.append("0" );
108 ke.append( text(1) ); 108 ke.append( text(1) );
109 }else{ 109 }else{
110 ke.append("1" ); 110 ke.append("1" );
111 ke.append( text(1) ); 111 ke.append( text(1) );
112 } 112 }
113 }else if( id == 2 ){ // size 113 }else if( id == 2 ){ // size
114 return text(2); 114 return text(2);
115 }else if( id == 3 ){ // date 115 }else if( id == 3 ){ // date
116 return text(3); 116 return text(3);
117 } 117 }
118 return ke; 118 return ke;
119 }; 119 };
120 private: 120 private:
121 bool mLocked:1; 121 bool mLocked:1;
122 bool dir:1; 122 bool dir:1;
123 QString m_dir; 123 QString m_dir;
124 }; 124 };
125}; 125};
126 126
127 127
128OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 128OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
129 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) 129 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
130{ 130{
131 if(wid!=0) 131 if(wid!=0)
132 resize(wid->width(),wid->height()); 132 resize(wid->width(),wid->height());
133 m_selector = selector; 133 m_selector = selector;
134 m_currentDir = dirName; 134 m_currentDir = dirName;
135 m_name = fileName; 135 m_name = fileName;
136 m_mimetypes = mimetypes; 136 m_mimetypes = mimetypes;
137 137
138 if( mimetypes.isEmpty() ) 138 if( mimetypes.isEmpty() )
139 m_autoMime = true; 139 m_autoMime = true;
140 140
141 qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); 141 qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() );
142 m_mode = mode; 142 m_mode = mode;
143 m_shTool = true; 143 m_shTool = true;
144 m_shPerm = true; 144 m_shPerm = true;
145 m_shLne = true; 145 m_shLne = true;
146 m_shChooser = true; 146 m_shChooser = true;
147 m_shYesNo = true; 147 m_shYesNo = true;
148 148
149 // for FILESELECTOR only view is interesting 149 // for FILESELECTOR only view is interesting
150 m_location = 0; 150 m_location = 0;
151 m_homeButton = 0; 151 m_homeButton = 0;
152 m_docButton = 0; 152 m_docButton = 0;
153 m_hideButton = 0; 153 m_hideButton = 0;
154 m_ok = 0; 154 m_ok = 0;
155 m_cancel = 0; 155 m_cancel = 0;
156 m_reread = 0; 156 m_reread = 0;
157 m_up = 0; 157 m_up = 0;
158 m_View = 0; 158 m_View = 0;
159 m_select = 0; 159 m_select = 0;
160 m_stack = 0; 160 m_stack = 0;
161 161
162 m_select = 0; 162 m_select = 0;
163 m_stack = 0; 163 m_stack = 0;
164 m_lay = 0; 164 m_lay = 0;
165 m_boxToolbar = 0; 165 m_boxToolbar = 0;
166 m_boxOk = 0; 166 m_boxOk = 0;
167 m_edit = 0; 167 m_edit = 0;
168 168
169 m_fnLabel = 0; 169 m_fnLabel = 0;
170 m_checkPerm = 0; 170 m_checkPerm = 0;
171 m_mimeCheck = 0; 171 m_mimeCheck = 0;
172 m_viewCheck = 0; 172 m_viewCheck = 0;
173 173
174 m_pseudo = 0; 174 m_pseudo = 0;
175 m_pseudoLayout = 0; 175 m_pseudoLayout = 0;
176 176
177 m_dir = true; 177 m_dir = true;
178 m_files = true; 178 m_files = true;
179 m_custom = 0; 179 m_custom = 0;
180 m_showPopup = true; 180 m_showPopup = true;
181 181
182 if(m_pixmaps == 0 ) // init the pixmaps 182 if(m_pixmaps == 0 ) // init the pixmaps
183 initPics(); 183 initPics();
184 184
185 m_lay = new QVBoxLayout(this); 185 m_lay = new QVBoxLayout(this);
186 init(); 186 init();
187 m_edit->setText( fileName ); 187 m_edit->setText( fileName );
188} 188}
189 189
190void OFileSelector::initPics() 190void OFileSelector::initPics()
191{ 191{
192 qWarning("init pics" ); 192 qWarning("init pics" );
193 m_pixmaps = new QMap<QString,QPixmap>; 193 m_pixmaps = new QMap<QString,QPixmap>;
194 QPixmap pm = Resource::loadPixmap( "folder" ); 194 QPixmap pm = Resource::loadPixmap( "folder" );
195 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 195 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
196 QPainter painter( &pm ); 196 QPainter painter( &pm );
197 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 197 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
198 pm.setMask( pm.createHeuristicMask( FALSE ) ); 198 pm.setMask( pm.createHeuristicMask( FALSE ) );
199 m_pixmaps->insert("dirsymlink", pm ); 199 m_pixmaps->insert("dirsymlink", pm );
200 200
201 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 201 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
202 QPainter pen(&pm2 ); 202 QPainter pen(&pm2 );
203 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 203 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
204 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 204 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
205 m_pixmaps->insert("symlinkedlocked", pm2 ); 205 m_pixmaps->insert("symlinkedlocked", pm2 );
206 206
207} 207}
208 208
209// let's initialize the gui 209// let's initialize the gui
210/** 210/**
211 -------------------- 211 --------------------
212 | cmbBox Button | 212 | cmbBox Button |
213 -------------------- 213 --------------------
214 | FileSlector | 214 | FileSlector |
215 | or | 215 | or |
216 | OSelector | 216 | OSelector |
217 | | 217 | |
218 | | 218 | |
219 ____________________ 219 ____________________
220 | LineEdit | 220 | LineEdit |
221 ____________________ 221 ____________________
222 | Permission Bar | 222 | Permission Bar |
223 ____________________ 223 ____________________
224 | ViewChoose | 224 | ViewChoose |
225 ____________________ 225 ____________________
226 | Save Cancel| 226 | Save Cancel|
227 ____________________ 227 ____________________
228 */ 228 */
229void OFileSelector::delItems() 229void OFileSelector::delItems()
230{ 230{
231 QLayoutIterator it = m_lay->iterator(); 231 QLayoutIterator it = m_lay->iterator();
232 while ( it.current() != 0 ){ 232 while ( it.current() != 0 ){
233 it.deleteCurrent(); 233 it.deleteCurrent();
234 } 234 }
235} 235}
236 236
237void OFileSelector::init() 237void OFileSelector::init()
238{ 238{
239// qDebug("init"); 239// qDebug("init");
240 m_stack = new QWidgetStack(this, "wstack" ); 240 m_stack = new QWidgetStack(this, "wstack" );
241 if( m_selector == NORMAL ){ 241 if( m_selector == NORMAL ){
242 QString currMime; 242 QString currMime;
243 if( m_mimeCheck != 0 ) 243 if( m_mimeCheck != 0 )
244 currMime = m_mimeCheck->currentText(); 244 currMime = m_mimeCheck->currentText();
245 updateMimes(); 245 updateMimes();
246 m_select = new FileSelector( currMime == "All" ? QString::null : currMime , 246 m_select = new FileSelector( currMime == "All" ? QString::null : currMime ,
247 m_stack, "fileselector", FALSE, FALSE ); 247 m_stack, "fileselector", FALSE, FALSE );
248 m_stack->addWidget(m_select, NORMAL ); 248 m_stack->addWidget(m_select, NORMAL );
249 m_lay->addWidget(m_stack ); 249 m_lay->addWidget(m_stack );
250 m_stack->raiseWidget(NORMAL ); 250 m_stack->raiseWidget(NORMAL );
251 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), 251 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ),
252 this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 252 this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
253 m_pseudoLayout = 0l; 253 m_pseudoLayout = 0l;
254 254
255 } else { 255 } else {
256 initializeListView(); 256 initializeListView();
257 } 257 }
258 if(m_shLne ){ 258 if(m_shLne ){
259 initializeName(); 259 initializeName();
260 } 260 }
261 if(m_shPerm ){ 261 if(m_shPerm ){
262 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); 262 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" );
263 m_checkPerm->setChecked( false ); 263 m_checkPerm->setChecked( false );
264 m_lay->addWidget(m_checkPerm ); 264 m_lay->addWidget(m_checkPerm );
265 } 265 }
266 if( m_shChooser ) 266 if( m_shChooser )
267 initializeChooser(); 267 initializeChooser();
268 if(m_shYesNo ) 268 if(m_shYesNo )
269 initializeYes(); 269 initializeYes();
270 270
271 // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); 271 // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
272 // reparse(); 272 // reparse();
273 273
274} 274}
275 275
276void OFileSelector::setYesCancelVisible( bool show ) 276void OFileSelector::setYesCancelVisible( bool show )
277{ 277{
278 if ( show == m_shYesNo ) 278 if ( show == m_shYesNo )
279 return; 279 return;
280 m_shYesNo = show; 280 m_shYesNo = show;
281 if( !show ){ 281 if( !show ){
282 delete m_ok; 282 delete m_ok;
283 delete m_cancel; 283 delete m_cancel;
284 m_ok = 0; 284 m_ok = 0;
285 m_cancel = 0; 285 m_cancel = 0;
286 // delete m_boxOk; all ready deleted in delItems 286 // delete m_boxOk; all ready deleted in delItems
287 } 287 }
288 updateLay(); // recreate it and save the other states 288 updateLay(); // recreate it and save the other states
289} 289}
290 290
291void OFileSelector::setToolbarVisible( bool show ) 291void OFileSelector::setToolbarVisible( bool show )
292{ 292{
293 if ( m_shTool == show ) 293 if ( m_shTool == show )
294 return; 294 return;
295 if(!m_shTool ){ 295 if(!m_shTool ){
296 delete m_boxToolbar; 296 delete m_boxToolbar;
297 delete m_homeButton; 297 delete m_homeButton;
298 delete m_docButton; 298 delete m_docButton;
299 delete m_location; 299 delete m_location;
300 delete m_up; 300 delete m_up;
301 m_boxToolbar = 0; 301 m_boxToolbar = 0;
302 m_homeButton = 0; 302 m_homeButton = 0;
303 m_docButton = 0; 303 m_docButton = 0;
304 m_location = 0; 304 m_location = 0;
305 m_up = 0; 305 m_up = 0;
306 }; 306 };
307 updateLay();// overkill fix it 307 updateLay();// overkill fix it
308} 308}
309 309
310void OFileSelector::setPermissionBarVisible( bool show ) 310void OFileSelector::setPermissionBarVisible( bool show )
311{ 311{
312 if( show == m_shPerm ) 312 if( show == m_shPerm )
313 return; 313 return;
314 314
315 m_shPerm = show; 315 m_shPerm = show;
316 316
317 updateLay(); 317 updateLay();
318} 318}
319 319
320void OFileSelector::setLineEditVisible( bool show ) 320void OFileSelector::setLineEditVisible( bool show )
321{ 321{
322 if( show == m_shLne ) 322 if( show == m_shLne )
323 return; 323 return;
324 324
325 m_shLne = show; 325 m_shLne = show;
326 if( !show ){ 326 if( !show ){
327 delete m_edit; 327 delete m_edit;
328 delete m_fnLabel; 328 delete m_fnLabel;
329 m_edit = 0; 329 m_edit = 0;
330 m_fnLabel = 0; 330 m_fnLabel = 0;
331 //delete m_boxName; will be deleted 331 //delete m_boxName; will be deleted
332 } 332 }
333 updateLay(); 333 updateLay();
334} 334}
335 335
336void OFileSelector::setChooserVisible( bool show ) 336void OFileSelector::setChooserVisible( bool show )
337{ 337{
338 if( show = m_shChooser ) 338 if( show = m_shChooser )
339 return; 339 return;
340 m_shChooser = show; 340 m_shChooser = show;
341 if( !show ){ 341 if( !show ){
342 delete m_mimeCheck; 342 delete m_mimeCheck;
343 delete m_viewCheck; 343 delete m_viewCheck;
344 m_mimeCheck = 0; 344 m_mimeCheck = 0;
345 m_viewCheck = 0; 345 m_viewCheck = 0;
346 } 346 }
347 updateLay(); 347 updateLay();
348} 348}
349 349
350QCheckBox* OFileSelector::permissionCheckbox( ) 350QCheckBox* OFileSelector::permissionCheckbox( )
351{ 351{
352 return m_checkPerm; 352 return m_checkPerm;
353} 353}
354 354
355void OFileSelector::setCaseSensetive( bool caSe ) 355void OFileSelector::setCaseSensetive( bool caSe )
356{ 356{
357 m_case = caSe; 357 m_case = caSe;
358 reparse(); 358 reparse();
359} 359}
360 360
361void OFileSelector::setShowFiles(bool files ){ 361void OFileSelector::setShowFiles(bool files ){
362 m_files = files; 362 m_files = files;
363 reparse(); 363 reparse();
364} 364}
365 365
366void OFileSelector::setPopupMenu(QPopupMenu *pop ) 366void OFileSelector::setPopupMenu(QPopupMenu *pop )
367{ 367{
368 //delete oldpopup; 368 //delete oldpopup;
369 m_custom = pop; 369 m_custom = pop;
370} 370}
371 371
372bool OFileSelector::setPermission( ) const 372bool OFileSelector::setPermission( ) const
373{ 373{
374 if( m_checkPerm == 0 ) 374 if( m_checkPerm == 0 )
375 return false; 375 return false;
376 else 376 else
377 return m_checkPerm->isChecked(); 377 return m_checkPerm->isChecked();
378} 378}
379 379
380void OFileSelector::setPermissionChecked( bool check ) 380void OFileSelector::setPermissionChecked( bool check )
381{ 381{
382 if( m_checkPerm == 0 ) 382 if( m_checkPerm == 0 )
383 return; 383 return;
384 m_checkPerm->setChecked( check ); 384 m_checkPerm->setChecked( check );
385} 385}
386 386
387QString OFileSelector::selectedName( )const 387QString OFileSelector::selectedName( )const
388{ 388{
389 QString string; 389 QString string;
390 if( m_selector == NORMAL ){ 390 if( m_selector == NORMAL ){
391 const DocLnk *lnk = m_select->selected(); 391 const DocLnk *lnk = m_select->selected();
392 string = lnk->file(); 392 string = lnk->file();
393 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 393 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
394 QListViewItem *item = m_View->currentItem(); 394 QListViewItem *item = m_View->currentItem();
395 if(item != 0 ){ 395 if(item != 0 ){
396 string = m_currentDir + "/" + item->text( 1 ); 396 string = m_currentDir + "/" + item->text( 1 );
397 } 397 }
398 } 398 }
399 return string; 399 return string;
400} 400}
401 401
402QStringList OFileSelector::selectedNames()const 402QStringList OFileSelector::selectedNames()const
403{ 403{
404 QStringList list; 404 QStringList list;
405 return list; 405 return list;
406} 406}
407 407
408DocLnk OFileSelector::selectedDocument( )const 408DocLnk OFileSelector::selectedDocument( )const
409{ 409{
410 DocLnk lnk; 410 DocLnk lnk;
411 return lnk; 411 return lnk;
412} 412}
413void OFileSelector::updateLay() 413void OFileSelector::updateLay()
414{ 414{
415 /* if( m_shTool ) 415 /* if( m_shTool )
416 // 416 //
417 else 417 else
418 // hide 418 // hide
419 */ 419 */
420 // save the state 420 // save the state
421 bool check = false; 421 bool check = false;
422 if( m_checkPerm != 0 ) 422 if( m_checkPerm != 0 )
423 check = m_checkPerm->isChecked(); 423 check = m_checkPerm->isChecked();
424 QString text; 424 QString text;
425 425
426 if( m_edit != 0 ) 426 if( m_edit != 0 )
427 text = m_edit->text(); 427 text = m_edit->text();
428 // save current mimetype 428 // save current mimetype
429 429
430 delItems(); 430 delItems();
431 delete m_checkPerm; 431 delete m_checkPerm;
432 m_checkPerm = 0; 432 m_checkPerm = 0;
433 delete m_edit; 433 delete m_edit;
434 m_edit = 0; 434 m_edit = 0;
435 delete m_fnLabel; 435 delete m_fnLabel;
436 m_fnLabel = 0; 436 m_fnLabel = 0;
437 delete m_ok; 437 delete m_ok;
438 m_ok = 0; 438 m_ok = 0;
439 delete m_cancel; 439 delete m_cancel;
440 m_cancel = 0; 440 m_cancel = 0;
441 delete m_mimeCheck; 441 delete m_mimeCheck;
442 m_mimeCheck = 0; 442 m_mimeCheck = 0;
443 delete m_viewCheck; 443 delete m_viewCheck;
444 m_viewCheck = 0; 444 m_viewCheck = 0;
445 delete m_select; // test 445 delete m_select; // test
446 delete m_stack; 446 delete m_stack;
447 //delete m_list; 447 //delete m_list;
448 init(); 448 init();
449 if( m_shLne ) 449 if( m_shLne )
450 m_edit->setText(text ); 450 m_edit->setText(text );
451 if( m_shPerm ) 451 if( m_shPerm )
452 m_checkPerm->setChecked(check ); 452 m_checkPerm->setChecked(check );
453} 453}
454 454
455// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve 455// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve
456// insert QListViewItems with the right options 456// insert QListViewItems with the right options
457bool OFileSelector::compliesMime(const QString &path, const QString &mime ) 457bool OFileSelector::compliesMime(const QString &path, const QString &mime )
458{ 458{
459 if( mime == "All" ) 459 if( mime == "All" )
460 return true; 460 return true;
461 MimeType type( path ); 461 MimeType type( path );
462 if( type.id() == mime ) 462 if( type.id() == mime )
463 return true; 463 return true;
464 return false; 464 return false;
465} 465}
466 466
467void OFileSelector::reparse() 467void OFileSelector::reparse()
468{ 468{
469 qDebug("reparse"); 469 qDebug("reparse");
470 if(m_View== 0 || m_selector == NORMAL) 470 if(m_View== 0 || m_selector == NORMAL)
471 return; 471 return;
472 m_View->clear(); 472 m_View->clear();
473 QString currMime =m_mimeCheck->currentText(); 473 QString currMime =m_mimeCheck->currentText();
474 // update the mimetype now 474 // update the mimetype now
475 if( m_autoMime ) { 475 if( m_autoMime ) {
476 QDir dir( m_currentDir ); 476 QDir dir( m_currentDir );
477 m_mimetypes.clear(); 477 m_mimetypes.clear();
478 m_mimeCheck->clear(); 478 m_mimeCheck->clear();
479 dir.setFilter( QDir::Files | QDir::Readable ); 479 dir.setFilter( QDir::Files | QDir::Readable );
480 dir.setSorting(QDir::Size ); 480 dir.setSorting(QDir::Size );
481 const QFileInfoList *list = dir.entryInfoList(); 481 const QFileInfoList *list = dir.entryInfoList();
482 QFileInfoListIterator it( *list ); 482 QFileInfoListIterator it( *list );
483 QFileInfo *fi; 483 QFileInfo *fi;
484 while( (fi=it.current()) ){ 484 while( (fi=it.current()) ){
485 if(fi->extension() == QString::fromLatin1("desktop") ){ 485 if(fi->extension() == QString::fromLatin1("desktop") ){
486 ++it; 486 ++it;
487 continue; 487 continue;
488 } 488 }
489 MimeType type(fi->filePath() ); 489 MimeType type(fi->filePath() );
490 if( !m_mimetypes.contains( type.id() ) ) 490 if( !m_mimetypes.contains( type.id() ) )
491 m_mimetypes.append( type.id() ); 491 m_mimetypes.append( type.id() );
492 492
493 ++it; 493 ++it;
494 } 494 }
495 m_mimetypes.prepend("All" ); 495 m_mimetypes.prepend("All" );
496 m_mimeCheck->insertStringList(m_mimetypes ); 496 m_mimeCheck->insertStringList(m_mimetypes );
497 // set it to the current mimetype 497 // set it to the current mimetype
498 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); 498 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
499 }else{ 499 }else{
500 m_mimeCheck->clear(); 500 m_mimeCheck->clear();
501 m_mimeCheck->insertItem( m_mimetypes.join(";") ); 501 m_mimeCheck->insertItem( m_mimetypes.join(";") );
502 } 502 }
503 503
504 QDir dir( m_currentDir ); 504 QDir dir( m_currentDir );
505 //dir.setFilter(-1 ); 505 //dir.setFilter(-1 );
506 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; 506 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
507 if( m_case ) 507 if( m_case )
508 sort = QDir::IgnoreCase; 508 sort = QDir::IgnoreCase;
509 dir.setSorting( sort ); 509 dir.setSorting( sort );
510 510
511 int filter; 511 int filter;
512 /* if( m_dir && !m_files) 512 /* if( m_dir && !m_files)
513 filter |= QDir::Dirs; 513 filter |= QDir::Dirs;
514 else if( !m_dir && m_files ) 514 else if( !m_dir && m_files )
515 filter |= QDir::Files; 515 filter |= QDir::Files;
516 else 516 else
517 filter |= QDir::All; 517 filter |= QDir::All;
518 */ 518 */
519 if( m_selector == EXTENDED_ALL ) 519 if( m_selector == EXTENDED_ALL )
520 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 520 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
521 else 521 else
522 filter = QDir::Files | QDir::Dirs | QDir::All; 522 filter = QDir::Files | QDir::Dirs | QDir::All;
523 dir.setFilter( filter ); 523 dir.setFilter( filter );
524 qDebug("infoList"); 524 qDebug("infoList");
525 const QFileInfoList *list = dir.entryInfoList(); 525 const QFileInfoList *list = dir.entryInfoList();
526 QFileInfoListIterator it( *list ); 526 QFileInfoListIterator it( *list );
527 QFileInfo *fi; 527 QFileInfo *fi;
528 while( (fi=it.current()) ){ 528 while( (fi=it.current()) ){
529 if(fi->fileName() == ".." || fi->fileName() == "." ){ 529 if(fi->fileName() == ".." || fi->fileName() == "." ){
530 ++it; 530 ++it;
531 continue; 531 continue;
532 } 532 }
533// qWarning("Test: %s", fi->fileName().latin1() ); 533// qWarning("Test: %s", fi->fileName().latin1() );
534 if(fi->isSymLink() ){ 534 if(fi->isSymLink() ){
535// qWarning("Symlink %s", fi->fileName().latin1() ); 535// qWarning("Symlink %s", fi->fileName().latin1() );
536 QString file = fi->dirPath(true)+"/"+ fi->readLink(); 536 QString file = fi->dirPath(true)+"/"+ fi->readLink();
537// qWarning("File ->%s", file.latin1() ); 537// qWarning("File ->%s", file.latin1() );
538 for(int i=0; i<=4; i++ ){ // prepend from dos 538 for(int i=0; i<=4; i++ ){ // prepend from dos
539 QFileInfo info( file ); 539 QFileInfo info( file );
540 if( !info.exists() ){ 540 if( !info.exists() ){
541// qWarning("does not exist" ); 541// qWarning("does not exist" );
542 addSymlink(currMime, fi, TRUE ); 542 addSymlink(currMime, fi, TRUE );
543 break; 543 break;
544 }else if( info.isDir() ){ 544 }else if( info.isDir() ){
545// qWarning("isDir" ); 545// qWarning("isDir" );
546 addDir(currMime, fi, TRUE ); 546 addDir(currMime, fi, TRUE );
547 break; 547 break;
548 }else if( info.isFile() ){ 548 }else if( info.isFile() ){
549// qWarning("isFile" ); 549// qWarning("isFile" );
550 addFile(currMime, fi, TRUE ); 550 addFile(currMime, fi, TRUE );
551 break; 551 break;
552 }else if( info.isSymLink() ){ 552 }else if( info.isSymLink() ){
553 file = info.dirPath(true)+ "/"+ info.readLink(); 553 file = info.dirPath(true)+ "/"+ info.readLink();
554// qWarning("isSymlink again %s", file.latin1() ); 554// qWarning("isSymlink again %s", file.latin1() );
555 }else if( i == 4 ){ // just insert it and have the symlink symbol 555 }else if( i == 4 ){ // just insert it and have the symlink symbol
556 addSymlink(currMime, fi ); 556 addSymlink(currMime, fi );
557// qWarning("level too deep" ); 557// qWarning("level too deep" );
558 } 558 }
559 } 559 }
560 }else if( fi->isDir() ){ 560 }else if( fi->isDir() ){
561 addDir(currMime, fi ); 561 addDir(currMime, fi );
562 }else if( fi->isFile() ) { // file ? 562 }else if( fi->isFile() ) { // file ?
563 addFile(currMime, fi ); 563 addFile(currMime, fi );
564 } 564 }
565 ++it; 565 ++it;
566 } 566 }
567 m_View->sort(); 567 m_View->sort();
568// m_View->ensureItemVisible(); 568// m_View->ensureItemVisible();
569} 569}
570 570
571QString OFileSelector::directory()const 571QString OFileSelector::directory()const
572{ 572{
573 QDir d( m_currentDir); 573 QDir d( m_currentDir);
574 return d.absPath(); 574 return d.absPath();
575} 575}
576 576
577int OFileSelector::fileCount() 577int OFileSelector::fileCount()
578{ 578{
579 return 0; 579 return 0;
580} 580}
581 581
582void OFileSelector::slotOk( ) 582void OFileSelector::slotOk( )
583{ 583{
584 emit ok(); 584 emit ok();
585} 585}
586 586
587void OFileSelector::slotCancel( ) 587void OFileSelector::slotCancel( )
588{ 588{
589 emit cancel(); 589 emit cancel();
590} 590}
591 591
592void OFileSelector::initializeName() 592void OFileSelector::initializeName()
593{ 593{
594 m_boxName = new QHBoxLayout(this ); 594 m_boxName = new QHBoxLayout(this );
595 m_edit = new QLineEdit(this ); 595 m_edit = new QLineEdit(this );
596 m_fnLabel = new QLabel(this ); 596 m_fnLabel = new QLabel(this );
597 m_fnLabel->setText(tr("Name:") ); 597 m_fnLabel->setText(tr("Name:") );
598 m_boxName->addWidget(m_fnLabel ); 598 m_boxName->addWidget(m_fnLabel );
599 m_boxName->insertSpacing(1, 8 ); 599 m_boxName->insertSpacing(1, 8 );
600 m_boxName->addWidget(m_edit, 100 ); 600 m_boxName->addWidget(m_edit, 100 );
601 601
602 m_lay->addLayout(m_boxName); 602 m_lay->addLayout(m_boxName);
603} 603}
604 604
605void OFileSelector::initializeYes() 605void OFileSelector::initializeYes()
606{ 606{
607 m_ok = new QPushButton("&Save", this, "save" ); 607 m_ok = new QPushButton("&Save", this, "save" );
608 m_cancel = new QPushButton("C&ancel", this, "cancel" ); 608 m_cancel = new QPushButton("C&ancel", this, "cancel" );
609 m_boxOk = new QHBoxLayout(this ); 609 m_boxOk = new QHBoxLayout(this );
610 m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); 610 m_boxOk->addWidget( m_ok, Qt::AlignHCenter );
611 m_boxOk->insertSpacing(1, 8 ); 611 m_boxOk->insertSpacing(1, 8 );
612 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); 612 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter);
613 m_lay->addLayout(m_boxOk ); 613 m_lay->addLayout(m_boxOk );
614 connect(m_ok, SIGNAL(clicked() ), 614 connect(m_ok, SIGNAL(clicked() ),
615 this, SLOT(slotOk() ) ); 615 this, SLOT(slotOk() ) );
616 connect(m_cancel, SIGNAL(clicked() ), 616 connect(m_cancel, SIGNAL(clicked() ),
617 this, SLOT(slotCancel() ) ); 617 this, SLOT(slotCancel() ) );
618 618
619} 619}
620 620
621void OFileSelector::initializeChooser() 621void OFileSelector::initializeChooser()
622{ 622{
623 m_boxView = new QHBoxLayout(this ); 623 m_boxView = new QHBoxLayout(this );
624 624
625 m_mimeCheck = new QComboBox(this, "mime check"); 625 m_mimeCheck = new QComboBox(this, "mime check");
626 m_viewCheck = new QComboBox(this, "view check"); 626 m_viewCheck = new QComboBox(this, "view check");
627 m_boxView->addWidget(m_viewCheck, 0 ); 627 m_boxView->addWidget(m_viewCheck, 0 );
628 m_boxView->insertSpacing(2, 8 ); 628 m_boxView->insertSpacing(2, 8 );
629 m_boxView->addWidget(m_mimeCheck, 0 ); 629 m_boxView->addWidget(m_mimeCheck, 0 );
630 m_lay->addLayout(m_boxView ); 630 m_lay->addLayout(m_boxView );
631 m_lay->insertSpacing( 4, 8); 631 m_lay->insertSpacing( 4, 8);
632 632
633 m_viewCheck->insertItem(tr("Documents") ); 633 m_viewCheck->insertItem(tr("Documents") );
634 m_viewCheck->insertItem(tr("Files") ); 634 m_viewCheck->insertItem(tr("Files") );
635 m_viewCheck->insertItem(tr("All Files") ); 635 m_viewCheck->insertItem(tr("All Files") );
636 636
637 if(!m_autoMime ) 637 if(!m_autoMime )
638 m_mimeCheck->insertItem(m_mimetypes.join("," ) ); 638 m_mimeCheck->insertItem(m_mimetypes.join("," ) );
639 else{ // check 639 else{ // check
640 updateMimes(); 640 updateMimes();
641 m_mimeCheck->insertStringList( m_mimetypes ); 641 m_mimeCheck->insertStringList( m_mimetypes );
642 } 642 }
643 643
644 connect( m_viewCheck, SIGNAL(activated(const QString &) ), 644 connect( m_viewCheck, SIGNAL(activated(const QString &) ),
645 this, SLOT(slotViewCheck(const QString & ) ) ); 645 this, SLOT(slotViewCheck(const QString & ) ) );
646 646
647 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 647 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
648 this, SLOT(slotMimeCheck(const QString & ) ) ); 648 this, SLOT(slotMimeCheck(const QString & ) ) );
649} 649}
650 650
651void OFileSelector::slotMimeCheck(const QString &view ){ 651void OFileSelector::slotMimeCheck(const QString &view ){
652 if(m_selector == NORMAL ){ 652 if(m_selector == NORMAL ){
653 delete m_select; 653 delete m_select;
654 m_select = new FileSelector(view == "All" ? QString::null : view 654 m_select = new FileSelector(view == "All" ? QString::null : view
655 , m_stack, "fileselector", FALSE, FALSE ); 655 , m_stack, "fileselector", FALSE, FALSE );
656 m_stack->addWidget( m_select, NORMAL ); 656 m_stack->addWidget( m_select, NORMAL );
657 m_stack->raiseWidget( NORMAL ); 657 m_stack->raiseWidget( NORMAL );
658 }else{ 658 }else{
659 reparse(); 659 reparse();
660 } 660 }
661} 661}
662 662
663void OFileSelector::slotViewCheck(const QString &view ){ 663void OFileSelector::slotViewCheck(const QString &view ){
664 qWarning("changed: show %s", view.latin1() ); 664 qWarning("changed: show %s", view.latin1() );
665 // if the current view is the one 665 // if the current view is the one
666 QString currMime = m_mimeCheck->currentText(); 666 QString currMime = m_mimeCheck->currentText();
667 if( view == QString::fromLatin1("Documents") ){ 667 if( view == QString::fromLatin1("Documents") ){
668 // get the mimetype now 668 // get the mimetype now
669 // check if we're the current widget and return 669 // check if we're the current widget and return
670 if( m_View != 0) { // delete 0 shouldn't crash but it did :( 670 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
671 delete m_View; 671 delete m_View;
672 delete m_boxToolbar; 672 delete m_boxToolbar;
673 delete m_homeButton; 673 delete m_homeButton;
674 delete m_docButton; 674 delete m_docButton;
675 delete m_location; 675 delete m_location;
676 delete m_up; 676 delete m_up;
677 delete m_pseudo; 677 delete m_pseudo;
678 //if(m_pseudoLayout!=0 ) 678 //if(m_pseudoLayout!=0 )
679// delete m_pseudoLayout; 679// delete m_pseudoLayout;
680 } 680 }
681 m_View = 0; 681 m_View = 0;
682 m_boxToolbar = 0; 682 m_boxToolbar = 0;
683 m_homeButton = 0; 683 m_homeButton = 0;
684 m_docButton = 0; 684 m_docButton = 0;
685 m_location = 0; 685 m_location = 0;
686 m_up = 0; 686 m_up = 0;
687 m_pseudo = 0; 687 m_pseudo = 0;
688 m_pseudoLayout = 0; 688 m_pseudoLayout = 0;
689 689
690 delete m_select; 690 delete m_select;
691 m_select = new FileSelector( currMime == "All" ? QString::null : currMime, 691 m_select = new FileSelector( currMime == "All" ? QString::null : currMime,
692 m_stack,"fileselector", FALSE, FALSE ); 692 m_stack,"fileselector", FALSE, FALSE );
693 m_stack->addWidget( m_select, NORMAL ); 693 m_stack->addWidget( m_select, NORMAL );
694 m_mimeCheck->clear(); 694 m_mimeCheck->clear();
695 m_selector = NORMAL; 695 m_selector = NORMAL;
696 updateMimes(); 696 updateMimes();
697 m_mimeCheck->insertStringList( m_mimetypes ); 697 m_mimeCheck->insertStringList( m_mimetypes );
698 m_stack->raiseWidget( NORMAL ); 698 m_stack->raiseWidget( NORMAL );
699 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 699 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
700 700
701 } else if(view == QString::fromLatin1("Files") ){ 701 } else if(view == QString::fromLatin1("Files") ){
702 // remove from the stack 702 // remove from the stack
703 delete m_select; 703 delete m_select;
704 m_select = 0; 704 m_select = 0;
705 delete m_View; 705 delete m_View;
706 m_View = 0; 706 m_View = 0;
707 707
708 m_selector = EXTENDED; 708 m_selector = EXTENDED;
709 initializeListView(); 709 initializeListView();
710 reparse(); 710 reparse();
711 } else if(view == QString::fromLatin1("All Files") ) { 711 } else if(view == QString::fromLatin1("All Files") ) {
712 // remove from the stack 712 // remove from the stack
713 delete m_select; 713 delete m_select;
714 m_select = 0; 714 m_select = 0;
715 delete m_View; 715 delete m_View;
716 m_View = 0; 716 m_View = 0;
717 717
718 m_selector = EXTENDED_ALL; 718 m_selector = EXTENDED_ALL;
719 initializeListView(); 719 initializeListView();
720 reparse(); 720 reparse();
721 } 721 }
722} 722}
723 723
724 724
725void OFileSelector::updateMimes() // lets check which mode is active 725void OFileSelector::updateMimes() // lets check which mode is active
726 // check the current dir for items then 726 // check the current dir for items then
727{ 727{
728 if( m_autoMime ){ 728 if( m_autoMime ){
729 m_mimetypes.clear(); 729 m_mimetypes.clear();
730 m_mimetypes.append("All" ); 730 m_mimetypes.append("All" );
731 if( m_selector == NORMAL ){ 731 if( m_selector == NORMAL ){
732 DocLnkSet set; 732 DocLnkSet set;
733 Global::findDocuments(&set, QString::null ); 733 Global::findDocuments(&set, QString::null );
734 QListIterator<DocLnk> dit( set.children() ); 734 QListIterator<DocLnk> dit( set.children() );
735 for ( ; dit.current(); ++dit ) { 735 for ( ; dit.current(); ++dit ) {
736 if( !m_mimetypes.contains((*dit)->type() ) ) 736 if( !m_mimetypes.contains((*dit)->type() ) )
737 m_mimetypes.append( (*dit)->type() ); 737 m_mimetypes.append( (*dit)->type() );
738 } 738 }
739 }else{ 739 }else{
740 // should be allreday updatet 740 // should be allreday updatet
741 ; 741 ;
742 } 742 }
743 } 743 }
744} 744}
745 745
746void OFileSelector::initializeListView() 746void OFileSelector::initializeListView()
747{ 747{
748 // in the instance that a developer selected the view to be Files or Entended, 748 // in the instance that a developer selected the view to be Files or Entended,
749 // in the initial initialization, you are deleting objects here 749 // in the initial initialization, you are deleting objects here
750 // that aren't even existing yet. 750 // that aren't even existing yet.
751 751
752 // just to make sure but clean it up better FIXME 752 // just to make sure but clean it up better FIXME
753 delete m_View; 753 delete m_View;
754 m_View = 0; 754 m_View = 0;
755 delete m_boxToolbar; 755 delete m_boxToolbar;
756 delete m_homeButton; 756 delete m_homeButton;
757 delete m_docButton; 757 delete m_docButton;
758 delete m_location; 758 delete m_location;
759 delete m_up; 759 delete m_up;
760 delete m_pseudo; 760 delete m_pseudo;
761 761
762 m_boxToolbar = 0; 762 m_boxToolbar = 0;
763 m_homeButton = 0; 763 m_homeButton = 0;
764 m_docButton = 0; 764 m_docButton = 0;
765 m_location = 0; 765 m_location = 0;
766 m_up = 0; 766 m_up = 0;
767 m_pseudo = 0; 767 m_pseudo = 0;
768 m_pseudoLayout = 0; 768 m_pseudoLayout = 0;
769 qDebug(" time for the toolbar "); 769 qDebug(" time for the toolbar ");
770 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 770 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
771 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 771 m_pseudoLayout = new QVBoxLayout(m_pseudo );
772 if(m_shTool ){ 772 if(m_shTool ){
773 m_boxToolbar = new QHBoxLayout( ); 773 m_boxToolbar = new QHBoxLayout( );
774 m_boxToolbar->setAutoAdd( true ); 774 m_boxToolbar->setAutoAdd( true );
775 m_location = new QComboBox(m_pseudo ); 775 m_location = new QComboBox(m_pseudo );
776 m_location ->setEditable(TRUE); 776 m_location ->setEditable(TRUE);
777 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); 777 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) );
778 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); 778 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged()));
779 779
780 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 780 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
781 m_up->setFixedSize( QSize( 20, 20 ) ); 781 m_up->setFixedSize( QSize( 20, 20 ) );
782 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 782 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
783 m_up->setFlat(TRUE); 783 m_up->setFlat(TRUE);
784 784
785 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 785 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
786 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 786 m_homeButton->setFixedSize( QSize( 20, 20 ) );
787 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 787 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
788 m_homeButton->setFlat(TRUE); 788 m_homeButton->setFlat(TRUE);
789 789
790 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 790 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
791 m_docButton->setFixedSize( QSize( 20, 20 ) ); 791 m_docButton->setFixedSize( QSize( 20, 20 ) );
792 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 792 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
793 m_docButton->setFlat(TRUE); 793 m_docButton->setFlat(TRUE);
794 794
795 m_boxToolbar->addWidget(m_location ); 795 m_boxToolbar->addWidget(m_location );
796 m_boxToolbar->addWidget(m_up ); 796 m_boxToolbar->addWidget(m_up );
797 m_boxToolbar->addWidget(m_homeButton ); 797 m_boxToolbar->addWidget(m_homeButton );
798 m_boxToolbar->addWidget(m_docButton ); 798 m_boxToolbar->addWidget(m_docButton );
799 m_pseudoLayout->addLayout(m_boxToolbar ); 799 m_pseudoLayout->addLayout(m_boxToolbar );
800 qDebug("lets fill the combobox"); 800 qDebug("lets fill the combobox");
801 StorageInfo storage; 801 StorageInfo storage;
802 const QList<FileSystem> &fs = storage.fileSystems(); 802 const QList<FileSystem> &fs = storage.fileSystems();
803 QListIterator<FileSystem> it ( fs ); 803 QListIterator<FileSystem> it ( fs );
804 for( ; it.current(); ++it ){ 804 for( ; it.current(); ++it ){
805 const QString disk = (*it)->name(); 805 const QString disk = (*it)->name();
806 const QString path = (*it)->path(); 806 const QString path = (*it)->path();
807 m_location->insertItem(path+ "<-"+disk ); 807 m_location->insertItem(path+ "<-"+disk );
808 } 808 }
809 int count = m_location->count(); 809 int count = m_location->count();
810 m_location->insertItem(m_currentDir ); 810 m_location->insertItem(m_currentDir );
811 m_location->setCurrentItem( count ); 811 m_location->setCurrentItem( count );
812 }; 812 };
813 813
814 m_View = new QListView(m_pseudo, "Extended view" ); 814 m_View = new QListView(m_pseudo, "Extended view" );
815 m_stack->addWidget( m_pseudo, EXTENDED ); 815 m_stack->addWidget( m_pseudo, EXTENDED );
816 m_stack->raiseWidget( EXTENDED ); 816 m_stack->raiseWidget( EXTENDED );
817 m_pseudoLayout->addWidget(m_View ); 817 m_pseudoLayout->addWidget(m_View );
818 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 818 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
819 // set up the stuff 819 // set up the stuff
820 // Pixmap Name Date Size mime 820 // Pixmap Name Date Size mime
821 //(m_View->header() )->hide(); 821 //(m_View->header() )->hide();
822 //m_View->setRootIsDecorated(false); 822 //m_View->setRootIsDecorated(false);
823 m_View->addColumn(" "); 823 m_View->addColumn(" ");
824 m_View->addColumn(tr("Name"),135 ); 824 m_View->addColumn(tr("Name"),135 );
825 m_View->addColumn(tr("Size"),-1 ); 825 m_View->addColumn(tr("Size"),-1 );
826 m_View->addColumn(tr("Date"), 60 ); 826 m_View->addColumn(tr("Date"), 60 );
827 m_View->addColumn(tr("Mime Type"),-1 ); 827 m_View->addColumn(tr("Mime Type"),-1 );
828 QHeader *header = m_View->header(); 828 QHeader *header = m_View->header();
829 header->hide(); 829 header->hide();
830 m_View->setSorting(1 ); 830 m_View->setSorting(1 );
831 m_View->setAllColumnsShowFocus( TRUE); 831 m_View->setAllColumnsShowFocus( TRUE);
832 // connect now 832 // connect now
833 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 833 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
834 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 834 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
835 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 835 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
836 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 836 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
839 839
840 840
841}; 841};
842 842
843/* If a item is locked depends on the mode 843/* If a item is locked depends on the mode
844 if we're in OPEN !isReadable is locked 844 if we're in OPEN !isReadable is locked
845 if we're in SAVE !isWriteable is locked 845 if we're in SAVE !isWriteable is locked
846 846
847 847
848 */ 848 */
849 849
850 850
851void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 851void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
852// qWarning("Add Files" ); 852// qWarning("Add Files" );
853 if( !m_files ){ 853 if( !m_files ){
854// qWarning("not mfiles" ); 854// qWarning("not mfiles" );
855 return; 855 return;
856 } 856 }
857 857
858 MimeType type( info->filePath() ); 858 MimeType type( info->filePath() );
859 QString name; 859 QString name;
860 QString dir; 860 QString dir;
861 bool locked= false; 861 bool locked= false;
862 if(mime == "All" ){ 862 if(mime == "All" ){
863 ; 863 ;
864 }else if( type.id() != mime ) { 864 }else if( type.id() != mime ) {
865 return; 865 return;
866 } 866 }
867 QPixmap pix = type.pixmap(); 867 QPixmap pix = type.pixmap();
868 if(pix.isNull() ) 868 if(pix.isNull() )
869 pix = Resource::loadPixmap( "UnknownDocument-14" ); 869 pix = Resource::loadPixmap( "UnknownDocument-14" );
870 dir = info->dirPath( true ); 870 dir = info->dirPath( true );
871 if( symlink ) { // check if the readLink is readable 871 if( symlink ) { // check if the readLink is readable
872 // do it right later 872 // do it right later
873 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 873 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
874 }else{ // keep track of the icons 874 }else{ // keep track of the icons
875 name = info->fileName(); 875 name = info->fileName();
876 if( m_mode == OPEN ){ 876 if( m_mode == OPEN ){
877 if( !info->isReadable() ){ 877 if( !info->isReadable() ){
878 locked = true; 878 locked = true;
879 pix = Resource::loadPixmap("locked" ); 879 pix = Resource::loadPixmap("locked" );
880 } 880 }
881 }else if( m_mode == SAVE ){ 881 }else if( m_mode == SAVE ){
882 if( !info->isWritable() ){ 882 if( !info->isWritable() ){
883 locked = true; 883 locked = true;
884 pix = Resource::loadPixmap("locked" ); 884 pix = Resource::loadPixmap("locked" );
885 } 885 }
886 } 886 }
887 } 887 }
888 new OFileSelectorItem( m_View, pix, name, 888 new OFileSelectorItem( m_View, pix, name,
889 info->lastModified().toString(), 889 info->lastModified().toString(),
890 QString::number( info->size() ), 890 QString::number( info->size() ),
891 dir, locked ); 891 dir, locked );
892} 892}
893 893
894void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 894void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink )
895{ 895{
896 if(!m_dir ) 896 if(!m_dir )
897 return; 897 return;
898 //if( showDirs ) 898 //if( showDirs )
899 { 899 {
900 bool locked=false; 900 bool locked=false;
901 QString name; 901 QString name;
902 QPixmap pix; 902 QPixmap pix;
903 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 903 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
904 locked = true; 904 locked = true;
905 if( symlink ){ 905 if( symlink ){
906 pix = (*m_pixmaps)["symlinkedlocked"]; 906 pix = (*m_pixmaps)["symlinkedlocked"];
907 }else{ 907 }else{
908 pix = Resource::loadPixmap("lockedfolder" ); 908 pix = Resource::loadPixmap("lockedfolder" );
909 } 909 }
910 }else{ 910 }else{
911 if( symlink ){ 911 if( symlink ){
912 pix = (*m_pixmaps)["dirsymlink" ]; 912 pix = (*m_pixmaps)["dirsymlink" ];
913 }else{ 913 }else{
914 pix = Resource::loadPixmap("folder" ); 914 pix = Resource::loadPixmap("folder" );
915 } 915 }
916 } 916 }
917 if( symlink){ 917 if( symlink){
918 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 918 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
919 919
920 }else{ 920 }else{
921 //if(info->isReadable() ) 921 //if(info->isReadable() )
922 name = info->fileName(); 922 name = info->fileName();
923 } 923 }
924 924
925 new OFileSelectorItem(m_View, pix, 925 new OFileSelectorItem(m_View, pix,
926 name, info->lastModified().toString(), 926 name, info->lastModified().toString(),
927 QString::number(info->size() ),info->dirPath(true), locked, true ); 927 QString::number(info->size() ),info->dirPath(true), locked, true );
928 928
929 } 929 }
930} 930}
931 931
932void OFileSelector::setShowDirs(bool dir ) 932void OFileSelector::setShowDirs(bool dir )
933{ 933{
934 m_dir = dir; 934 m_dir = dir;
935 reparse(); 935 reparse();
936} 936}
937 937
938void OFileSelector::slotFileSelected(const QString &string ) 938void OFileSelector::slotFileSelected(const QString &string )
939{ 939{
940 if(m_shLne ) 940 if(m_shLne )
941 m_edit->setText( string ); 941 m_edit->setText( string );
942 942
943 emit fileSelected( string ); 943 emit fileSelected( string );
944 // do AppLnk stuff 944 // do AppLnk stuff
945} 945}
946 946
947void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 947void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
948{ 948{
949 slotFileSelected(lnk.name() ); 949 slotFileSelected(lnk.name() );
950 emit fileSelected( lnk ); 950 emit fileSelected( lnk );
951} 951}
952 952
953void OFileSelector::slotSelectionChanged() // get the current items 953void OFileSelector::slotSelectionChanged() // get the current items
954 // fixme 954 // fixme
955{ 955{
956 qWarning("selection changed" ); 956 qWarning("selection changed" );
957} 957}
958 958
959void OFileSelector::slotCurrentChanged(QListViewItem *item ) 959void OFileSelector::slotCurrentChanged(QListViewItem *item )
960{ 960{
961// qWarning("current changed" ); 961// qWarning("current changed" );
962 if( item == 0 ) 962 if( item == 0 )
963 return; 963 return;
964 964
965 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 965 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
966 OFileSelectorItem *sel = (OFileSelectorItem*)item; 966 OFileSelectorItem *sel = (OFileSelectorItem*)item;
967 if(!sel->isDir() ){ 967 if(!sel->isDir() ){
968// qWarning("is not dir" ); 968// qWarning("is not dir" );
969 if(m_shLne ){ 969 if(m_shLne ){
970 m_edit->setText(sel->text(1) ); 970 m_edit->setText(sel->text(1) );
971// qWarning("setTexy" ); 971// qWarning("setTexy" );
972 } 972 }
973 } 973 }
974 }else { 974 }else {
975 qWarning("mode not extended" ); 975 qWarning("mode not extended" );
976 } 976 }
977} 977}
978 978
979// either select or change dir 979// either select or change dir
980void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) 980void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &/*point*/, int )
981{ 981{
982 if( item == 0 ) 982 if( item == 0 )
983 return; 983 return;
984 984
985 if( button != Qt::LeftButton ) 985 if( button != Qt::LeftButton )
986 return; 986 return;
987 987
988// qWarning("clicked" ); 988// qWarning("clicked" );
989 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 989 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
990// qWarning("inside" ); 990// qWarning("inside" );
991 OFileSelectorItem *sel = (OFileSelectorItem*)item; 991 OFileSelectorItem *sel = (OFileSelectorItem*)item;
992 if(!sel->isLocked() ){ // not locked either changedir or open 992 if(!sel->isLocked() ){ // not locked either changedir or open
993 QStringList str = QStringList::split("->", sel->text(1) ); 993 QStringList str = QStringList::split("->", sel->text(1) );
994 if(sel->isDir() ){ 994 if(sel->isDir() ){
995 cd( sel->directory() + "/" + str[0] ); 995 cd( sel->directory() + "/" + str[0] );
996 } else { 996 } else {
997// qWarning("file" ); 997// qWarning("file" );
998 if(m_shLne ) 998 if(m_shLne )
999 m_edit->setText(str[0] ); 999 m_edit->setText(str[0] );
1000 emit fileSelected(str[0] ); 1000 emit fileSelected(str[0] );
1001 // emit DocLnk need to do it 1001 // emit DocLnk need to do it
1002 } 1002 }
1003 } else { 1003 } else {
1004 qWarning( "locked" ); 1004 qWarning( "locked" );
1005 } 1005 }
1006 }; 1006 };
1007} 1007}
1008 1008
1009void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1009void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1010{ 1010{
1011 if (item == 0 ) 1011 if (item == 0 )
1012 return; 1012 return;
1013 1013
1014 if( button != Qt::RightButton ) 1014 if( button != Qt::RightButton )
1015 return; 1015 return;
1016// qWarning("right button" ); 1016// qWarning("right button" );
1017 slotContextMenu(item); 1017 slotContextMenu(item);
1018} 1018}
1019 1019
1020void OFileSelector::slotContextMenu(QListViewItem *item) 1020void OFileSelector::slotContextMenu(QListViewItem *item)
1021{ 1021{
1022// qWarning("context menu" ); 1022// qWarning("context menu" );
1023 if( item ==0 || !m_showPopup ) 1023 if( item ==0 || !m_showPopup )
1024 return; 1024 return;
1025 1025
1026 if( m_custom !=0){ 1026 if( m_custom !=0){
1027 m_custom->exec(); 1027 m_custom->exec();
1028 }else{ 1028 }else{
1029 QPopupMenu menu; 1029 QPopupMenu menu;
1030 QAction up; 1030 QAction up;
1031 up.setText("cd up"); 1031 up.setText("cd up");
1032 up.addTo( &menu ); 1032 up.addTo( &menu );
1033 connect(&up, SIGNAL(activated() ), 1033 connect(&up, SIGNAL(activated() ),
1034 this, SLOT(cdUP() ) ); 1034 this, SLOT(cdUP() ) );
1035 1035
1036 QAction act; 1036 QAction act;
1037 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1037 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1038 if(sel->isDir() ){ 1038 if(sel->isDir() ){
1039 act.setText( tr("Change Directory") ); 1039 act.setText( tr("Change Directory") );
1040 act.addTo(&menu ); 1040 act.addTo(&menu );
1041 connect(&act, SIGNAL(activated() ), 1041 connect(&act, SIGNAL(activated() ),
1042 this, SLOT(slotChangedDir() ) ); 1042 this, SLOT(slotChangedDir() ) );
1043 }else{ 1043 }else{
1044 act.setText( tr("Open file" ) ); 1044 act.setText( tr("Open file" ) );
1045 act.addTo( &menu ); 1045 act.addTo( &menu );
1046 connect(&act, SIGNAL(activated() ), 1046 connect(&act, SIGNAL(activated() ),
1047 this, SLOT(slotOpen() ) ); 1047 this, SLOT(slotOpen() ) );
1048 } 1048 }
1049 QAction rescan; 1049 QAction rescan;
1050 rescan.setText( tr("Rescan") ); 1050 rescan.setText( tr("Rescan") );
1051 rescan.addTo( &menu ); 1051 rescan.addTo( &menu );
1052 connect(&rescan, SIGNAL(activated() ), 1052 connect(&rescan, SIGNAL(activated() ),
1053 this, SLOT(slotRescan() ) ); 1053 this, SLOT(slotRescan() ) );
1054 1054
1055 QAction rename; 1055 QAction rename;
1056 rename.setText( tr("Rename") ); 1056 rename.setText( tr("Rename") );
1057 rename.addTo( &menu ); 1057 rename.addTo( &menu );
1058 connect(&rename, SIGNAL(activated() ), 1058 connect(&rename, SIGNAL(activated() ),
1059 this, SLOT(slotRename() ) ); 1059 this, SLOT(slotRename() ) );
1060 1060
1061 menu.insertSeparator(); 1061 menu.insertSeparator();
1062 QAction delItem; 1062 QAction delItem;
1063 delItem.setText( tr("Delete") ); 1063 delItem.setText( tr("Delete") );
1064 delItem.addTo(&menu ); 1064 delItem.addTo(&menu );
1065 connect(&delItem, SIGNAL(activated() ), 1065 connect(&delItem, SIGNAL(activated() ),
1066 this, SLOT(slotDelete() ) ); 1066 this, SLOT(slotDelete() ) );
1067 1067
1068 menu.exec(QCursor::pos() ); 1068 menu.exec(QCursor::pos() );
1069 } 1069 }
1070} 1070}
1071 1071
1072bool OFileSelector::cd(const QString &str ) 1072bool OFileSelector::cd(const QString &str )
1073{ 1073{
1074// qWarning(" dir %s", str.latin1() ); 1074// qWarning(" dir %s", str.latin1() );
1075 QDir dir( str); 1075 QDir dir( str);
1076 if(dir.exists() ){ 1076 if(dir.exists() ){
1077 m_currentDir = dir.absPath(); 1077 m_currentDir = dir.absPath();
1078 reparse(); 1078 reparse();
1079 if(m_shTool ){ 1079 if(m_shTool ){
1080 int count = m_location->count(); 1080 int count = m_location->count();
1081 insertLocationPath( str ,count ); 1081 insertLocationPath( str ,count );
1082 m_location->setCurrentItem( count ); 1082 m_location->setCurrentItem( count );
1083 } 1083 }
1084 return true; 1084 return true;
1085 } 1085 }
1086 return false; 1086 return false;
1087} 1087}
1088 1088
1089void OFileSelector::insertLocationPath(const QString &currentPath, int count) { 1089void OFileSelector::insertLocationPath(const QString &currentPath, int count) {
1090 QStringList pathList; 1090 QStringList pathList;
1091 bool underDog = FALSE; 1091 bool underDog = FALSE;
1092 for(int i=0;i<count;i++) { 1092 for(int i=0;i<count;i++) {
1093 pathList << m_location->text(i); 1093 pathList << m_location->text(i);
1094 if( m_location->text(i) == currentPath) 1094 if( m_location->text(i) == currentPath)
1095 underDog = TRUE; 1095 underDog = TRUE;
1096 } 1096 }
1097 if( !underDog) { 1097 if( !underDog) {
1098 m_location->clear(); 1098 m_location->clear();
1099 if( currentPath.left(2)=="//") 1099 if( currentPath.left(2)=="//")
1100 pathList.append( currentPath.right(currentPath.length()-1) ); 1100 pathList.append( currentPath.right(currentPath.length()-1) );
1101 else 1101 else
1102 pathList.append( currentPath ); 1102 pathList.append( currentPath );
1103 m_location->insertStringList( pathList,-1); 1103 m_location->insertStringList( pathList,-1);
1104 } 1104 }
1105} 1105}
1106 1106
1107void OFileSelector::slotChangedDir() 1107void OFileSelector::slotChangedDir()
1108{ 1108{
1109 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1109 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1110 if(sel->isDir() ){ 1110 if(sel->isDir() ){
1111 QStringList str = QStringList::split("->", sel->text(1) ); 1111 QStringList str = QStringList::split("->", sel->text(1) );
1112 cd( sel->directory() + "/" + str[0] ); 1112 cd( sel->directory() + "/" + str[0] );
1113 1113
1114 } 1114 }
1115} 1115}
1116 1116
1117void OFileSelector::slotOpen() 1117void OFileSelector::slotOpen()
1118{ 1118{
1119 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1119 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1120 if(!sel->isDir() ){ 1120 if(!sel->isDir() ){
1121 QStringList str = QStringList::split("->", sel->text(1) ); 1121 QStringList str = QStringList::split("->", sel->text(1) );
1122 slotFileSelected( str[0] ); 1122 slotFileSelected( str[0] );
1123 } 1123 }
1124} 1124}
1125 1125
1126void OFileSelector::slotRescan() 1126void OFileSelector::slotRescan()
1127{ 1127{
1128 reparse(); 1128 reparse();
1129} 1129}
1130 1130
1131void OFileSelector::slotRename() 1131void OFileSelector::slotRename()
1132{ 1132{
1133 // rename inline 1133 // rename inline
1134} 1134}
1135 1135
1136void OFileSelector::slotDelete() 1136void OFileSelector::slotDelete()
1137{ 1137{
1138// qWarning("delete slot" ); 1138// qWarning("delete slot" );
1139 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1139 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1140 QStringList list = QStringList::split("->", sel->text(1) ); 1140 QStringList list = QStringList::split("->", sel->text(1) );
1141 if( sel->isDir() ){ 1141 if( sel->isDir() ){
1142 QString str = QString::fromLatin1("rm -rf ") + list[0]; //better safe than sorry 1142 QString str = QString::fromLatin1("rm -rf ") + list[0]; //better safe than sorry
1143 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 1143 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
1144 tr("Yes"),tr("No"),0,1,1) ) { 1144 tr("Yes"),tr("No"),0,1,1) ) {
1145 case 0: 1145 case 0:
1146 ::system(str.utf8().data() ); 1146 ::system(str.utf8().data() );
1147 break; 1147 break;
1148 } 1148 }
1149 } else { 1149 } else {
1150 QFile::remove( list[0] ); 1150 QFile::remove( list[0] );
1151 } 1151 }
1152 m_View->takeItem( sel ); 1152 m_View->takeItem( sel );
1153 delete sel; 1153 delete sel;
1154} 1154}
1155 1155
1156void OFileSelector::cdUP() 1156void OFileSelector::cdUP()
1157{ 1157{
1158 QDir dir( m_currentDir ); 1158 QDir dir( m_currentDir );
1159 dir.cdUp(); 1159 dir.cdUp();
1160 if(dir.exists() ){ 1160 if(dir.exists() ){
1161 m_currentDir = dir.absPath(); 1161 m_currentDir = dir.absPath();
1162 reparse(); 1162 reparse();
1163 int count = m_location->count(); 1163 int count = m_location->count();
1164 insertLocationPath( m_currentDir, count); 1164 insertLocationPath( m_currentDir, count);
1165 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 1165 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
1166//this wont work in all instances 1166//this wont work in all instances
1167 // FIXME 1167 // FIXME
1168 } 1168 }
1169} 1169}
1170 1170
1171void OFileSelector::slotHome() 1171void OFileSelector::slotHome()
1172{ 1172{
1173 cd(QDir::homeDirPath() ); 1173 cd(QDir::homeDirPath() );
1174} 1174}
1175 1175
1176void OFileSelector::slotDoc() 1176void OFileSelector::slotDoc()
1177{ 1177{
1178 cd(QDir::homeDirPath() + "/Documents" ); 1178 cd(QDir::homeDirPath() + "/Documents" );
1179} 1179}
1180 1180
1181void OFileSelector::slotNavigate() 1181void OFileSelector::slotNavigate()
1182{ 1182{
1183 1183
1184} 1184}
1185 1185
1186void OFileSelector::locationComboActivated(const QString & file ) { 1186void OFileSelector::locationComboActivated(const QString & file ) {
1187 cd(file.left(file.find("<-",0,TRUE))); 1187 cd(file.left(file.find("<-",0,TRUE)));
1188 reparse(); 1188 reparse();
1189} 1189}
1190 1190
1191void OFileSelector::locationComboChanged() { 1191void OFileSelector::locationComboChanged() {
1192 cd( m_location->lineEdit()->text()); 1192 cd( m_location->lineEdit()->text());
1193 reparse(); 1193 reparse();
1194} 1194}
diff --git a/libopie/ofileview.h b/libopie/ofileview.h
index 48a71ca..ed256f1 100644
--- a/libopie/ofileview.h
+++ b/libopie/ofileview.h
@@ -1,79 +1,79 @@
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 { 38class OFileSelectorView : public QWidget {
39 Q_OBJECT 39 Q_OBJECT
40 public: 40 public:
41 OFileSelectorView(QWidget *widget, 41 OFileSelectorView(QWidget *widget,
42 const char *name ) 42 const char *name )
43 : QWidget(widget, name ) 43 : QWidget(widget, name )
44{ }; 44{ };
45 virtual ~OFileSelectorView(); 45 virtual ~OFileSelectorView() = 0;
46 46
47 virtual void addFile(const QString &mine, 47 virtual void addFile(const QString &mine,
48 QFileInfo *info, 48 QFileInfo *info,
49 bool isSymlink = FALSE ) = 0; 49 bool isSymlink = FALSE ) = 0;
50 50
51 virtual void addDir (const QString &mine, 51 virtual void addDir (const QString &mine,
52 QFileInfo *info, 52 QFileInfo *info,
53 bool isSymlink = FALSE ) = 0; 53 bool isSymlink = FALSE ) = 0;
54 54
55 virtual void addSymlink(const QString &mime, 55 virtual void addSymlink(const QString &mime,
56 QFileInfo *info, 56 QFileInfo *info,
57 bool isSymlink = FALSE ) = 0; 57 bool isSymlink = FALSE ) = 0;
58 58
59 virtual void cd(const QString &path ); 59 virtual void cd(const QString &path ) = 0;
60 signals: 60 signals:
61 void fileSelected(const QString &); 61 void fileSelected(const QString &);
62 void fileSelected(const DocLnk & ); 62 void fileSelected(const DocLnk & );
63 void contextMenu(); 63 void contextMenu();
64 void changedDir(const QString &); 64 void changedDir(const QString &);
65 void changedDir(const QDir & ); 65 void changedDir(const QDir & );
66}; 66};
67 67
68class OFileViewFactory { 68class OFileViewFactory {
69 // Q_OBJECT 69 // Q_OBJECT
70 public: 70 public:
71 OFileViewFactory() {} ; 71 OFileViewFactory() {} ;
72 virtual ~OFileViewFactory(); 72 virtual ~OFileViewFactory() = 0;
73 73
74 OFileSelectorView* newView(QWidget *parent, const char *name ); 74 OFileSelectorView* newView(QWidget *parent, const char *name );
75 QString name()const; 75 QString name()const;
76}; 76};
77 77
78 78
79#endif 79#endif