Diffstat (limited to 'core/apps/textedit/fileBrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index e103bcb..7a3a703 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -11,6 +11,7 @@ | |||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #define QTOPIA_INTERNAL_MIMEEXT | ||
14 | #include "fileBrowser.h" | 15 | #include "fileBrowser.h" |
15 | //#include "inputDialog.h" | 16 | //#include "inputDialog.h" |
16 | 17 | ||
@@ -43,13 +44,22 @@ static int get_unique_id() | |||
43 | return u_id++; | 44 | return u_id++; |
44 | } | 45 | } |
45 | 46 | ||
46 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) | 47 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) |
47 | : QDialog( parent, name, modal, fl ) | 48 | : QDialog( parent, name, modal, fl ) |
48 | { | 49 | { |
49 | if ( !name ) | 50 | if ( !name ) |
50 | setName( "fileBrowser" ); | 51 | setName( "fileBrowser" ); |
51 | setCaption(tr( name ) ); | 52 | setCaption(tr( name ) ); |
52 | filterStr = filter; | 53 | mimeType = mimeFilter; |
54 | MimeType mt( mimeType); | ||
55 | if( mt.extension().isEmpty()) | ||
56 | filterStr = "*"; | ||
57 | else | ||
58 | filterStr = "*."+ mt.extension(); | ||
59 | // qDebug("description "+mt.description()); | ||
60 | // qDebug( "id "+mt.id()); | ||
61 | // qDebug("extension "+mt.extension()); | ||
62 | |||
53 | // channel = new QCopChannel( "QPE/fileDialog", this ); | 63 | // channel = new QCopChannel( "QPE/fileDialog", this ); |
54 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 64 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
55 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); | 65 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); |
@@ -79,7 +89,6 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
79 | cdUpButton ->setFlat(TRUE); | 89 | cdUpButton ->setFlat(TRUE); |
80 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); | 90 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); |
81 | 91 | ||
82 | |||
83 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 92 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
84 | docButton->setMinimumSize( QSize( 20, 20 ) ); | 93 | docButton->setMinimumSize( QSize( 20, 20 ) ); |
85 | docButton->setMaximumSize( QSize( 20, 20 ) ); | 94 | docButton->setMaximumSize( QSize( 20, 20 ) ); |
@@ -96,7 +105,6 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
96 | 105 | ||
97 | FileStack = new QWidgetStack( this ); | 106 | FileStack = new QWidgetStack( this ); |
98 | 107 | ||
99 | |||
100 | ListView = new QListView( this, "ListView" ); | 108 | ListView = new QListView( this, "ListView" ); |
101 | // ListView->setMinimumSize( QSize( 100, 25 ) ); | 109 | // ListView->setMinimumSize( QSize( 100, 25 ) ); |
102 | ListView->addColumn( tr( "Name" ) ); | 110 | ListView->addColumn( tr( "Name" ) ); |
@@ -118,7 +126,7 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
118 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 126 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
119 | 127 | ||
120 | FileStack->addWidget( ListView, get_unique_id() ); | 128 | FileStack->addWidget( ListView, get_unique_id() ); |
121 | mimeType="text/*"; | 129 | |
122 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 130 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
123 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 131 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
124 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 132 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
@@ -153,6 +161,10 @@ fileBrowser::~fileBrowser() | |||
153 | { | 161 | { |
154 | } | 162 | } |
155 | 163 | ||
164 | void fileBrowser::setMimeType(const QString &type) { | ||
165 | mimeType = type; | ||
166 | } | ||
167 | |||
156 | void fileBrowser::setFileView( int selection ) | 168 | void fileBrowser::setFileView( int selection ) |
157 | { | 169 | { |
158 | SelectionCombo->setCurrentItem( selection ); | 170 | SelectionCombo->setCurrentItem( selection ); |