summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp30
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h3
-rw-r--r--libopie2/opieui/fileselector/ofileselector_p.h2
3 files changed, 12 insertions, 23 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index e8d502f..01a51a2 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -153,12 +153,18 @@ QString OFileViewInterface::currentFileName()const
QString OFileViewInterface::startDirectory()const
{
return selector()->m_startDir;
}
+bool OFileViewInterface::allItem( const QString& item )const
+{
+ return selector()->m_allList.contains( item );
+}
+
+
ODocumentFileView::ODocumentFileView( OFileSelector* selector )
:OFileViewInterface( selector )
{
m_selector = 0;
setName( QObject::tr("Documents") );
}
@@ -527,20 +533,12 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e)
return true;
}
}
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*) ) );
connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
@@ -822,13 +820,13 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent )
}
return m_view;
}
void OFileViewFileSystem::activate( const QString& str )
{
- m_all = m_view->allItem( str );
+ m_all = allItem( str );
}
}
/* Selector */
/**
@@ -872,13 +870,13 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
m_mimeType = mimetypes;
m_startDir = dirName;
m_mode = mode;
m_selector = sel;
- m_allList = new QStringList();
+ m_allList = QStringList();
initUI();
m_lneEdit->setText( fileName );
initMime();
initViews();
@@ -1030,18 +1028,18 @@ void OFileSelector::initViews()
OFileViewInterface* in = new OFileViewFileSystem( this );
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") );
+ 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") );
+ m_allList.append( QObject::tr("All Files") );
}
}
void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) {
m_viewsPtr.append( iface );
}
@@ -1155,20 +1153,12 @@ int OFileSelector::mode()const
*/
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()];
}
void OFileSelector::slotMimeTypeChanged()
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index d96712a..d166afd 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -118,13 +118,12 @@ public:
int fileCount()const;
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
*/
void setNewVisible( bool b );
@@ -210,13 +209,13 @@ private:
QHBox* m_cmbBox; // this holds the two combo boxes
QString m_startDir;
int m_mode;
int m_selector;
- QStringList* m_allList;
+ QStringList m_allList;
struct Data; // used for future versions
Data *d;
private slots:
void slotMimeTypeChanged();
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h
index 252a7f5..790d2bd 100644
--- a/libopie2/opieui/fileselector/ofileselector_p.h
+++ b/libopie2/opieui/fileselector/ofileselector_p.h
@@ -72,12 +72,13 @@ public:
virtual void reread() = 0;
virtual int fileCount()const = 0;
virtual DocLnk selectedDocument()const;
virtual QWidget* widget( QWidget* parent) = 0;
virtual void activate( const QString& );
QString name()const;
+ bool allItem( const QString& )const;
protected:
OFileSelector* selector()const;
void setName( const QString& );
bool showNew()const;
bool showClose()const;
MimeTypes mimeTypes()const;
@@ -149,13 +150,12 @@ public:
~OFileViewFileListView();
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
void cdUP();
void cdHome();