summaryrefslogtreecommitdiff
path: root/libopie2/opieui/fileselector/ofileselector.h
Unidiff
Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h60
1 files changed, 59 insertions, 1 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index 7abe8b7..7fa657b 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -49,33 +49,57 @@ class QLineEdit;
49class QComboBox; 49class QComboBox;
50class QWidgetStack; 50class QWidgetStack;
51class QHBox; 51class QHBox;
52 52
53typedef QMap<QString, QStringList> MimeTypes; 53typedef QMap<QString, QStringList> MimeTypes;
54 54
55namespace Opie 55namespace Opie
56{ 56{
57 57
58class OFileViewInterface; 58class OFileViewInterface;
59class OFileViewFileListView; 59class OFileViewFileListView;
60 60
61
62/**
63 * @short a dropin replacement for the FileSelector
64 *
65 * This class is first used insert the OFileDialog.
66 * It supports multiple view and mimetype filtering for now.
67 *
68 * @see OFileDialog
69 * @see FileSelector
70 * @author zecke
71 * @version 0.1
72 */
61class OFileSelector : public QWidget 73class OFileSelector : public QWidget
62{ 74{
63 Q_OBJECT 75 Q_OBJECT
64 friend class Opie::OFileViewInterface; 76 friend class Opie::OFileViewInterface;
65 friend class Opie::OFileViewFileListView; 77 friend class Opie::OFileViewFileListView;
66 78
67public: 79public:
80 /**
81 * The Mode of the Fileselector
82 * Open = Open A File
83 * Save = Save a File
84 * FILESELECTOR = As A GUI in a screen to select a file
85 */
68 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 86 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
69 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 87 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
88 /**
89 * Normal = The old FileSelector
90 * Extended = Dir View
91 * ExtendedAll = Dir View with all hidden files
92 * Default = What the vendor considers best
93 */
70 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 94 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
71 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; 95 // enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
72 96
73 OFileSelector(QWidget* parent, int mode, int selector, 97 OFileSelector(QWidget* parent, int mode, int selector,
74 const QString& dirName, 98 const QString& dirName,
75 const QString& fileName, 99 const QString& fileName,
76 const MimeTypes& mimetypes = MimeTypes(), 100 const MimeTypes& mimetypes = MimeTypes(),
77 bool newVisible = FALSE, bool closeVisible = FALSE ); 101 bool newVisible = FALSE, bool closeVisible = FALSE );
78 102
79 OFileSelector(const QString& mimeFilter, QWidget* parent, 103 OFileSelector(const QString& mimeFilter, QWidget* parent,
80 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); 104 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
81 ~OFileSelector(); 105 ~OFileSelector();
@@ -85,35 +109,69 @@ public:
85 QString selectedName()const; 109 QString selectedName()const;
86 QString selectedPath()const; 110 QString selectedPath()const;
87 QString directory()const; 111 QString directory()const;
88 112
89 DocLnk selectedDocument()const; 113 DocLnk selectedDocument()const;
90 114
91 int fileCount()const; 115 int fileCount()const;
92 void reread(); 116 void reread();
93 117
94 int mode()const; 118 int mode()const;
95 int selector()const; 119 int selector()const;
96 120
97 121 /**
122 * Set the Icon visible
123 * @param b Show or Hide the New Button
124 */
98 void setNewVisible( bool b ); 125 void setNewVisible( bool b );
126
127 /**
128 * Set the Icon visible
129 */
99 void setCloseVisible( bool b ); 130 void setCloseVisible( bool b );
131
132 /**
133 * Set the Name Line visible
134 */
100 void setNameVisible( bool b ); 135 void setNameVisible( bool b );
101 136
102signals: 137signals:
138 /**
139 * dirSelected is emitted whenever changed into a different dir
140 */
103 void dirSelected( const QString& ); 141 void dirSelected( const QString& );
142
143 /**
144 * fileSelected is emitted when a file is selected
145 * it uses a DocLnk as parameter
146 */
104 void fileSelected( const DocLnk& ); 147 void fileSelected( const DocLnk& );
148
149 /**
150 * fileSelected is emitted when a file is selected
151 * the complete path is a parameter
152 */
105 void fileSelected( const QString& ); 153 void fileSelected( const QString& );
154
155 /**
156 * Create a new File with a DocLnk
157 */
106 void newSelected( const DocLnk& ); 158 void newSelected( const DocLnk& );
159
107 void closeMe(); 160 void closeMe();
161
162 /**
163 * Ok is emitted on a Qt::Key_Return or Q::Key_Enter
164 * in the line edit
165 */
108 void ok(); 166 void ok();
109 void cancel(); 167 void cancel();
110 168
111 /* used by the ViewInterface */ 169 /* used by the ViewInterface */
112private: 170private:
113 bool showNew()const; 171 bool showNew()const;
114 bool showClose()const; 172 bool showClose()const;
115 MimeTypes mimeTypes()const; 173 MimeTypes mimeTypes()const;
116 QStringList currentMimeType()const; 174 QStringList currentMimeType()const;
117 175
118private: 176private:
119 /* inits the Widgets */ 177 /* inits the Widgets */