summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp3
-rw-r--r--core/apps/textedit/fileBrowser.h23
2 files changed, 13 insertions, 13 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index f3e4e1e..e103bcb 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,149 +1,148 @@
1/**************************************************************************** 1/****************************************************************************
2** copyright 2001 ljp ljp@llornkcor.com 2** copyright 2001 ljp ljp@llornkcor.com
3** Created: Fri Dec 14 08:16:46 2001 3** Created: Fri Dec 14 08:16:46 2001
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
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#include "fileBrowser.h" 14#include "fileBrowser.h"
15//#include "inputDialog.h" 15//#include "inputDialog.h"
16 16
17#include <qpe/config.h> 17#include <qpe/config.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <qpe/fileselector.h> 19#include <qpe/fileselector.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/menubutton.h> 21#include <qpe/menubutton.h>
22#include <qpe/mimetype.h> 22#include <qpe/mimetype.h>
23 23
24#include <qdict.h> 24#include <qdict.h>
25#include <qwidgetstack.h> 25#include <qwidgetstack.h>
26#include <qlistview.h> 26#include <qlistview.h>
27#include <qcombo.h> 27#include <qcombo.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qmessagebox.h> 30#include <qmessagebox.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <qpopupmenu.h> 33#include <qpopupmenu.h>
34#include <qlineedit.h> 34#include <qlineedit.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36 36
37#include <unistd.h> 37#include <unistd.h>
38#include <stdlib.h> 38#include <stdlib.h>
39 39
40static int u_id = 1; 40static int u_id = 1;
41static int get_unique_id() 41static int get_unique_id()
42{ 42{
43 return u_id++; 43 return u_id++;
44} 44}
45 45
46fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 46fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
47 : QDialog( parent, name, modal, fl ) 47 : QDialog( parent, name, modal, fl )
48{ 48{
49 if ( !name ) 49 if ( !name )
50 setName( "fileBrowser" ); 50 setName( "fileBrowser" );
51 setCaption(tr( name ) ); 51 setCaption(tr( name ) );
52 filterStr=filter; 52 filterStr = filter;
53
54// channel = new QCopChannel( "QPE/fileDialog", this ); 53// channel = new QCopChannel( "QPE/fileDialog", this );
55// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 54// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
56// this, SLOT(receive(const QCString&, const QByteArray&)) ); 55// this, SLOT(receive(const QCString&, const QByteArray&)) );
57 56
58 QGridLayout *layout = new QGridLayout( this ); 57 QGridLayout *layout = new QGridLayout( this );
59 layout->setSpacing( 4 ); 58 layout->setSpacing( 4 );
60 layout->setMargin( 4 ); 59 layout->setMargin( 4 );
61 60
62 dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" ); 61 dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" );
63 dirPathCombo->setEditable(TRUE); 62 dirPathCombo->setEditable(TRUE);
64 63
65 connect( dirPathCombo, SIGNAL( activated( const QString & ) ), 64 connect( dirPathCombo, SIGNAL( activated( const QString & ) ),
66 this, SLOT( dirPathComboActivated( const QString & ) ) ); 65 this, SLOT( dirPathComboActivated( const QString & ) ) );
67 66
68 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), 67 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ),
69 this, SLOT( dirPathEditPressed( ) ) ); 68 this, SLOT( dirPathEditPressed( ) ) );
70 69
71 dirPathStringList << "/"; 70 dirPathStringList << "/";
72// we can get the storage here 71// we can get the storage here
73 72
74 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); 73 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 );
75 74
76 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 75 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
77 cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); 76 cdUpButton ->setMinimumSize( QSize( 20, 20 ) );
78 cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); 77 cdUpButton ->setMaximumSize( QSize( 20, 20 ) );
79 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 78 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
80 cdUpButton ->setFlat(TRUE); 79 cdUpButton ->setFlat(TRUE);
81 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); 80 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 );
82 81
83 82
84 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 83 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
85 docButton->setMinimumSize( QSize( 20, 20 ) ); 84 docButton->setMinimumSize( QSize( 20, 20 ) );
86 docButton->setMaximumSize( QSize( 20, 20 ) ); 85 docButton->setMaximumSize( QSize( 20, 20 ) );
87 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 86 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
88 docButton->setFlat(TRUE); 87 docButton->setFlat(TRUE);
89 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 88 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
90 89
91 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 90 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
92 homeButton->setMinimumSize( QSize( 20, 20 ) ); 91 homeButton->setMinimumSize( QSize( 20, 20 ) );
93 homeButton->setMaximumSize( QSize( 20, 20 ) ); 92 homeButton->setMaximumSize( QSize( 20, 20 ) );
94 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 93 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
95 homeButton->setFlat(TRUE); 94 homeButton->setFlat(TRUE);
96 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); 95 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 );
97 96
98 FileStack = new QWidgetStack( this ); 97 FileStack = new QWidgetStack( this );
99 98
100 99
101 ListView = new QListView( this, "ListView" ); 100 ListView = new QListView( this, "ListView" );
102// ListView->setMinimumSize( QSize( 100, 25 ) ); 101// ListView->setMinimumSize( QSize( 100, 25 ) );
103 ListView->addColumn( tr( "Name" ) ); 102 ListView->addColumn( tr( "Name" ) );
104 ListView->setColumnWidth(0,120); 103 ListView->setColumnWidth(0,120);
105 ListView->setSorting( 2, FALSE); 104 ListView->setSorting( 2, FALSE);
106 ListView->addColumn( tr( "Size" ) ); 105 ListView->addColumn( tr( "Size" ) );
107 ListView->setColumnWidth(1,-1); 106 ListView->setColumnWidth(1,-1);
108 ListView->addColumn( "Date",-1); 107 ListView->addColumn( "Date",-1);
109 108
110 ListView->setColumnWidthMode(0,QListView::Manual); 109 ListView->setColumnWidthMode(0,QListView::Manual);
111 ListView->setColumnAlignment(1,QListView::AlignRight); 110 ListView->setColumnAlignment(1,QListView::AlignRight);
112 ListView->setColumnAlignment(2,QListView::AlignRight); 111 ListView->setColumnAlignment(2,QListView::AlignRight);
113 ListView->setAllColumnsShowFocus( TRUE ); 112 ListView->setAllColumnsShowFocus( TRUE );
114 113
115 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 114 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
116 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 115 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
117 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 116 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
118 117
119 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 118 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
120 119
121 FileStack->addWidget( ListView, get_unique_id() ); 120 FileStack->addWidget( ListView, get_unique_id() );
122mimeType="text/*"; 121mimeType="text/*";
123 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 122 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
124// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 123// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
125// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 124// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
126 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 125 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
127 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); 126 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
128 127
129 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); 128 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" );
130 SelectionCombo->insertItem( tr( "Documents" ) ); 129 SelectionCombo->insertItem( tr( "Documents" ) );
131 SelectionCombo->insertItem( tr( "All files" ) ); 130 SelectionCombo->insertItem( tr( "All files" ) );
132 SelectionCombo->insertItem( tr( "Hidden files" ) ); 131 SelectionCombo->insertItem( tr( "Hidden files" ) );
133// SelectionCombo->setMaximumWidth(120); 132// SelectionCombo->setMaximumWidth(120);
134 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); 133 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 );
135 134
136 connect( SelectionCombo, SIGNAL( activated( const QString & ) ), 135 connect( SelectionCombo, SIGNAL( activated( const QString & ) ),
137 this, SLOT( selectionChanged( const QString & ) ) ); 136 this, SLOT( selectionChanged( const QString & ) ) );
138 137
139 typemb = new MenuButton(this); 138 typemb = new MenuButton(this);
140 typemb->setLabel(tr("Type: %1")); 139 typemb->setLabel(tr("Type: %1"));
141 typemb->setMinimumWidth(110); 140 typemb->setMinimumWidth(110);
142 typemb->setFixedHeight(22); 141 typemb->setFixedHeight(22);
143 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); 142 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 );
144 updateMimeTypeMenu() ; 143 updateMimeTypeMenu() ;
145 144
146 currentDir.setPath(QDir::currentDirPath()); 145 currentDir.setPath(QDir::currentDirPath());
147 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); 146 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
148 147
149 populateList(); 148 populateList();
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h
index 42f93b6..77ac166 100644
--- a/core/apps/textedit/fileBrowser.h
+++ b/core/apps/textedit/fileBrowser.h
@@ -1,118 +1,119 @@
1/**************************************************************************** 1/****************************************************************************
2** 2**
3** Created: Fri Dec 14 08:16:02 2001 3** Created: Fri Dec 14 08:16:02 2001
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13copyright Sun 02-17-2002 22:28:23 L. J. Potter ljp@llornkcor.com 13copyright Sun 02-17-2002 22:28:23 L. J. Potter ljp@llornkcor.com
14****************************************************************************/ 14****************************************************************************/
15#ifndef FILEBROWSER_H 15#ifndef FILEBROWSER_H
16#define FILEBROWSER_H 16#define FILEBROWSER_H
17 17
18//#include <qvariant.h> 18//#include <qvariant.h>
19#include <qdialog.h> 19#include <qdialog.h>
20#include <qfile.h> 20#include <qfile.h>
21#include <qdir.h> 21#include <qdir.h>
22#include <qstringlist.h> 22#include <qstringlist.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qdict.h> 25#include <qdict.h>
26 26
27#include <qpe/filemanager.h> 27#include <qpe/filemanager.h>
28 28
29#include <qvariant.h> 29#include <qvariant.h>
30#include <qdialog.h> 30#include <qdialog.h>
31class QLineEdit; 31class QLineEdit;
32 32
33class QVBoxLayout; 33class QVBoxLayout;
34class QHBoxLayout; 34class QHBoxLayout;
35class QGridLayout; 35class QGridLayout;
36class QListView; 36class QListView;
37class QListViewItem; 37class QListViewItem;
38class QPushButton; 38class QPushButton;
39class QComboBox; 39class QComboBox;
40class QWidgetStack; 40class QWidgetStack;
41class FileSelector; 41class FileSelector;
42class QPoint; 42class QPoint;
43class MenuButton; 43class MenuButton;
44class QRegExp; 44class QRegExp;
45 45
46 46
47class fileBrowser : public QDialog 47class fileBrowser : public QDialog
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51public: 51public:
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;
56 QFile file;
57 QStringList fileList;
58 QComboBox *SelectionCombo;
59public slots:
60 void setFileView( int );
61
62private:
63// QDict<void> mimes;
55 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton; 64 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton;
56 QListView* ListView; 65 QListView* ListView;
57
58 QLabel *dirLabel; 66 QLabel *dirLabel;
59 QString selectedFileName, filterStr; 67 QString filterStr;
60 QDir currentDir; 68 QDir currentDir;
61 QFile file; 69 QStringList dirPathStringList;
62 QStringList fileList, dirPathStringList;
63 QListViewItem * item; 70 QListViewItem * item;
64 QComboBox *SelectionCombo, *dirPathCombo; 71 QComboBox *dirPathCombo;
65 MenuButton *typemb; 72 MenuButton *typemb;
66 QWidgetStack *FileStack; 73 QWidgetStack *FileStack;
67 FileSelector *fileSelector; 74 FileSelector *fileSelector;
68 QString mimeType;
69public slots:
70 void setFileView( int );
71
72private:
73// QDict<void> mimes;
74 QRegExp tf; 75 QRegExp tf;
75 QStringList getMimeTypes(); 76 QStringList getMimeTypes();
76 void fillCombo( const QString&); 77 void fillCombo( const QString&);
77 78
78private slots: 79private slots:
79 void populateList(); 80 void populateList();
80 void homeButtonPushed(); 81 void homeButtonPushed();
81 void docButtonPushed(); 82 void docButtonPushed();
82 void ListPressed( int, QListViewItem *, const QPoint&, int); 83 void ListPressed( int, QListViewItem *, const QPoint&, int);
83 void showListMenu(QListViewItem*); 84 void showListMenu(QListViewItem*);
84 void doCd(); 85 void doCd();
85 void makDir(); 86 void makDir();
86 void localRename(); 87 void localRename();
87 void localDelete(); 88 void localDelete();
88 void receive( const QCString &msg, const QByteArray &data ); 89 void receive( const QCString &msg, const QByteArray &data );
89 void dirPathComboActivated( const QString & ); 90 void dirPathComboActivated( const QString & );
90 void upDir(); 91 void upDir();
91 void listClicked( QListViewItem * ); 92 void listClicked( QListViewItem * );
92 void selectionChanged( const QString & ); 93 void selectionChanged( const QString & );
93 void OnOK(); 94 void OnOK();
94 void docOpen( const DocLnk & ); 95 void docOpen( const DocLnk & );
95 void updateMimeTypeMenu(); 96 void updateMimeTypeMenu();
96 void showType(const QString &); 97 void showType(const QString &);
97 void dirPathEditPressed(); 98 void dirPathEditPressed();
98 99
99protected slots: 100protected slots:
100 101
101protected: 102protected:
102 103
103}; 104};
104 105
105 106
106class InputDialog : public QDialog 107class InputDialog : public QDialog
107{ 108{
108 Q_OBJECT 109 Q_OBJECT
109 110
110public: 111public:
111 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 112 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
112 ~InputDialog(); 113 ~InputDialog();
113 QString inputText; 114 QString inputText;
114 QLineEdit* LineEdit1; 115 QLineEdit* LineEdit1;
115 116
116}; 117};
117 118
118#endif // FILEBROWSER_H 119#endif // FILEBROWSER_H