-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 72 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 60 |
2 files changed, 131 insertions, 1 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 71d765c..600daff 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -813,2 +813,31 @@ void OFileViewFileSystem::activate( const QString& str) | |||
813 | /* Selector */ | 813 | /* Selector */ |
814 | /** | ||
815 | * @short new and complete c'tor | ||
816 | * | ||
817 | * 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 | ||
819 | * as a dropin for the FileSelector. | ||
820 | * | ||
821 | * <pre> | ||
822 | * QMap<QString, QStringList> mimeTypes; | ||
823 | * QStringList types; | ||
824 | * types << "text@slash* "; | ||
825 | * types << "audio@slash*"; | ||
826 | * mimeTypes.insert( tr("Audio and Text"), types ); | ||
827 | * mimeTypes.insert( tr("All"), "*@slash*); | ||
828 | * | ||
829 | * now you could create your fileselector | ||
830 | * </pre> | ||
831 | * | ||
832 | * | ||
833 | * @param parent the parent of this widget | ||
834 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) | ||
835 | * @param sel The selector to be used | ||
836 | * @param dirName The name of the dir to start int | ||
837 | * @param fileName The fileName placed in the fileselector lineedit | ||
838 | * @param mimetypes The MimeType map of used mimetypes | ||
839 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. | ||
840 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. | ||
841 | * | ||
842 | */ | ||
814 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | 843 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, |
@@ -854,2 +883,6 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
854 | 883 | ||
884 | |||
885 | /** | ||
886 | * This a convience c'tor to just substitute the use of FileSelector | ||
887 | */ | ||
855 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, | 888 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, |
@@ -960,2 +993,5 @@ void OFileSelector::initViews() | |||
960 | 993 | ||
994 | /** | ||
995 | * d'tor | ||
996 | */ | ||
961 | OFileSelector::~OFileSelector() | 997 | OFileSelector::~OFileSelector() |
@@ -964,2 +1000,11 @@ OFileSelector::~OFileSelector() | |||
964 | 1000 | ||
1001 | |||
1002 | |||
1003 | /** | ||
1004 | * Convience function for the fileselector | ||
1005 | * make sure to delete the DocLnk | ||
1006 | * | ||
1007 | * @see DocLnk | ||
1008 | * @todo remove in ODP | ||
1009 | */ | ||
965 | const DocLnk* OFileSelector::selected() | 1010 | const DocLnk* OFileSelector::selected() |
@@ -970,2 +1015,6 @@ const DocLnk* OFileSelector::selected() | |||
970 | 1015 | ||
1016 | /** | ||
1017 | * | ||
1018 | * @return the name of the selected file | ||
1019 | */ | ||
971 | QString OFileSelector::selectedName()const | 1020 | QString OFileSelector::selectedName()const |
@@ -975,2 +1024,6 @@ QString OFileSelector::selectedName()const | |||
975 | 1024 | ||
1025 | |||
1026 | /** | ||
1027 | * @return the selected path | ||
1028 | */ | ||
976 | QString OFileSelector::selectedPath()const | 1029 | QString OFileSelector::selectedPath()const |
@@ -980,2 +1033,5 @@ QString OFileSelector::selectedPath()const | |||
980 | 1033 | ||
1034 | /** | ||
1035 | * @return the directory name | ||
1036 | */ | ||
981 | QString OFileSelector::directory()const | 1037 | QString OFileSelector::directory()const |
@@ -985,2 +1041,5 @@ QString OFileSelector::directory()const | |||
985 | 1041 | ||
1042 | /** | ||
1043 | * @return a DocLnk for the selected document | ||
1044 | */ | ||
986 | DocLnk OFileSelector::selectedDocument()const | 1045 | DocLnk OFileSelector::selectedDocument()const |
@@ -990,2 +1049,5 @@ DocLnk OFileSelector::selectedDocument()const | |||
990 | 1049 | ||
1050 | /** | ||
1051 | * @return the number of items for the current view | ||
1052 | */ | ||
991 | int OFileSelector::fileCount()const | 1053 | int OFileSelector::fileCount()const |
@@ -995,2 +1057,5 @@ int OFileSelector::fileCount()const | |||
995 | 1057 | ||
1058 | /** | ||
1059 | * @return reparse the file content | ||
1060 | */ | ||
996 | void OFileSelector::reread() | 1061 | void OFileSelector::reread() |
@@ -1020,2 +1085,5 @@ MimeTypes OFileSelector::mimeTypes()const | |||
1020 | 1085 | ||
1086 | /** | ||
1087 | * @return the Mode of the OFileSelector | ||
1088 | */ | ||
1021 | int OFileSelector::mode()const | 1089 | int OFileSelector::mode()const |
@@ -1025,2 +1093,6 @@ int OFileSelector::mode()const | |||
1025 | 1093 | ||
1094 | |||
1095 | /** | ||
1096 | * @return the Selector of the OFileSelector | ||
1097 | */ | ||
1026 | int OFileSelector::selector()const | 1098 | int OFileSelector::selector()const |
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 | |||
@@ -60,2 +60,14 @@ class 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 | */ | ||
61 | class OFileSelector : public QWidget | 73 | class OFileSelector : public QWidget |
@@ -67,4 +79,16 @@ class OFileSelector : public QWidget | |||
67 | public: | 79 | public: |
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 }; |
@@ -96,5 +120,16 @@ public: | |||
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 ); |
@@ -102,7 +137,30 @@ public: | |||
102 | signals: | 137 | signals: |
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(); |