Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ofileselector_p.h

Go to the documentation of this file.
00001 /*
00002                =.            This file is part of the OPIE Project
00003              .=l.            Copyright (C) Holger Freyther <zecke@handhelds.org>
00004            .>+-=
00005  _;:,     .>    :=|.         This library is free software; you can
00006 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00007 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00008 .="- .-=="i,     .._         License as published by the Free Software
00009  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00010      ._= =}       :          or (at your option) any later version.
00011     .%`+i>       _;_.
00012     .i_,=:_.      -<s.       This library is distributed in the hope that
00013      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00014     : ..    .:,     . . .    without even the implied warranty of
00015     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00016   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00017 ..}^=.=       =       ;      Library General Public License for more
00018 ++=   -.     .`     .:       details.
00019  :     =  ...= . :.=-
00020  -.   .:....=;==+<;          You should have received a copy of the GNU
00021   -_. . .   )=.  =           Library General Public License along with
00022     --        :-=`           this library; see the file COPYING.LIB.
00023                              If not, write to the Free Software Foundation,
00024                              Inc., 59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 #ifndef OFILESELECTOR_PRIVATE_H
00030 #define OFILESELECTOR_PRIVATE_H
00031 
00032 /* OPIE */
00033 #include <qpe/applnk.h>
00034 #include <qpe/fileselector.h>
00035 
00036 /* QT */
00037 #include <qmap.h>
00038 #include <qstringlist.h>
00039 #include <qwidget.h>
00040 #include <qlistview.h>
00041 
00042 /*
00043  * How to avoid having really two different objects
00044  * for Extended and ExtendedAll
00045  * The only difference is the Lister...
00046  * a) static object?
00047  * b) leave some object inside the OFileSelector which can be used?
00048  * c) when switching views tell which view we want o have.. internally we can switch then
00049  *
00050  * I'll take c) -zecke
00051  */
00052 
00053 typedef QMap<QString, QStringList> MimeTypes;
00054 
00055 /* the View Interface */
00056 class QFileInfo;
00057 class QToolButton;
00058 
00059 namespace Opie{
00060 namespace Ui{
00061 class OFileSelector;
00062 namespace Internal {
00063 
00064 class OFileViewInterface
00065 {
00066 public:
00067     OFileViewInterface( OFileSelector* selector );
00068     virtual ~OFileViewInterface();
00069     virtual QString selectedName()const = 0;
00070     virtual QString selectedPath()const = 0;
00071     virtual QString directory()const = 0;
00072     virtual void reread() = 0;
00073     virtual int fileCount()const = 0;
00074     virtual DocLnk selectedDocument()const;
00075     virtual QWidget* widget( QWidget* parent) = 0;
00076     virtual void activate( const QString& );
00077     QString name()const;
00078     bool allItem( const QString& )const;
00079 protected:
00080     OFileSelector* selector()const;
00081     void setName( const QString& );
00082     bool showNew()const;
00083     bool showClose()const;
00084     MimeTypes mimeTypes()const;
00085     QStringList currentMimeType()const;
00086     QString startDirectory()const;
00087 protected:
00088     void ok();
00089     void cancel();
00090     void closeMe();
00091     void fileSelected( const QString& );
00092     void fileSelected( const DocLnk& );
00093     void setCurrentFileName( const QString& );
00094     QString currentFileName()const;
00095 
00096 private:
00097     QString m_name;
00098     OFileSelector* m_selector;
00099 };
00100 
00101 
00102 /* THE Document View hosting a FileSelector*/
00103 class ODocumentFileView : public OFileViewInterface
00104 {
00105 public:
00106     ODocumentFileView( OFileSelector* selector );
00107     ~ODocumentFileView();
00108 
00109     QString selectedName() const;
00110     QString selectedPath() const;
00111 
00112     QString directory() const;
00113     void reread();
00114     int fileCount()const;
00115     DocLnk selectedDocument()const;
00116 
00117     QWidget* widget( QWidget* parent );
00118 
00119 private:
00120     mutable FileSelector* m_selector;
00121 
00122 };
00123 
00124 
00125 class OFileSelectorItem : public QListViewItem
00126 {
00127 public:
00128     OFileSelectorItem( QListView* view, const QPixmap& pixmap,
00129                        const QString& path, const QString& date,
00130                        const QString& size, const QString& mDir,
00131                        bool isLocked = false, bool isDir = false );
00132     ~OFileSelectorItem();
00133     bool isLocked()const;
00134     bool isDir()const;
00135     QString directory()const;
00136     QString path()const;
00137     QString key(int id, bool )const;
00138 
00139 private:
00140     QString m_dir;
00141     bool m_isDir  : 1;
00142     bool m_locked : 1;
00143 };
00144 
00145 class OFileViewFileListView : public QWidget
00146 {
00147     Q_OBJECT
00148 public:
00149     OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
00150     ~OFileViewFileListView();
00151 
00152     OFileSelectorItem* currentItem()const;
00153     void reread( bool all = false );
00154     int fileCount()const;
00155     QString currentDir()const;
00156 protected:
00157     bool eventFilter (QObject *o, QEvent *e);
00158 private slots:
00159     void slotNew(); // will emit newSelected
00160     void cdUP();
00161     void cdHome();
00162     void cdDoc();
00163     void changeDir( const QString& );
00164     void slotCurrentChanged( QListViewItem* );
00165     void slotClicked(int, QListViewItem*, const QPoint&, int );
00166     void slotFSActivated(int);
00167     void slotFSpressed();
00168 
00169 protected:
00170     OFileSelector* selector();
00171 
00172 private:
00173     QMap<QString, QString> m_dev;
00174     bool m_all : 1;
00175     OFileSelector* m_sel;
00176     QPopupMenu* m_fsPop;
00177     bool compliesMime( const QString& );
00178     QStringList m_mimes; // used in compy mime
00179     QString m_currentDir;
00180     QToolButton *m_btnNew, *m_btnClose;
00181     QToolButton *m_fsButton;
00182     void connectSlots();
00183     void addFile( QFileInfo* info, bool symlink = FALSE );
00184     void addDir ( QFileInfo* info, bool symlink = FALSE );
00185     void addSymlink( QFileInfo* info, bool = FALSE );
00186 
00187 
00188 private:
00189     QListView* m_view;
00190 };
00191 
00192 }
00193 }
00194 }
00195 
00196 #endif

Generated on Sat Nov 5 16:16:25 2005 for OPIE by  doxygen 1.4.2