summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp22
-rw-r--r--core/apps/textedit/fileBrowser.h5
-rw-r--r--core/apps/textedit/textedit.cpp2
-rw-r--r--core/apps/textedit/textedit.h3
4 files changed, 23 insertions, 9 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
46fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 47fileBrowser::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() );
121mimeType="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
164void fileBrowser::setMimeType(const QString &type) {
165 mimeType = type;
166}
167
156void fileBrowser::setFileView( int selection ) 168void fileBrowser::setFileView( int selection )
157{ 169{
158 SelectionCombo->setCurrentItem( selection ); 170 SelectionCombo->setCurrentItem( selection );
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h
index 77ac166..1138d80 100644
--- a/core/apps/textedit/fileBrowser.h
+++ b/core/apps/textedit/fileBrowser.h
@@ -52,19 +52,20 @@ public:
52 fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0); 52 fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0);
53 ~fileBrowser(); 53 ~fileBrowser();
54 54
55 QString selectedFileName, mimeType; 55 QString selectedFileName;
56 QFile file; 56 QFile file;
57 QStringList fileList; 57 QStringList fileList;
58 QComboBox *SelectionCombo; 58 QComboBox *SelectionCombo;
59public slots: 59public slots:
60 void setFileView( int ); 60 void setFileView( int );
61 void setMimeType(const QString &);
61 62
62private: 63private:
63// QDict<void> mimes; 64// QDict<void> mimes;
64 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton; 65 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton;
65 QListView* ListView; 66 QListView* ListView;
66 QLabel *dirLabel; 67 QLabel *dirLabel;
67 QString filterStr; 68 QString filterStr, mimeType;
68 QDir currentDir; 69 QDir currentDir;
69 QStringList dirPathStringList; 70 QStringList dirPathStringList;
70 QListViewItem * item; 71 QListViewItem * item;
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index ecebe12..d28ece8 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -493,7 +493,7 @@ void TextEdit::fileNew()
493 493
494void TextEdit::fileOpen() 494void TextEdit::fileOpen()
495{ 495{
496 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 496 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "text/*"); //
497 browseForFiles->setFileView( viewSelection ); 497 browseForFiles->setFileView( viewSelection );
498 browseForFiles->showMaximized(); 498 browseForFiles->showMaximized();
499 if( browseForFiles->exec() != -1 ) { 499 if( browseForFiles->exec() != -1 ) {
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index 70cf068..af69518 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -52,7 +52,8 @@ class TextEdit : public QMainWindow
52public: 52public:
53 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 53 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
54 ~TextEdit(); 54 ~TextEdit();
55 QPopupMenu *font; 55
56 QPopupMenu *font;
56 QAction *nStart; 57 QAction *nStart;
57 bool edited, edited1; 58 bool edited, edited1;
58 void openFile( const QString & ); 59 void openFile( const QString & );