summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2002-03-05 17:55:08 (UTC)
committer zecke <zecke>2002-03-05 17:55:08 (UTC)
commit7f0e92c12b41207fa75c82bc0b6f30fc57e7e77d (patch) (side-by-side diff)
tree81cd1145d106a8f08b1727f60eed60d3cee306b6 /library
parent81000382c5869cb26c243ec9364b688524c8a566 (diff)
downloadopie-7f0e92c12b41207fa75c82bc0b6f30fc57e7e77d.zip
opie-7f0e92c12b41207fa75c82bc0b6f30fc57e7e77d.tar.gz
opie-7f0e92c12b41207fa75c82bc0b6f30fc57e7e77d.tar.bz2
My fileselector patch mentioned on the list
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/fileselector.cpp41
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
@@ -17,7 +17,13 @@
** not clear to you.
**
**********************************************************************/
+
+// 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"
#include "resource.h"
#include "config.h"
@@ -56,6 +62,7 @@ class FileSelectorViewPrivate
{
public:
CategoryMenu *cm;
+ bool m_noItems:1;
};
FileSelectorView::FileSelectorView( const QString &f, QWidget *parent, const char *name )
@@ -63,6 +70,7 @@ FileSelectorView::FileSelectorView( const QString &f, QWidget *parent, const cha
{
d = new FileSelectorViewPrivate();
d->cm = 0;
+ d->m_noItems = false;
setAllColumnsShowFocus( TRUE );
addColumn( tr( "Name" ) );
header()->hide();
@@ -80,14 +88,23 @@ FileSelectorView::~FileSelectorView()
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();
DocLnkSet files;
Global::findDocuments(&files, filter);
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() );
for ( ; dit.current(); ++dit ) {
if (d->cm)
@@ -237,6 +254,9 @@ void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, in
{
if ( !i )
return;
+ if(i->text(1) == QString::fromLatin1("empty" ) )
+ return;
+
if ( button == Qt::LeftButton ) {
fileClicked( i );
}
@@ -246,6 +266,9 @@ void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, in
{
if ( !i )
return;
+ if(i->text(1) == QString::fromLatin1("empty" ) )
+ return;
+
if ( button == Qt::RightButton ) {
DocLnk l = ((FileSelectorItem *)i)->file();
LnkProperties prop( &l );
@@ -321,20 +344,10 @@ 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.
*/
void FileSelector::reread()
{
view->reread();
}
+