summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/ofilelistview.cpp20
-rw-r--r--libopie/ofileselector/ofilelistview.h15
-rw-r--r--libopie/ofileselector/ofileselector.cpp25
-rw-r--r--libopie/ofileselector/ofileselectoritem.cpp5
-rw-r--r--libopie/ofileselector/ofileselectoritem.h5
-rw-r--r--libopie/ofileselector/ofileview.cpp14
-rw-r--r--libopie/ofileselector/ofileview.h33
-rw-r--r--libopie/ofileselector/olister.cpp58
-rw-r--r--libopie/ofileselector/olister.h61
-rw-r--r--libopie/ofileselector/olocallister.cpp3
10 files changed, 199 insertions, 40 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp
index 691bf42..9cfdc48 100644
--- a/libopie/ofileselector/ofilelistview.cpp
+++ b/libopie/ofileselector/ofilelistview.cpp
@@ -48,2 +48,3 @@ void OFileListView::addFile( const QPixmap& pix,
QFileInfo* info,
+ const QString& /*extra*/,
bool isSymlink ) {
@@ -72,3 +73,5 @@ void OFileListView::addFile( const QPixmap&,
const QString& /*mime*/, const QString& /*dir*/,
- const QString& /*file*/, bool /*isSyml*/ ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool /*isSyml*/ ) {
@@ -76,3 +79,5 @@ void OFileListView::addFile( const QPixmap&,
void OFileListView::addDir( const QPixmap& pix, const QString&,
- QFileInfo* info, bool symlink ) {
+ QFileInfo* info,
+ const QString& /*extra */,
+ bool symlink ) {
@@ -92,3 +97,5 @@ void OFileListView::addDir( const QPixmap&,
const QString& /*mime*/, const QString& /*dir*/,
- const QString& /*file*/, bool ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool ) {
@@ -98,2 +105,3 @@ void OFileListView::addSymlink( const QPixmap&,
QFileInfo* /*info*/,
+ const QString& /*extra*/,
bool /*isSym*/ ) {
@@ -103,3 +111,5 @@ void OFileListView::addSymlink(const QPixmap&,
const QString& /*m*/, const QString& /*path*/,
- const QString& /*file*/, bool /*isSym*/ ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool /*isSym*/ ) {
@@ -129,3 +139,3 @@ QStringList OFileListView::selectedPaths()const {
QStringList list;
- list << selectedPath();
+b list << selectedPath();
return list;
diff --git a/libopie/ofileselector/ofilelistview.h b/libopie/ofileselector/ofilelistview.h
index c8cdfd1..0f625ec 100644
--- a/libopie/ofileselector/ofilelistview.h
+++ b/libopie/ofileselector/ofilelistview.h
@@ -18,2 +18,3 @@ public:
QFileInfo* info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
@@ -24,2 +25,3 @@ public:
const QString& file,
+ const QString& extra = QString::null,
bool = false );
@@ -28,2 +30,3 @@ public:
const QString& mime,
+ const QString& extra = QString::null,
QFileInfo* info, bool = FALSE );
@@ -32,3 +35,5 @@ public:
const QString& mime, const QString& dir,
- const QString& file, bool = FALSE );
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE );
@@ -36,6 +41,10 @@ public:
const QString& mime,
- QFileInfo* info, bool = FALSE );
+ QFileInfo* info,
+ const QString& extra = QString::null,
+ bool = FALSE );
void addSymlink( const QPixmap&,
const QString& mine, const QString& path,
- const QString& file, bool isSymlink = FALSE );
+ const QString& file,
+ const QString& extra,
+ bool isSymlink = FALSE );
void cd( const QString& path );
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 4ab744c..0ccb3cb 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -395,17 +395,16 @@ void OFileSelector::slotMimeCheck(const QString &mime)
{
- if( m_selector == Normal ){
- initializeOldSelector();
+ if( m_selector == Normal ){
+ initializeOldSelector();
- updateMimes();
- updateMimeCheck();
- m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
- }else{ // others
- qWarning("Mime %s", mime.latin1() );
- if(m_shChooser ){
- qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
- //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
+ updateMimes();
+ updateMimeCheck();
+ m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
+ }else{ // others
+ qWarning("Mime %s", mime.latin1() );
+ if(m_shChooser ){
+ qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
+ //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
+ }
+ reparse();
}
- reparse();
- }
-
}
diff --git a/libopie/ofileselector/ofileselectoritem.cpp b/libopie/ofileselector/ofileselectoritem.cpp
index 1e745a1..d31046b 100644
--- a/libopie/ofileselector/ofileselectoritem.cpp
+++ b/libopie/ofileselector/ofileselectoritem.cpp
@@ -8,2 +8,3 @@ OFileSelectorItem::OFileSelectorItem( QListView*view,
const QString& dir,
+ const QString& extra,
bool isLocked,
@@ -19,2 +20,3 @@ OFileSelectorItem::OFileSelectorItem( QListView*view,
m_dirStr = dir;
+ m_extra = extra;
}
@@ -53 +55,4 @@ QString OFileSelectorItem::key( int id, bool ) {
}
+QString OFileSelector::extra()const {
+ return m_extra;
+}
diff --git a/libopie/ofileselector/ofileselectoritem.h b/libopie/ofileselector/ofileselectoritem.h
index 21460c4..81966ae 100644
--- a/libopie/ofileselector/ofileselectoritem.h
+++ b/libopie/ofileselector/ofileselectoritem.h
@@ -14,2 +14,3 @@ public:
bool isLocked,
+ const QString& extra,
bool isDir = false);
@@ -21,2 +22,3 @@ public:
QString key(int id, bool );
+ QString extra()const;
@@ -26,3 +28,6 @@ private:
QString m_dirStr;
+ QString m_extra;
+ class Private;
+ Private* d;
};
diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp
index 38f722c..72d2f60 100644
--- a/libopie/ofileselector/ofileview.cpp
+++ b/libopie/ofileselector/ofileview.cpp
@@ -14,7 +14,4 @@ OFileView::~OFileView() {
}
-void OFileView::fileSelected( const QString& s ) {
- m_sel->internFileSelected( s );
-}
-void OFileView::fileSelected( const DocLnk& s) {
- m_sel->internFileSelected( s );
+void OFileView::fileSelected( const QString& dir,const QString& file,const QString& extra ) {
+ m_sel->currentLister()->fileSelected( dir,file,extra );
}
@@ -23,7 +20,4 @@ void OFileView::contextMenu() {
}
-void OFileView::changedDir( const QString& s) {
- m_sel->internChangedDir( s );
-}
-void OFileView::changedDir( const QDir& d ) {
- m_sel->internChangedDir( d );
+void OFileView::changedDir( const QString& s, const QString& file, const QString& extra) {
+ m_sel->currentLister()->changedDir( s, file,extra );
}
diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h
index d7ea4a2..808587f 100644
--- a/libopie/ofileselector/ofileview.h
+++ b/libopie/ofileselector/ofileview.h
@@ -58,2 +58,3 @@ public:
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -62,3 +63,5 @@ public:
const QString& mine, const QString& dir,
- const QString& file, bool = FALSE ) = 0;
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE ) = 0;
@@ -67,2 +70,3 @@ public:
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -70,3 +74,5 @@ public:
const QString& mine, const QString& dir,
- const QString& file, bool = FALSE) = 0;
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE) = 0;
@@ -75,2 +81,3 @@ public:
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -81,2 +88,3 @@ public:
const QString& file,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -96,7 +104,18 @@ protected:
- void fileSelected(const QString &);
- void fileSelected(const DocLnk & );
- void contextMenu();
- void changedDir(const QString &);
- void changedDir(const QDir & );
+ /**
+ * @param dir The dir name
+ * @param file The file name
+ * @param extra The extra information
+ */
+ void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::nulll);
+ void contextMenu();
+
+ /**
+ *
+ * @param dir The dir name
+ * @param file The file name
+ * @param extra The extra informations
+ */
+ void changedDir(const QString &dir, const QString& file, const QString& extra = QString::null);
+ void changedDir(const QDir & );
diff --git a/libopie/ofileselector/olister.cpp b/libopie/ofileselector/olister.cpp
index b6b03cd..378c69d 100644
--- a/libopie/ofileselector/olister.cpp
+++ b/libopie/ofileselector/olister.cpp
@@ -1 +1,3 @@
+#include <qcombobox.h>
+
#include "olister.h"
@@ -7,3 +9,3 @@
OLister::OLister( OFileSelector* view)
- : m_view( view )
+ : m_view( view ), m_acc( 0l )
{
@@ -26,2 +28,3 @@ void OLister::addFile( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
@@ -34,2 +37,3 @@ void OLister::addFile( const QString& mine,
info,
+ extra,
isSymlink );
@@ -39,2 +43,3 @@ void OLister::addFile( const QString& mine,
const QString& file,
+ const QString& extra,
bool isSymlink ) {
@@ -48,2 +53,3 @@ void OLister::addFile( const QString& mine,
file,
+ extra,
isSymlink );
@@ -52,2 +58,3 @@ void OLister::addDir( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
@@ -59,2 +66,3 @@ void OLister::addDir( const QString& mine,
info,
+ extra,
isSymlink );
@@ -64,2 +72,3 @@ void OLister::addDir( const QString& mine,
const QString& dir,
+ const QString& extra,
bool isSymlink ) {
@@ -74,2 +83,3 @@ void OLister::addDir( const QString& mine,
dir,
+ extra,
isSymlink );
@@ -78,2 +88,3 @@ void OLister::addSymlink( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
@@ -83,2 +94,3 @@ void OLister::addSymlink( const QString& mine,
info,
+ extra,
isSymlink );
@@ -88,2 +100,3 @@ void OLister::addSymlink( const QString& mine,
const QString& name,
+ const QString& extra,
bool isSymlink ) {
@@ -95,2 +108,3 @@ void OLister::addSymlink( const QString& mine,
name,
+ extra,
isSymlink );
@@ -106 +120,43 @@ bool OLister::compliesMime( const QString& mime ) {
}
+OListerCmbAccess* OLister::comboBox() {
+ if (!m_acc )
+ m_acc = new OListerCmbAccess( view()->m_location );
+
+ return m_acc;
+}
+
+
+OListerCmbAccess::OListerCmbAccess(QComboBox* box )
+ : m_cmb( cmb )
+{}
+OListerCmbAccess::~OListerCmbAccess() {
+}
+void OListerCmbAccess::clear() {
+ if ( m_cmb )
+ m_cmb->clear();
+}
+void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) {
+ if ( !m_cmb ) return;
+
+
+ int c = m_cmb->count();
+ for ( int i = 0; i < m_cmb->count(); i++ ) {
+ if ( m_cmb->text(i) == add ) {
+ bo->setCurrentItem( i );
+ return;
+ }
+ }
+ m_cmb->insertItem(add );
+ m_cmb->setCurrentItem( c );
+}
+void OListerCmbAccess::insert( const QString& str ) {
+ if ( m_cmb )
+ m_cmb->insertItem( str );
+}
+QString OListerCmbAccess::currentText()const {
+ QString str;
+ if (m_cmb )
+ str = m_cmb->currentText();
+
+ return str;
+}
diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h
index 0885525..79d5409 100644
--- a/libopie/ofileselector/olister.h
+++ b/libopie/ofileselector/olister.h
@@ -8,4 +8,7 @@
+class QComboBox;
class OPixmapProvider;
class OFileSelector;
+
+class OListerCmbAccess;
/**
@@ -17,2 +20,3 @@ class OFileSelector;
*/
+
class OLister {
@@ -29,3 +33,16 @@ public:
+
+ /* some way a slot */
+ void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0;
+ void changeDir( const QString& dir, const QString& file, const QString& extra ) = 0;
protected:
+ /**
+ * I hate too big classes
+ * this is a way to group
+ * access to a ComboBox
+ * which might exist or
+ * not in a secure way
+ */
+ OListerCmbAccess* comboBox();
+
bool showFiles()const;
@@ -35,3 +52,5 @@ protected:
QFileInfo*,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
+
void addFile( const QString& mine,
@@ -39,2 +58,3 @@ protected:
const QString& file,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
@@ -46,2 +66,3 @@ protected:
const QString& dir,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
@@ -49,2 +70,3 @@ protected:
QFileInfo* info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE);
@@ -53,2 +75,3 @@ protected:
const QString& name,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
@@ -59,3 +82,41 @@ private:
OPixmapProvider* m_prov;
+ OListerCmbAccess* m_acc;
+
+ class Private;
+ Private *d;
+};
+
+class OListerCmbAccess {
+ friend class OLister;
+public:
+ OListerCmbAccess( QComboBox* = 0l);
+ ~OListerCmbAccess();
+
+ /**
+ * clears the combobox
+ */
+ void clear();
+
+ /**
+ * set's @param add to be the current Item
+ * if the item is not present it'll be removed
+ */
+ void setCurrentItem( const QString& add, bool FORECE_ADD = TRUE );
+
+ /**
+ * inserts the the String at
+ * a non predictable position... The position is determined
+ * by the QComboBox code
+ */
+ void insert( const QString& );
+
+ /**
+ *
+ */
+ QString currentText()const;
+private:
+ class Private;
+ Private* d;
+ QComboBox* m_cmb;
diff --git a/libopie/ofileselector/olocallister.cpp b/libopie/ofileselector/olocallister.cpp
index 6ffcf1e..2306b14 100644
--- a/libopie/ofileselector/olocallister.cpp
+++ b/libopie/ofileselector/olocallister.cpp
@@ -45,3 +45,4 @@ QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) {
}
-/* FIXME mimecheck
+/**
+ * FIXME mimecheck
* use mime check for that