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
@@ -47,4 +47,5 @@ void OFileListView::addFile( const QPixmap& pix,
const QString&,
QFileInfo* info,
+ const QString& /*extra*/,
bool isSymlink ) {
QString dir;
@@ -71,9 +72,13 @@ void OFileListView::addFile( const QPixmap& pix,
void OFileListView::addFile( const QPixmap&,
const QString& /*mime*/, const QString& /*dir*/,
- const QString& /*file*/, bool /*isSyml*/ ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool /*isSyml*/ ) {
}
void OFileListView::addDir( const QPixmap& pix, const QString&,
- QFileInfo* info, bool symlink ) {
+ QFileInfo* info,
+ const QString& /*extra */,
+ bool symlink ) {
bool locked = false;
@@ -91,5 +96,7 @@ void OFileListView::addDir( const QPixmap& pix, const QString&,
void OFileListView::addDir( const QPixmap&,
const QString& /*mime*/, const QString& /*dir*/,
- const QString& /*file*/, bool ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool ) {
}
@@ -97,4 +104,5 @@ void OFileListView::addSymlink( const QPixmap&,
const QString& /*mime*/,
QFileInfo* /*info*/,
+ const QString& /*extra*/,
bool /*isSym*/ ) {
@@ -102,5 +110,7 @@ void OFileListView::addSymlink( const QPixmap&,
void OFileListView::addSymlink(const QPixmap&,
const QString& /*m*/, const QString& /*path*/,
- const QString& /*file*/, bool /*isSym*/ ) {
+ const QString& /*file*/,
+ const QString& /*extra*/,
+ bool /*isSym*/ ) {
}
@@ -128,5 +138,5 @@ QString OFileListView::selectedPath()const {
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
@@ -17,4 +17,5 @@ public:
const QString& mine,
QFileInfo* info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
@@ -23,20 +24,28 @@ public:
const QString& dir,
const QString& file,
+ const QString& extra = QString::null,
bool = false );
void addDir( const QPixmap&,
const QString& mime,
+ const QString& extra = QString::null,
QFileInfo* info, bool = FALSE );
void addDir( const QPixmap&,
const QString& mime, const QString& dir,
- const QString& file, bool = FALSE );
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE );
void addSymlink( const QPixmap&,
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 );
QWidget* widget();
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
@@ -394,19 +394,18 @@ QString OFileSelector::currentMimeType() const{
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
@@ -7,4 +7,5 @@ OFileSelectorItem::OFileSelectorItem( QListView*view,
const QString& size,
const QString& dir,
+ const QString& extra,
bool isLocked,
bool isDir )
@@ -18,4 +19,5 @@ OFileSelectorItem::OFileSelectorItem( QListView*view,
m_locked = isLocked;
m_dirStr = dir;
+ m_extra = extra;
}
OFileSelectorItem::~OFileSelectorItem() {
@@ -52,2 +54,5 @@ QString OFileSelectorItem::key( int id, bool ) {
return ke;
}
+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
@@ -13,4 +13,5 @@ public:
const QString& dir,
bool isLocked,
+ const QString& extra,
bool isDir = false);
~OFileSelectorItem();
@@ -20,4 +21,5 @@ public:
QString path()const;
QString key(int id, bool );
+ QString extra()const;
private:
@@ -25,5 +27,8 @@ private:
bool m_dir : 1;
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
@@ -13,18 +13,12 @@ OFileView::OFileView( OFileSelector* sel)
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 );
}
void OFileView::contextMenu() {
m_sel->internContextMenu();
}
-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 );
}
OFileSelector* OFileView::selector() const {
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
@@ -57,21 +57,28 @@ public:
const QString &mine,
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
virtual void addFile(const QPixmap&,
const QString& mine, const QString& dir,
- const QString& file, bool = FALSE ) = 0;
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE ) = 0;
virtual void addDir (const QPixmap&,
const QString &mine,
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
virtual void addDir (const QPixmap&,
const QString& mine, const QString& dir,
- const QString& file, bool = FALSE) = 0;
+ const QString& file,
+ const QString& extra = QString::null,
+ bool = FALSE) = 0;
virtual void addSymlink(const QPixmap&,
const QString &mime,
QFileInfo *info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -80,4 +87,5 @@ public:
const QString& path,
const QString& file,
+ const QString& extra = QString::null,
bool isSymlink = FALSE ) = 0;
@@ -95,9 +103,20 @@ public:
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 & );
/* updates the file name line of the FileSelector */
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,2 +1,4 @@
+#include <qcombobox.h>
+
#include "olister.h"
#include "ofileview.h"
@@ -6,5 +8,5 @@
OLister::OLister( OFileSelector* view)
- : m_view( view )
+ : m_view( view ), m_acc( 0l )
{
m_prov = new OPixmapProvider( view );
@@ -25,4 +27,5 @@ bool OLister::showDirs()const {
void OLister::addFile( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink :
@@ -33,4 +36,5 @@ void OLister::addFile( const QString& mine,
mine,
info,
+ extra,
isSymlink );
}
@@ -38,4 +42,5 @@ void OLister::addFile( const QString& mine,
const QString& path,
const QString& file,
+ const QString& extra,
bool isSymlink ) {
int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink :
@@ -47,8 +52,10 @@ void OLister::addFile( const QString& mine,
path,
file,
+ extra,
isSymlink );
}
void OLister::addDir( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink :
@@ -58,4 +65,5 @@ void OLister::addDir( const QString& mine,
mine,
info,
+ extra,
isSymlink );
}
@@ -63,4 +71,5 @@ void OLister::addDir( const QString& mine,
const QString& path,
const QString& dir,
+ const QString& extra,
bool isSymlink ) {
@@ -73,8 +82,10 @@ void OLister::addDir( const QString& mine,
path,
dir,
+ extra,
isSymlink );
}
void OLister::addSymlink( const QString& mine,
QFileInfo* info,
+ const QString& extra,
bool isSymlink ) {
QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info );
@@ -82,4 +93,5 @@ void OLister::addSymlink( const QString& mine,
mine,
info,
+ extra,
isSymlink );
}
@@ -87,4 +99,5 @@ void OLister::addSymlink( const QString& mine,
const QString& path,
const QString& name,
+ const QString& extra,
bool isSymlink ) {
QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine,
@@ -94,4 +107,5 @@ void OLister::addSymlink( const QString& mine,
path,
name,
+ extra,
isSymlink );
}
@@ -105,2 +119,44 @@ bool OLister::compliesMime( const QString& mime ) {
return view()->compliesMime( 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
@@ -7,6 +7,9 @@
#include <qstringlist.h>
+class QComboBox;
class OPixmapProvider;
class OFileSelector;
+
+class OListerCmbAccess;
/**
* lister is something like KIO but very
@@ -16,4 +19,5 @@ class OFileSelector;
* @see OLocalLister for a filesystem based implementation
*/
+
class OLister {
public:
@@ -28,5 +32,18 @@ public:
void setPixmapProvider( OPixmapProvider* );
+
+ /* 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;
bool showDirs()const;
@@ -34,8 +51,11 @@ protected:
void addFile( const QString& mine,
QFileInfo*,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
+
void addFile( const QString& mine,
const QString& path,
const QString& file,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
void addDir( const QString& mine,
@@ -45,11 +65,14 @@ protected:
const QString& path,
const QString& dir,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
void addSymlink( const QString& mine,
QFileInfo* info,
+ const QString& extra = QString::null,
bool isSymlink = FALSE);
void addSymlink( const QString& mine,
const QString& path,
const QString& name,
+ const QString& extra = QString::null,
bool isSymlink = FALSE );
OFileSelector* view();
@@ -58,5 +81,43 @@ private:
OFileSelector* m_view;
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
@@ -44,5 +44,6 @@ QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) {
return mimes;
}
-/* FIXME mimecheck
+/**
+ * FIXME mimecheck
* use mime check for that
* filter dirs