summaryrefslogtreecommitdiff
path: root/libopie2/opieui/fileselector
Unidiff
Diffstat (limited to 'libopie2/opieui/fileselector') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.cpp2
-rw-r--r--libopie2/opieui/fileselector/ofiledialog.h7
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp9
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h19
-rw-r--r--libopie2/opieui/fileselector/ofileselector_p.h10
-rw-r--r--libopie2/opieui/fileselector/ofileview.h9
6 files changed, 36 insertions, 20 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp
index e7daead..beb4d6c 100644
--- a/libopie2/opieui/fileselector/ofiledialog.cpp
+++ b/libopie2/opieui/fileselector/ofiledialog.cpp
@@ -30,25 +30,25 @@
30/* OPIE */ 30/* OPIE */
31#include <opie2/ofiledialog.h> 31#include <opie2/ofiledialog.h>
32#include <qpe/applnk.h> 32#include <qpe/applnk.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35 35
36/* QT */ 36/* QT */
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qapplication.h> 39#include <qapplication.h>
40#include <qlayout.h> 40#include <qlayout.h>
41 41
42using namespace Opie; 42using namespace Opie::Ui;
43 43
44namespace 44namespace
45{ 45{
46/* 46/*
47 * helper functions to load the start dir 47 * helper functions to load the start dir
48 * and to save it 48 * and to save it
49 * helper to extract the dir out of a file name 49 * helper to extract the dir out of a file name
50 */ 50 */
51/** 51/**
52 * This method will use Config( argv[0] ); 52 * This method will use Config( argv[0] );
53 * @param key The group key used 53 * @param key The group key used
54 */ 54 */
diff --git a/libopie2/opieui/fileselector/ofiledialog.h b/libopie2/opieui/fileselector/ofiledialog.h
index 01a599b..dfecf3d 100644
--- a/libopie2/opieui/fileselector/ofiledialog.h
+++ b/libopie2/opieui/fileselector/ofiledialog.h
@@ -26,26 +26,26 @@
26 26
27*/ 27*/
28 28
29#ifndef OFILEDIALOG_H 29#ifndef OFILEDIALOG_H
30#define OFILEDIALOG_H 30#define OFILEDIALOG_H
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/ofileselector.h> 33#include <opie2/ofileselector.h>
34 34
35/* QT */ 35/* QT */
36#include <qdialog.h> 36#include <qdialog.h>
37 37
38namespace Opie 38namespace Opie {
39{ 39namespace Ui {
40 40
41/** 41/**
42 * This class places a OFileSelector inside a QDialog. 42 * This class places a OFileSelector inside a QDialog.
43 * It provides static method for letting a user chose 43 * It provides static method for letting a user chose
44 * a file for either opening or saving. 44 * a file for either opening or saving.
45 * Most of the time the c'tor will not be used instead using 45 * Most of the time the c'tor will not be used instead using
46 * the static member functions is prefered. 46 * the static member functions is prefered.
47 * 47 *
48 * <pre> 48 * <pre>
49 * QMap<QString, QStringList> mimeTypes; 49 * QMap<QString, QStringList> mimeTypes;
50 * QStringList types; 50 * QStringList types;
51 * types << "text[slash]* "; 51 * types << "text[slash]* ";
@@ -95,15 +95,16 @@ public:
95 95
96private: 96private:
97 class OFileDialogPrivate; 97 class OFileDialogPrivate;
98 OFileDialogPrivate *d; 98 OFileDialogPrivate *d;
99 OFileSelector *file; 99 OFileSelector *file;
100 100
101private slots: 101private slots:
102 void slotFileSelected( const QString & ); 102 void slotFileSelected( const QString & );
103 void slotDirSelected(const QString & ); 103 void slotDirSelected(const QString & );
104 void slotSelectorOk(); 104 void slotSelectorOk();
105}; 105};
106 106
107}; 107}
108}
108 109
109#endif 110#endif
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 15cadd4..c4d5033 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -46,26 +46,29 @@
46#include <qdir.h> 46#include <qdir.h>
47#include <qhbox.h> 47#include <qhbox.h>
48#include <qheader.h> 48#include <qheader.h>
49#include <qlabel.h> 49#include <qlabel.h>
50#include <qlayout.h> 50#include <qlayout.h>
51#include <qlineedit.h> 51#include <qlineedit.h>
52#include <qlistview.h> 52#include <qlistview.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54#include <qwidgetstack.h> 54#include <qwidgetstack.h>
55#include <qregexp.h> 55#include <qregexp.h>
56#include <qobjectlist.h> 56#include <qobjectlist.h>
57 57
58using namespace Opie; 58using namespace Opie::Ui::Private;
59 59
60namespace Opie {
61namespace Ui {
62namespace Private {
60OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 63OFileViewInterface::OFileViewInterface( OFileSelector* selector )
61 : m_selector( selector ) 64 : m_selector( selector )
62{} 65{}
63 66
64OFileViewInterface::~OFileViewInterface() 67OFileViewInterface::~OFileViewInterface()
65{} 68{}
66 69
67QString OFileViewInterface::name()const 70QString OFileViewInterface::name()const
68{ 71{
69 return m_name; 72 return m_name;
70} 73}
71 74
@@ -801,24 +804,26 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent )
801 if (!m_view ) 804 if (!m_view )
802 { 805 {
803 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 806 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
804 } 807 }
805 return m_view; 808 return m_view;
806} 809}
807 810
808void OFileViewFileSystem::activate( const QString& str) 811void OFileViewFileSystem::activate( const QString& str)
809{ 812{
810 m_all = (str != QObject::tr("Files") ); 813 m_all = (str != QObject::tr("Files") );
811} 814}
812 815
816
817}
813/* Selector */ 818/* Selector */
814/** 819/**
815 * @short new and complete c'tor 820 * @short new and complete c'tor
816 * 821 *
817 * Create a OFileSelector to let the user select a file. It can 822 * Create a OFileSelector to let the user select a file. It can
818 * either be used to open a file, select a save name in a dir or 823 * either be used to open a file, select a save name in a dir or
819 * as a dropin for the FileSelector. 824 * as a dropin for the FileSelector.
820 * 825 *
821 * <pre> 826 * <pre>
822 * QMap<QString, QStringList> mimeTypes; 827 * QMap<QString, QStringList> mimeTypes;
823 * QStringList types; 828 * QStringList types;
824 * types << "text@slash* "; 829 * types << "text@slash* ";
@@ -1155,12 +1160,14 @@ void OFileSelector::setCloseVisible( bool b )
1155 m_shClose = b; 1160 m_shClose = b;
1156 currentView()->reread(); 1161 currentView()->reread();
1157} 1162}
1158 1163
1159void OFileSelector::setNameVisible( bool b ) 1164void OFileSelector::setNameVisible( bool b )
1160{ 1165{
1161 if ( b ) 1166 if ( b )
1162 m_nameBox->show(); 1167 m_nameBox->show();
1163 else 1168 else
1164 m_nameBox->hide(); 1169 m_nameBox->hide();
1165} 1170}
1166 1171
1172}
1173}
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index 7fa657b..2205963 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -43,47 +43,49 @@
43#include <qwidget.h> 43#include <qwidget.h>
44#include <qmap.h> 44#include <qmap.h>
45#include <qvaluelist.h> 45#include <qvaluelist.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47 47
48class QLineEdit; 48class 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{ 56namespace Ui {
57 57
58namespace Private {
58class OFileViewInterface; 59class OFileViewInterface;
59class OFileViewFileListView; 60class OFileViewFileListView;
61}
60 62
61 63
62/** 64/**
63 * @short a dropin replacement for the FileSelector 65 * @short a dropin replacement for the FileSelector
64 * 66 *
65 * This class is first used insert the OFileDialog. 67 * This class is first used insert the OFileDialog.
66 * It supports multiple view and mimetype filtering for now. 68 * It supports multiple view and mimetype filtering for now.
67 * 69 *
68 * @see OFileDialog 70 * @see OFileDialog
69 * @see FileSelector 71 * @see FileSelector
70 * @author zecke 72 * @author zecke
71 * @version 0.1 73 * @version 0.1
72 */ 74 */
73class OFileSelector : public QWidget 75class OFileSelector : public QWidget
74{ 76{
75 Q_OBJECT 77 Q_OBJECT
76 friend class Opie::OFileViewInterface; 78 friend class Private::OFileViewInterface;
77 friend class Opie::OFileViewFileListView; 79 friend class Private::OFileViewFileListView;
78 80
79public: 81public:
80 /** 82 /**
81 * The Mode of the Fileselector 83 * The Mode of the Fileselector
82 * Open = Open A File 84 * Open = Open A File
83 * Save = Save a File 85 * Save = Save a File
84 * FILESELECTOR = As A GUI in a screen to select a file 86 * FILESELECTOR = As A GUI in a screen to select a file
85 */ 87 */
86 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 88 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
87 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 89 // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
88 /** 90 /**
89 * Normal = The old FileSelector 91 * Normal = The old FileSelector
@@ -176,44 +178,45 @@ private:
176private: 178private:
177 /* inits the Widgets */ 179 /* inits the Widgets */
178 void initUI(); 180 void initUI();
179 /* inits the MimeType ComboBox content + connects signals and slots */ 181 /* inits the MimeType ComboBox content + connects signals and slots */
180 void initMime(); 182 void initMime();
181 /* init the Views :) */ 183 /* init the Views :) */
182 void initViews(); 184 void initViews();
183 185
184private: 186private:
185 QLineEdit* m_lneEdit; // the LineEdit for the Name 187 QLineEdit* m_lneEdit; // the LineEdit for the Name
186 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType 188 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType
187 QWidgetStack* m_stack; // our widget stack which will contain the views 189 QWidgetStack* m_stack; // our widget stack which will contain the views
188 OFileViewInterface* currentView() const; // returns the currentView 190 Private::OFileViewInterface* currentView() const; // returns the currentView
189 OFileViewInterface* m_current; // here is the view saved 191 Private::OFileViewInterface* m_current; // here is the view saved
190 bool m_shNew : 1; // should we show New? 192 bool m_shNew : 1; // should we show New?
191 bool m_shClose : 1; // should we show Close? 193 bool m_shClose : 1; // should we show Close?
192 MimeTypes m_mimeType; // list of mimetypes 194 MimeTypes m_mimeType; // list of mimetypes
193 195
194 QMap<QString, OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr 196 QMap<QString, Private::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr
195 QHBox* m_nameBox; // the LineEdit + Label is hold here 197 QHBox* m_nameBox; // the LineEdit + Label is hold here
196 QHBox* m_cmbBox; // this holds the two combo boxes 198 QHBox* m_cmbBox; // this holds the two combo boxes
197 199
198 QString m_startDir; 200 QString m_startDir;
199 int m_mode; 201 int m_mode;
200 int m_selector; 202 int m_selector;
201 203
202 struct Data; // used for future versions 204 struct Data; // used for future versions
203 Data *d; 205 Data *d;
204 206
205private slots: 207private slots:
206 void slotMimeTypeChanged(); 208 void slotMimeTypeChanged();
207 209
208 /* will set the text of the lineedit and emit a fileChanged signal */ 210 /* will set the text of the lineedit and emit a fileChanged signal */
209 void slotDocLnkBridge( const DocLnk& ); 211 void slotDocLnkBridge( const DocLnk& );
210 void slotFileBridge( const QString& ); 212 void slotFileBridge( const QString& );
211 void slotViewChange( const QString& ); 213 void slotViewChange( const QString& );
212 214
213 bool eventFilter (QObject *o, QEvent *e); 215 bool eventFilter (QObject *o, QEvent *e);
214 216
215}; 217};
216 218
217}; 219}
220}
218 221
219#endif 222#endif
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h
index 818ced9..376dc98 100644
--- a/libopie2/opieui/fileselector/ofileselector_p.h
+++ b/libopie2/opieui/fileselector/ofileselector_p.h
@@ -47,28 +47,28 @@
47 * b) leave some object inside the OFileSelector which can be used? 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 48 * c) when switching views tell which view we want o have.. internally we can switch then
49 * 49 *
50 * I'll take c) -zecke 50 * I'll take c) -zecke
51 */ 51 */
52 52
53typedef QMap<QString, QStringList> MimeTypes; 53typedef QMap<QString, QStringList> MimeTypes;
54 54
55/* the View Interface */ 55/* the View Interface */
56class QFileInfo; 56class QFileInfo;
57class QToolButton; 57class QToolButton;
58 58
59namespace Opie 59namespace Opie{
60{ 60namespace Ui{
61
62class OFileSelector; 61class OFileSelector;
62namespace Private {
63 63
64class OFileViewInterface 64class OFileViewInterface
65{ 65{
66public: 66public:
67 OFileViewInterface( OFileSelector* selector ); 67 OFileViewInterface( OFileSelector* selector );
68 virtual ~OFileViewInterface(); 68 virtual ~OFileViewInterface();
69 virtual QString selectedName()const = 0; 69 virtual QString selectedName()const = 0;
70 virtual QString selectedPath()const = 0; 70 virtual QString selectedPath()const = 0;
71 virtual QString directory()const = 0; 71 virtual QString directory()const = 0;
72 virtual void reread() = 0; 72 virtual void reread() = 0;
73 virtual int fileCount()const = 0; 73 virtual int fileCount()const = 0;
74 virtual DocLnk selectedDocument()const; 74 virtual DocLnk selectedDocument()const;
@@ -177,15 +177,17 @@ private:
177 QString m_currentDir; 177 QString m_currentDir;
178 QToolButton *m_btnNew, *m_btnClose; 178 QToolButton *m_btnNew, *m_btnClose;
179 void connectSlots(); 179 void connectSlots();
180 void addFile( QFileInfo* info, bool symlink = FALSE ); 180 void addFile( QFileInfo* info, bool symlink = FALSE );
181 void addDir ( QFileInfo* info, bool symlink = FALSE ); 181 void addDir ( QFileInfo* info, bool symlink = FALSE );
182 void addSymlink( QFileInfo* info, bool = FALSE ); 182 void addSymlink( QFileInfo* info, bool = FALSE );
183 183
184 184
185private: 185private:
186 QListView* m_view; 186 QListView* m_view;
187}; 187};
188 188
189}; 189}
190}
191}
190 192
191#endif 193#endif
diff --git a/libopie2/opieui/fileselector/ofileview.h b/libopie2/opieui/fileselector/ofileview.h
index 495401b..aaf56b1 100644
--- a/libopie2/opieui/fileselector/ofileview.h
+++ b/libopie2/opieui/fileselector/ofileview.h
@@ -28,26 +28,27 @@
28 28
29#ifndef OFILEVIEW_H 29#ifndef OFILEVIEW_H
30#define OFILEVIEW_H 30#define OFILEVIEW_H
31 31
32/* QT */ 32/* QT */
33#include <qobject.h> 33#include <qobject.h>
34#include <qwidget.h> 34#include <qwidget.h>
35 35
36class QFileInfo; 36class QFileInfo;
37class QDir; 37class QDir;
38class DocLnk; 38class DocLnk;
39 39
40namespace Opie 40namespace Opie {
41{ 41namespace Ui {
42namespace Private {
42 43
43/** 44/**
44 * A OFileView is a specialised View for the 45 * A OFileView is a specialised View for the
45 * OFileSelector 46 * OFileSelector
46 * With a View you can chage the user visible 47 * With a View you can chage the user visible
47 * representation of a OFileLister 48 * representation of a OFileLister
48 * OFileView is just a basic interface which helps you to 49 * OFileView is just a basic interface which helps you to
49 * write new views 50 * write new views
50 */ 51 */
51class OFileView : public QWidget 52class OFileView : public QWidget
52{ 53{
53 Q_OBJECT 54 Q_OBJECT
@@ -81,15 +82,17 @@ signals:
81 82
82class OFileViewFactory 83class OFileViewFactory
83{ 84{
84 // Q_OBJECT 85 // Q_OBJECT
85public: 86public:
86 OFileViewFactory() {} ; 87 OFileViewFactory() {} ;
87 virtual ~OFileViewFactory() = 0; 88 virtual ~OFileViewFactory() = 0;
88 89
89 OFileView* newView(QWidget *parent, const char *name ); 90 OFileView* newView(QWidget *parent, const char *name );
90 QString name()const; 91 QString name()const;
91}; 92};
92 93
93}; 94}
95}
96}
94 97
95#endif 98#endif