summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofileselector.cpp78
-rw-r--r--libopie/ofileselector.h62
2 files changed, 139 insertions, 1 deletions
diff --git a/libopie/ofileselector.cpp b/libopie/ofileselector.cpp
index 577e916..9afe9c7 100644
--- a/libopie/ofileselector.cpp
+++ b/libopie/ofileselector.cpp
@@ -630,2 +630,31 @@ void OFileViewFileSystem::activate( const QString& str) {
630/* Selector */ 630/* Selector */
631/**
632 * @short new and complete c'tor
633 *
634 * Create a OFileSelector to let the user select a file. It can
635 * either be used to open a file, select a save name in a dir or
636 * as a dropin for the FileSelector.
637 *
638 * <pre>
639 * QMap<QString, QStringList> mimeTypes;
640 * QStringList types;
641 * types << "text[slash]* ";
642 * types << "audio[slash]*";
643 * mimeTypes.insert( tr("Audio and Text"), types );
644 * mimeTypes.insert( tr("All"), "*[slash]*);
645 *
646 * now you could create your fileselector
647 * </pre>
648 *
649 *
650 * @param parent the parent of this widget
651 * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR)
652 * @param sel The selector to be used
653 * @param dirName The name of the dir to start int
654 * @param fileName The fileName placed in the fileselector lineedit
655 * @param mimetypes The MimeType map of used mimetypes
656 * @param showNew Show a New Button. Most likely to be used in the FileSelector view.
657 * @param showClose Show a Close Button. Most likely to be used in FileSelector view.
658 *
659 */
631OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, 660OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
@@ -669,2 +698,6 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
669} 698}
699
700/**
701 * This a convience c'tor to just substitute the use of FileSelector
702 */
670OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, 703OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
@@ -765,2 +798,6 @@ void OFileSelector::initViews() {
765} 798}
799
800/**
801 * d'tor
802 */
766OFileSelector::~OFileSelector() { 803OFileSelector::~OFileSelector() {
@@ -768,2 +805,10 @@ OFileSelector::~OFileSelector() {
768} 805}
806
807/**
808 * Convience function for the fileselector
809 * make sure to delete the DocLnk
810 *
811 * @see DocLnk
812 * @todo remove in ODP
813 */
769const DocLnk* OFileSelector::selected() { 814const DocLnk* OFileSelector::selected() {
@@ -772,2 +817,7 @@ const DocLnk* OFileSelector::selected() {
772} 817}
818
819/**
820 *
821 * @return the name of the selected file
822 */
773QString OFileSelector::selectedName()const{ 823QString OFileSelector::selectedName()const{
@@ -775,2 +825,6 @@ QString OFileSelector::selectedName()const{
775} 825}
826
827/**
828 * @return the selected path
829 */
776QString OFileSelector::selectedPath()const { 830QString OFileSelector::selectedPath()const {
@@ -778,2 +832,6 @@ QString OFileSelector::selectedPath()const {
778} 832}
833
834/**
835 * @return the directory name
836 */
779QString OFileSelector::directory()const { 837QString OFileSelector::directory()const {
@@ -781,2 +839,6 @@ QString OFileSelector::directory()const {
781} 839}
840
841/**
842 * @return a DocLnk for the selected document
843 */
782DocLnk OFileSelector::selectedDocument()const { 844DocLnk OFileSelector::selectedDocument()const {
@@ -784,2 +846,6 @@ DocLnk OFileSelector::selectedDocument()const {
784} 846}
847
848/**
849 * @return the number of items for the current view
850 */
785int OFileSelector::fileCount()const { 851int OFileSelector::fileCount()const {
@@ -787,2 +853,6 @@ int OFileSelector::fileCount()const {
787} 853}
854
855/**
856 * @return reparse the file content
857 */
788void OFileSelector::reread() { 858void OFileSelector::reread() {
@@ -802,2 +872,6 @@ MimeTypes OFileSelector::mimeTypes()const {
802} 872}
873
874/**
875 * @return the Mode of the OFileSelector
876 */
803int OFileSelector::mode()const{ 877int OFileSelector::mode()const{
@@ -805,2 +879,6 @@ int OFileSelector::mode()const{
805} 879}
880
881/**
882 * @return the Selector of the OFileSelector
883 */
806int OFileSelector::selector()const{ 884int OFileSelector::selector()const{
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index bdb3e56..767455c 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -53,2 +53,15 @@ class QWidgetStack;
53class QHBox; 53class QHBox;
54
55
56/**
57 * @short a dropin replacement for the FileSelector
58 *
59 * This class is first used insert the OFileDialog.
60 * It supports multiple view and mimetype filtering for now.
61 *
62 * @see OFileDialog
63 * @see FileSelector
64 * @author zecke
65 * @version 0.1
66 */
54class OFileSelector : public QWidget { 67class OFileSelector : public QWidget {
@@ -58,4 +71,16 @@ class OFileSelector : public QWidget {
58public: 71public:
72 /**
73 * The Mode of the Fileselector
74 * Open = Open A File
75 * Save = Save a File
76 * FILESELECTOR = As A GUI in a screen to select a file
77 */
59 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 78 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
60// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 79// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
80 /**
81 * Normal = The old FileSelector
82 * Extended = Dir View
83 * ExtendedAll = Dir View with all hidden files
84 * Default = What the vendor considers best
85 */
61 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 86 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
@@ -63,2 +88,3 @@ public:
63 88
89
64 OFileSelector(QWidget* parent, int mode, int selector, 90 OFileSelector(QWidget* parent, int mode, int selector,
@@ -87,5 +113,16 @@ public:
87 113
88 114 /**
115 * Set the Icon visible
116 * @param b Show or Hide the New Button
117 */
89 void setNewVisible( bool b ); 118 void setNewVisible( bool b );
119
120 /**
121 * Set the Icon visible
122 */
90 void setCloseVisible( bool b ); 123 void setCloseVisible( bool b );
124
125 /**
126 * Set the Name Line visible
127 */
91 void setNameVisible( bool b ); 128 void setNameVisible( bool b );
@@ -93,7 +130,30 @@ public:
93signals: 130signals:
131 /**
132 * dirSelected is emitted whenever changed into a different dir
133 */
94 void dirSelected( const QString& ); 134 void dirSelected( const QString& );
135
136 /**
137 * fileSelected is emitted when a file is selected
138 * it uses a DocLnk as parameter
139 */
95 void fileSelected( const DocLnk& ); 140 void fileSelected( const DocLnk& );
141
142 /**
143 * fileSelected is emitted when a file is selected
144 * the complete path is a parameter
145 */
96 void fileSelected( const QString& ); 146 void fileSelected( const QString& );
147
148 /**
149 * Create a new File with a DocLnk
150 */
97 void newSelected( const DocLnk& ); 151 void newSelected( const DocLnk& );
152
98 void closeMe(); 153 void closeMe();
154
155 /**
156 * Ok is emitted on a Qt::Key_Return or Q::Key_Enter
157 * in the line edit
158 */
99 void ok(); 159 void ok();