summaryrefslogtreecommitdiff
Side-by-side diff
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) {
/* Selector */
+/**
+ * @short new and complete c'tor
+ *
+ * Create a OFileSelector to let the user select a file. It can
+ * either be used to open a file, select a save name in a dir or
+ * as a dropin for the FileSelector.
+ *
+ * <pre>
+ * QMap<QString, QStringList> mimeTypes;
+ * QStringList types;
+ * types << "text[slash]* ";
+ * types << "audio[slash]*";
+ * mimeTypes.insert( tr("Audio and Text"), types );
+ * mimeTypes.insert( tr("All"), "*[slash]*);
+ *
+ * now you could create your fileselector
+ * </pre>
+ *
+ *
+ * @param parent the parent of this widget
+ * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR)
+ * @param sel The selector to be used
+ * @param dirName The name of the dir to start int
+ * @param fileName The fileName placed in the fileselector lineedit
+ * @param mimetypes The MimeType map of used mimetypes
+ * @param showNew Show a New Button. Most likely to be used in the FileSelector view.
+ * @param showClose Show a Close Button. Most likely to be used in FileSelector view.
+ *
+ */
OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
@@ -669,2 +698,6 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
}
+
+/**
+ * This a convience c'tor to just substitute the use of FileSelector
+ */
OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
@@ -765,2 +798,6 @@ void OFileSelector::initViews() {
}
+
+/**
+ * d'tor
+ */
OFileSelector::~OFileSelector() {
@@ -768,2 +805,10 @@ OFileSelector::~OFileSelector() {
}
+
+/**
+ * Convience function for the fileselector
+ * make sure to delete the DocLnk
+ *
+ * @see DocLnk
+ * @todo remove in ODP
+ */
const DocLnk* OFileSelector::selected() {
@@ -772,2 +817,7 @@ const DocLnk* OFileSelector::selected() {
}
+
+/**
+ *
+ * @return the name of the selected file
+ */
QString OFileSelector::selectedName()const{
@@ -775,2 +825,6 @@ QString OFileSelector::selectedName()const{
}
+
+/**
+ * @return the selected path
+ */
QString OFileSelector::selectedPath()const {
@@ -778,2 +832,6 @@ QString OFileSelector::selectedPath()const {
}
+
+/**
+ * @return the directory name
+ */
QString OFileSelector::directory()const {
@@ -781,2 +839,6 @@ QString OFileSelector::directory()const {
}
+
+/**
+ * @return a DocLnk for the selected document
+ */
DocLnk OFileSelector::selectedDocument()const {
@@ -784,2 +846,6 @@ DocLnk OFileSelector::selectedDocument()const {
}
+
+/**
+ * @return the number of items for the current view
+ */
int OFileSelector::fileCount()const {
@@ -787,2 +853,6 @@ int OFileSelector::fileCount()const {
}
+
+/**
+ * @return reparse the file content
+ */
void OFileSelector::reread() {
@@ -802,2 +872,6 @@ MimeTypes OFileSelector::mimeTypes()const {
}
+
+/**
+ * @return the Mode of the OFileSelector
+ */
int OFileSelector::mode()const{
@@ -805,2 +879,6 @@ int OFileSelector::mode()const{
}
+
+/**
+ * @return the Selector of the OFileSelector
+ */
int 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;
class QHBox;
+
+
+/**
+ * @short a dropin replacement for the FileSelector
+ *
+ * This class is first used insert the OFileDialog.
+ * It supports multiple view and mimetype filtering for now.
+ *
+ * @see OFileDialog
+ * @see FileSelector
+ * @author zecke
+ * @version 0.1
+ */
class OFileSelector : public QWidget {
@@ -58,4 +71,16 @@ class OFileSelector : public QWidget {
public:
+ /**
+ * The Mode of the Fileselector
+ * Open = Open A File
+ * Save = Save a File
+ * FILESELECTOR = As A GUI in a screen to select a file
+ */
enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
+ /**
+ * Normal = The old FileSelector
+ * Extended = Dir View
+ * ExtendedAll = Dir View with all hidden files
+ * Default = What the vendor considers best
+ */
enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
@@ -63,2 +88,3 @@ public:
+
OFileSelector(QWidget* parent, int mode, int selector,
@@ -87,5 +113,16 @@ public:
-
+ /**
+ * Set the Icon visible
+ * @param b Show or Hide the New Button
+ */
void setNewVisible( bool b );
+
+ /**
+ * Set the Icon visible
+ */
void setCloseVisible( bool b );
+
+ /**
+ * Set the Name Line visible
+ */
void setNameVisible( bool b );
@@ -93,7 +130,30 @@ public:
signals:
+ /**
+ * dirSelected is emitted whenever changed into a different dir
+ */
void dirSelected( const QString& );
+
+ /**
+ * fileSelected is emitted when a file is selected
+ * it uses a DocLnk as parameter
+ */
void fileSelected( const DocLnk& );
+
+ /**
+ * fileSelected is emitted when a file is selected
+ * the complete path is a parameter
+ */
void fileSelected( const QString& );
+
+ /**
+ * Create a new File with a DocLnk
+ */
void newSelected( const DocLnk& );
+
void closeMe();
+
+ /**
+ * Ok is emitted on a Qt::Key_Return or Q::Key_Enter
+ * in the line edit
+ */
void ok();