libopie API Documentation

ofileselector_p.h

00001 #ifndef OPIE_OFILE_SELECTOR_PRIVATE_H
00002 #define OPIE_OFILE_SELECTOR_PRIVATE_H
00003 
00004 #include <qmap.h>
00005 #include <qstringlist.h>
00006 #include <qwidget.h>
00007 #include <qlistview.h>
00008 
00009 #include <qpe/applnk.h>
00010 #include <qpe/fileselector.h>
00011 
00012 
00013 /*
00014  * How to avoid having really two different objects
00015  * for Extended and ExtendedAll
00016  * The only difference is the Lister...
00017  * a) static object?
00018  * b) leave some object inside the OFileSelector which can be used?
00019  * c) when switching views tell which view we want o have.. internally we can switch then
00020  *
00021  * I'll take c) -zecke
00022  */
00023 
00024 
00025 /* the View Interface */
00026 class OFileSelector;
00027 typedef QMap<QString, QStringList> MimeTypes;
00028 class QFileInfo;
00029 class QToolButton;
00030 class OFileViewInterface {
00031 public:
00032     OFileViewInterface( OFileSelector* selector );
00033     virtual ~OFileViewInterface();
00034     virtual QString selectedName()const = 0;
00035     virtual QString selectedPath()const = 0;
00036     virtual QString directory()const = 0;
00037     virtual void reread() = 0;
00038     virtual int fileCount()const = 0;
00039     virtual DocLnk selectedDocument()const;
00040     virtual QWidget* widget( QWidget* parent) = 0;
00041     virtual void activate( const QString& );
00042     QString name()const;
00043 protected:
00044     OFileSelector* selector()const;
00045     void setName( const QString& );
00046     bool showNew()const;
00047     bool showClose()const;
00048     MimeTypes mimeTypes()const;
00049     QStringList currentMimeType()const;
00050     QString startDirectory()const;
00051 protected:
00052     void ok();
00053     void cancel();
00054     void closeMe();
00055     void fileSelected( const QString& );
00056     void fileSelected( const DocLnk& );
00057     void setCurrentFileName( const QString& );
00058     QString currentFileName()const;
00059 
00060 private:
00061     QString m_name;
00062     OFileSelector* m_selector;
00063 };
00064 
00065 
00066 /* THE Document View hosting a FileSelector*/
00067 class ODocumentFileView : public OFileViewInterface {
00068 public:
00069     ODocumentFileView( OFileSelector* selector );
00070     ~ODocumentFileView();
00071 
00072     QString selectedName() const;
00073     QString selectedPath() const;
00074 
00075     QString directory() const;
00076     void reread();
00077     int fileCount()const;
00078     DocLnk selectedDocument()const;
00079 
00080     QWidget* widget( QWidget* parent );
00081 
00082 private:
00083     mutable FileSelector* m_selector;
00084 
00085 };
00086 
00087 class OFileSelectorItem : public QListViewItem {
00088 public:
00089     OFileSelectorItem( QListView* view, const QPixmap& pixmap,
00090                        const QString& path, const QString& date,
00091                        const QString& size, const QString& mDir,
00092                        bool isLocked = false, bool isDir = false );
00093     ~OFileSelectorItem();
00094     bool isLocked()const;
00095     bool isDir()const;
00096     QString directory()const;
00097     QString path()const;
00098     QString key(int id, bool )const;
00099 
00100 private:
00101     bool m_locked : 1;
00102     bool m_isDir    : 1;
00103     QString m_dir;
00104 };
00105 
00106 class OFileViewFileListView : public QWidget {
00107     Q_OBJECT
00108 public:
00109     OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
00110     ~OFileViewFileListView();
00111 
00112     OFileSelectorItem* currentItem()const;
00113     void reread( bool all = false );
00114     int fileCount()const;
00115     QString currentDir()const;
00116 protected:
00117     bool eventFilter (QObject *o, QEvent *e);
00118 private slots:
00119     void slotNew(); // will emit newSelected
00120     void cdUP();
00121     void cdHome();
00122     void cdDoc();
00123     void changeDir( const QString& );
00124     void slotCurrentChanged( QListViewItem* );
00125     void slotClicked(int, QListViewItem*, const QPoint&, int );
00126     void slotFSActivated(int);
00127 
00128 protected:
00129 
00130     OFileSelector* selector();
00131 
00132 private:
00133     QMap<QString, QString> m_dev;
00134     bool m_all : 1;
00135     OFileSelector* m_sel;
00136     QPopupMenu* m_fsPop;
00137     bool compliesMime( const QString& );
00138     QStringList m_mimes; // used in compy mime
00139     QString m_currentDir;
00140     QToolButton *m_btnNew, *m_btnClose;
00141     void connectSlots();
00142     void addFile( QFileInfo* info, bool symlink = FALSE );
00143     void addDir ( QFileInfo* info, bool symlink = FALSE );
00144     void addSymlink( QFileInfo* info, bool = FALSE );
00145 
00146 
00147 private:
00148     QListView* m_view;
00149 };
00150 
00151 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001