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