Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 74aca96..dbba4b9 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -64,14 +64,14 @@ namespace Ui { | |||
64 | namespace Internal { | 64 | namespace Internal { |
65 | /* | 65 | /* |
66 | * Create a path by adding a '/'/QDir::seperator in between | 66 | * Create a path by adding a '/'/QDir::seperator in between |
67 | * base and ending, but only if base is not empty | 67 | * base and ending, but only if base is not empty |
68 | */ | 68 | */ |
69 | static inline QString createNewPath(const QString& base, const QString &ending) { | 69 | static inline QString createNewPath(const QString& base, const QString &ending) { |
70 | return base == QString::fromLatin1("/") ? | 70 | return base == QString::fromLatin1("/") ? |
71 | base + ending : base + "/" + ending; | 71 | base + ending : base + "/" + ending; |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) | 75 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) |
76 | : m_selector( _selector ) | 76 | : m_selector( _selector ) |
77 | { | 77 | { |
@@ -285,13 +285,13 @@ QString OFileSelectorItem::path()const | |||
285 | return text( 1 ); | 285 | return text( 1 ); |
286 | } | 286 | } |
287 | 287 | ||
288 | QString OFileSelectorItem::key( int id, bool )const | 288 | QString OFileSelectorItem::key( int id, bool )const |
289 | { | 289 | { |
290 | QString ke; | 290 | QString ke; |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * id = 0 ||id == 1 : Sort By Name but Directories at Top | 293 | * id = 0 ||id == 1 : Sort By Name but Directories at Top |
294 | * id = 2 : Sort By Size: Prepend '0' to the key | 294 | * id = 2 : Sort By Size: Prepend '0' to the key |
295 | */ | 295 | */ |
296 | if( id == 0 || id == 1 ) | 296 | if( id == 0 || id == 1 ) |
297 | { // name | 297 | { // name |
@@ -304,13 +304,13 @@ QString OFileSelectorItem::key( int id, bool )const | |||
304 | { | 304 | { |
305 | ke.append("1" ); | 305 | ke.append("1" ); |
306 | ke.append( text(1) ); | 306 | ke.append( text(1) ); |
307 | } | 307 | } |
308 | return ke; | 308 | return ke; |
309 | }else if(id == 2) { | 309 | }else if(id == 2) { |
310 | return text(2).rightJustify(20, '0'); | 310 | return text(2).rightJustify(20, '0'); |
311 | }else | 311 | }else |
312 | return text( id ); | 312 | return text( id ); |
313 | 313 | ||
314 | } | 314 | } |
315 | 315 | ||
316 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) | 316 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) |
@@ -360,12 +360,13 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st | |||
360 | connect(m_btnClose, SIGNAL(clicked() ), | 360 | connect(m_btnClose, SIGNAL(clicked() ), |
361 | selector(), SIGNAL(closeMe() ) ); | 361 | selector(), SIGNAL(closeMe() ) ); |
362 | 362 | ||
363 | btn = new QToolButton( box ); | 363 | btn = new QToolButton( box ); |
364 | btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); | 364 | btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); |
365 | 365 | ||
366 | m_fsButton = btn; | ||
366 | /* let's fill device parts */ | 367 | /* let's fill device parts */ |
367 | QPopupMenu* pop = new QPopupMenu(this); | 368 | QPopupMenu* pop = new QPopupMenu(this); |
368 | connect(pop, SIGNAL( activated(int) ), | 369 | connect(pop, SIGNAL( activated(int) ), |
369 | this, SLOT(slotFSActivated(int) ) ); | 370 | this, SLOT(slotFSActivated(int) ) ); |
370 | 371 | ||
371 | StorageInfo storage; | 372 | StorageInfo storage; |
@@ -377,14 +378,13 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st | |||
377 | const QString path = (*it)->path(); | 378 | const QString path = (*it)->path(); |
378 | m_dev.insert( disk, path ); | 379 | m_dev.insert( disk, path ); |
379 | pop->insertItem( disk ); | 380 | pop->insertItem( disk ); |
380 | } | 381 | } |
381 | m_fsPop = pop; | 382 | m_fsPop = pop; |
382 | 383 | ||
383 | 384 | connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); | |
384 | btn->setPopup( pop ); | ||
385 | 385 | ||
386 | lay->addWidget( box ); | 386 | lay->addWidget( box ); |
387 | 387 | ||
388 | m_view = new QListView( this ); | 388 | m_view = new QListView( this ); |
389 | 389 | ||
390 | m_view->installEventFilter(this); | 390 | m_view->installEventFilter(this); |
@@ -402,12 +402,18 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st | |||
402 | m_view->setAllColumnsShowFocus( TRUE ); | 402 | m_view->setAllColumnsShowFocus( TRUE ); |
403 | 403 | ||
404 | lay->addWidget( m_view, 1000 ); | 404 | lay->addWidget( m_view, 1000 ); |
405 | connectSlots(); | 405 | connectSlots(); |
406 | } | 406 | } |
407 | 407 | ||
408 | void OFileViewFileListView::slotFSpressed() | ||
409 | { | ||
410 | m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); | ||
411 | m_fsButton->setDown(false); | ||
412 | } | ||
413 | |||
408 | OFileViewFileListView::~OFileViewFileListView() | 414 | OFileViewFileListView::~OFileViewFileListView() |
409 | { | 415 | { |
410 | } | 416 | } |
411 | 417 | ||
412 | void OFileViewFileListView::slotNew() | 418 | void OFileViewFileListView::slotNew() |
413 | { | 419 | { |