-rw-r--r-- | library/fileselector.cpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/library/fileselector.cpp b/library/fileselector.cpp index 365f383..013f43a 100644 --- a/library/fileselector.cpp +++ b/library/fileselector.cpp @@ -19,3 +19,9 @@ **********************************************************************/ + +// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT +// have this class. +#define QTOPIA_INTERNAL_FSLP + #include "fileselector.h" +#include "fileselector_p.h" #include "global.h" @@ -58,2 +64,3 @@ public: CategoryMenu *cm; + bool m_noItems:1; }; @@ -65,2 +72,3 @@ FileSelectorView::FileSelectorView( const QString &f, QWidget *parent, const cha d->cm = 0; + d->m_noItems = false; setAllColumnsShowFocus( TRUE ); @@ -82,6 +90,9 @@ void FileSelectorView::reread() { - FileSelectorItem *item = (FileSelectorItem *)selectedItem(); QString oldFile; - if ( item ) - oldFile = item->file().file(); + FileSelectorItem *item; + if( !d->m_noItems ) { // there are items + item = (FileSelectorItem *)selectedItem(); + if ( item ) + oldFile = item->file().file(); + } clear(); @@ -90,2 +101,8 @@ void FileSelectorView::reread() count = files.children().count(); + if(count == 0 ){ // No Documents + d->m_noItems = true; + QListViewItem *it = new QListViewItem(this, tr("There are no files in this directory." ), "empty" ); + it->setSelectable(FALSE ); + return; + } QListIterator<DocLnk> dit( files.children() ); @@ -239,2 +256,5 @@ void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, in return; + if(i->text(1) == QString::fromLatin1("empty" ) ) + return; + if ( button == Qt::LeftButton ) { @@ -248,2 +268,5 @@ void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, in return; + if(i->text(1) == QString::fromLatin1("empty" ) ) + return; + if ( button == Qt::RightButton ) { @@ -323,13 +346,2 @@ void FileSelector::setCloseVisible( bool b ) /*! - Sets whether a categories menu is visible, according to \a b. -*/ -void FileSelector::setCategoriesVisible( bool b ) -{ - if ( b ) - d->mb->show(); - else - d->mb->hide(); -} - -/*! Rereads the list of files. @@ -340 +352,2 @@ void FileSelector::reread() } + |