summaryrefslogtreecommitdiff
path: root/libopie2/opieui/fileselector/ofileselector_p.h
Unidiff
Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector_p.h191
1 files changed, 191 insertions, 0 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h
new file mode 100644
index 0000000..818ced9
--- a/dev/null
+++ b/libopie2/opieui/fileselector/ofileselector_p.h
@@ -0,0 +1,191 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (C) Holger Freyther <zecke@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29#ifndef OFILESELECTOR_PRIVATE_H
30#define OFILESELECTOR_PRIVATE_H
31
32/* OPIE */
33#include <qpe/applnk.h>
34#include <qpe/fileselector.h>
35
36/* QT */
37#include <qmap.h>
38#include <qstringlist.h>
39#include <qwidget.h>
40#include <qlistview.h>
41
42/*
43 * How to avoid having really two different objects
44 * for Extended and ExtendedAll
45 * The only difference is the Lister...
46 * a) static object?
47 * b) leave some object inside the OFileSelector which can be used?
48 * c) when switching views tell which view we want o have.. internally we can switch then
49 *
50 * I'll take c) -zecke
51 */
52
53typedef QMap<QString, QStringList> MimeTypes;
54
55/* the View Interface */
56class QFileInfo;
57class QToolButton;
58
59namespace Opie
60{
61
62class OFileSelector;
63
64class OFileViewInterface
65{
66public:
67 OFileViewInterface( OFileSelector* selector );
68 virtual ~OFileViewInterface();
69 virtual QString selectedName()const = 0;
70 virtual QString selectedPath()const = 0;
71 virtual QString directory()const = 0;
72 virtual void reread() = 0;
73 virtual int fileCount()const = 0;
74 virtual DocLnk selectedDocument()const;
75 virtual QWidget* widget( QWidget* parent) = 0;
76 virtual void activate( const QString& );
77 QString name()const;
78protected:
79 OFileSelector* selector()const;
80 void setName( const QString& );
81 bool showNew()const;
82 bool showClose()const;
83 MimeTypes mimeTypes()const;
84 QStringList currentMimeType()const;
85 QString startDirectory()const;
86protected:
87 void ok();
88 void cancel();
89 void closeMe();
90 void fileSelected( const QString& );
91 void fileSelected( const DocLnk& );
92 void setCurrentFileName( const QString& );
93 QString currentFileName()const;
94
95private:
96 QString m_name;
97 OFileSelector* m_selector;
98};
99
100
101/* THE Document View hosting a FileSelector*/
102class ODocumentFileView : public OFileViewInterface
103{
104public:
105 ODocumentFileView( OFileSelector* selector );
106 ~ODocumentFileView();
107
108 QString selectedName() const;
109 QString selectedPath() const;
110
111 QString directory() const;
112 void reread();
113 int fileCount()const;
114 DocLnk selectedDocument()const;
115
116 QWidget* widget( QWidget* parent );
117
118private:
119 mutable FileSelector* m_selector;
120
121};
122
123
124class OFileSelectorItem : public QListViewItem
125{
126public:
127 OFileSelectorItem( QListView* view, const QPixmap& pixmap,
128 const QString& path, const QString& date,
129 const QString& size, const QString& mDir,
130 bool isLocked = false, bool isDir = false );
131 ~OFileSelectorItem();
132 bool isLocked()const;
133 bool isDir()const;
134 QString directory()const;
135 QString path()const;
136 QString key(int id, bool )const;
137
138private:
139 bool m_locked : 1;
140 bool m_isDir : 1;
141 QString m_dir;
142};
143
144class OFileViewFileListView : public QWidget
145{
146 Q_OBJECT
147public:
148 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
149 ~OFileViewFileListView();
150
151 OFileSelectorItem* currentItem()const;
152 void reread( bool all = false );
153 int fileCount()const;
154 QString currentDir()const;
155protected:
156 bool eventFilter (QObject *o, QEvent *e);
157private slots:
158 void slotNew(); // will emit newSelected
159 void cdUP();
160 void cdHome();
161 void cdDoc();
162 void changeDir( const QString& );
163 void slotCurrentChanged( QListViewItem* );
164 void slotClicked(int, QListViewItem*, const QPoint&, int );
165 void slotFSActivated(int);
166
167protected:
168 OFileSelector* selector();
169
170private:
171 QMap<QString, QString> m_dev;
172 bool m_all : 1;
173 OFileSelector* m_sel;
174 QPopupMenu* m_fsPop;
175 bool compliesMime( const QString& );
176 QStringList m_mimes; // used in compy mime
177 QString m_currentDir;
178 QToolButton *m_btnNew, *m_btnClose;
179 void connectSlots();
180 void addFile( QFileInfo* info, bool symlink = FALSE );
181 void addDir ( QFileInfo* info, bool symlink = FALSE );
182 void addSymlink( QFileInfo* info, bool = FALSE );
183
184
185private:
186 QListView* m_view;
187};
188
189};
190
191#endif