-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 18 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 2 |
2 files changed, 14 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 @@ -66,10 +66,10 @@ namespace Internal { * Create a path by adding a '/'/QDir::seperator in between * base and ending, but only if base is not empty */ static inline QString createNewPath(const QString& base, const QString &ending) { - return base == QString::fromLatin1("/") ? - base + ending : base + "/" + ending; + return base == QString::fromLatin1("/") ? + base + ending : base + "/" + ending; } OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) @@ -287,9 +287,9 @@ QString OFileSelectorItem::path()const QString OFileSelectorItem::key( int id, bool )const { QString ke; - + /* * id = 0 ||id == 1 : Sort By Name but Directories at Top * id = 2 : Sort By Size: Prepend '0' to the key */ @@ -306,9 +306,9 @@ QString OFileSelectorItem::key( int id, bool )const ke.append( text(1) ); } return ke; }else if(id == 2) { - return text(2).rightJustify(20, '0'); + return text(2).rightJustify(20, '0'); }else return text( id ); } @@ -362,8 +362,9 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); + m_fsButton = btn; /* let's fill device parts */ QPopupMenu* pop = new QPopupMenu(this); connect(pop, SIGNAL( activated(int) ), this, SLOT(slotFSActivated(int) ) ); @@ -379,10 +380,9 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st pop->insertItem( disk ); } m_fsPop = pop; - - btn->setPopup( pop ); + connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); lay->addWidget( box ); m_view = new QListView( this ); @@ -404,8 +404,14 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st lay->addWidget( m_view, 1000 ); connectSlots(); } +void OFileViewFileListView::slotFSpressed() +{ + m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); + m_fsButton->setDown(false); +} + OFileViewFileListView::~OFileViewFileListView() { } diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 15db916..94216a0 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h @@ -163,8 +163,9 @@ private slots: void changeDir( const QString& ); void slotCurrentChanged( QListViewItem* ); void slotClicked(int, QListViewItem*, const QPoint&, int ); void slotFSActivated(int); + void slotFSpressed(); protected: OFileSelector* selector(); @@ -176,8 +177,9 @@ private: bool compliesMime( const QString& ); QStringList m_mimes; // used in compy mime QString m_currentDir; QToolButton *m_btnNew, *m_btnClose; + QToolButton *m_fsButton; void connectSlots(); void addFile( QFileInfo* info, bool symlink = FALSE ); void addDir ( QFileInfo* info, bool symlink = FALSE ); void addSymlink( QFileInfo* info, bool = FALSE ); |