summaryrefslogtreecommitdiff
authorar <ar>2004-09-15 21:11:32 (UTC)
committer ar <ar>2004-09-15 21:11:32 (UTC)
commit6a60be54b98f1eb50df5a37454bb71bd52475f43 (patch) (side-by-side diff)
treeb14d617d0108f9612ce16e95d03c9b55b5d0cbd7
parente3709ce5db7f07cbac94900cb7b66ad3e7a6f791 (diff)
downloadopie-6a60be54b98f1eb50df5a37454bb71bd52475f43.zip
opie-6a60be54b98f1eb50df5a37454bb71bd52475f43.tar.gz
opie-6a60be54b98f1eb50df5a37454bb71bd52475f43.tar.bz2
- implement a QStringList* m_allList for show all files/directories if a "All Item" is selected. (hope the description is not too confused ;) )
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp26
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h3
-rw-r--r--libopie2/opieui/fileselector/ofileselector_p.h1
3 files changed, 27 insertions, 3 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 346eeae..e8d502f 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -529,8 +529,16 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e)
}
return false;
}
+/**
+ * @return true if the item show all files or directories
+ */
+bool OFileViewFileListView::allItem( const QString& item )const
+{
+ return m_sel->allItem( item );
+}
+
void OFileViewFileListView::connectSlots()
{
connect(m_view, SIGNAL(clicked(QListViewItem*) ),
this, SLOT(slotCurrentChanged(QListViewItem*) ) );
@@ -814,11 +822,11 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent )
}
return m_view;
}
-void OFileViewFileSystem::activate( const QString& str)
+void OFileViewFileSystem::activate( const QString& str )
{
- m_all = ( str.find( "All" ) != -1 );
+ m_all = m_view->allItem( str );
}
}
@@ -866,8 +874,10 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
m_mode = mode;
m_selector = sel;
+ m_allList = new QStringList();
+
initUI();
m_lneEdit->setText( fileName );
initMime();
initViews();
@@ -1022,12 +1032,14 @@ void OFileSelector::initViews()
if ( m_mode == OFileSelector::DIRECTORYSELECTOR )
{
m_views.insert( QObject::tr("Directories"), in );
m_views.insert( QObject::tr("All Directories"), in );
+ m_allList->append( QObject::tr("All Directories") );
} else {
m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) );
m_views.insert( QObject::tr("Files"), in );
m_views.insert( QObject::tr("All Files"), in );
+ m_allList->append( QObject::tr("All Files") );
}
}
void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) {
@@ -1145,8 +1157,16 @@ int OFileSelector::selector()const
{
return m_selector;
}
+/**
+ * @return true if the item show all files or directories
+ */
+bool OFileSelector::allItem( const QString& item )const
+{
+ return ( m_allList->findIndex( item ) != -1 );
+}
+
QStringList OFileSelector::currentMimeType()const
{
return m_mimeType[m_cmbMime->currentText()];
}
@@ -1174,17 +1194,17 @@ void OFileSelector::slotViewChange( const QString& view )
OFileViewInterface* interface = m_views[view];
if (!interface)
return;
- interface->activate( view );
if (m_current)
m_stack->removeWidget( m_current->widget( m_stack ) );
static int id = 1;
m_stack->addWidget( interface->widget(m_stack), id );
m_stack->raiseWidget( id );
+ interface->activate( view );
interface->reread();
m_current = interface;
id++;
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index b1cd405..d96712a 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -120,8 +120,9 @@ public:
void reread();
int mode()const;
int selector()const;
+ bool allItem( const QString& )const;
/**
* Set the Icon visible
* @param b Show or Hide the New Button
@@ -211,8 +212,10 @@ private:
QString m_startDir;
int m_mode;
int m_selector;
+ QStringList* m_allList;
+
struct Data; // used for future versions
Data *d;
private slots:
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h
index a3ef8e2..252a7f5 100644
--- a/libopie2/opieui/fileselector/ofileselector_p.h
+++ b/libopie2/opieui/fileselector/ofileselector_p.h
@@ -151,8 +151,9 @@ public:
OFileSelectorItem* currentItem()const;
void reread( bool all = false );
int fileCount()const;
QString currentDir()const;
+ bool allItem( const QString& )const;
protected:
bool eventFilter (QObject *o, QEvent *e);
private slots:
void slotNew(); // will emit newSelected