author | llornkcor <llornkcor> | 2002-05-22 14:45:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-22 14:45:47 (UTC) |
commit | d7c7e0a272996ef3ae386e939d25737d3060e427 (patch) (unidiff) | |
tree | e39e2b2591ff4dfdd3928a4171e0c5bf1cbf0c78 | |
parent | 7535b4d2d300c32fd50218a652c32ab4bb5886ab (diff) | |
download | opie-d7c7e0a272996ef3ae386e939d25737d3060e427.zip opie-d7c7e0a272996ef3ae386e939d25737d3060e427.tar.gz opie-d7c7e0a272996ef3ae386e939d25737d3060e427.tar.bz2 |
fixed rampant mt thing
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 9ad0d69..3798f90 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -1,200 +1,200 @@ | |||
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 | #define QTOPIA_INTERNAL_MIMEEXT | 14 | #define QTOPIA_INTERNAL_MIMEEXT |
15 | #include "fileBrowser.h" | 15 | #include "fileBrowser.h" |
16 | //#include "inputDialog.h" | 16 | //#include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/fileselector.h> | 20 | #include <qpe/fileselector.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/menubutton.h> | 22 | #include <qpe/menubutton.h> |
23 | #include <qpe/mimetype.h> | 23 | #include <qpe/mimetype.h> |
24 | 24 | ||
25 | #include <qdict.h> | 25 | #include <qdict.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | #include <qcombo.h> | 28 | #include <qcombo.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <unistd.h> | 33 | #include <unistd.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | 37 | ||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | 40 | ||
41 | static int u_id = 1; | 41 | static int u_id = 1; |
42 | static int get_unique_id() | 42 | static int get_unique_id() |
43 | { | 43 | { |
44 | return u_id++; | 44 | return u_id++; |
45 | } | 45 | } |
46 | 46 | ||
47 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) | 47 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) |
48 | : QDialog( parent, name, modal, fl ) | 48 | : QDialog( parent, name, modal, fl ) |
49 | { | 49 | { |
50 | if ( !name ) | 50 | if ( !name ) |
51 | setName( "fileBrowser" ); | 51 | setName( "fileBrowser" ); |
52 | setCaption(tr( name ) ); | 52 | setCaption(tr( name ) ); |
53 | 53 | ||
54 | // getMimeTypes(); | 54 | // getMimeTypes(); |
55 | 55 | ||
56 | // mimeType = mimeFilter; | 56 | // mimeType = mimeFilter; |
57 | // MimeType mt( mimeType); | 57 | // MimeType mt( mimeType); |
58 | 58 | ||
59 | // if( mt.extension().isEmpty()) { | 59 | // if( mt.extension().isEmpty()) { |
60 | 60 | ||
61 | // QStringList filterList; | 61 | // QStringList filterList; |
62 | // filterList=QStringList::split(";",mimeFilter,FALSE); | 62 | // filterList=QStringList::split(";",mimeFilter,FALSE); |
63 | 63 | ||
64 | // for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { | 64 | // for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { |
65 | // printf( "%s \n", (*it).latin1() ); | 65 | // printf( "%s \n", (*it).latin1() ); |
66 | // } | 66 | // } |
67 | 67 | ||
68 | // filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; | 68 | // filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; |
69 | 69 | ||
70 | // qDebug(filterStr); | 70 | // qDebug(filterStr); |
71 | // } else { | 71 | // } else { |
72 | filterStr = "*."+ mt.extension(); | 72 | filterStr = "*";//+ mt.extension(); |
73 | // qDebug("description "+mt.description()); | 73 | // qDebug("description "+mt.description()); |
74 | // qDebug( "id "+mt.id()); | 74 | // qDebug( "id "+mt.id()); |
75 | // qDebug("extension "+mt.extension()); | 75 | // qDebug("extension "+mt.extension()); |
76 | // } | 76 | // } |
77 | // channel = new QCopChannel( "QPE/fileDialog", this ); | 77 | // channel = new QCopChannel( "QPE/fileDialog", this ); |
78 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 78 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
79 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); | 79 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); |
80 | 80 | ||
81 | QGridLayout *layout = new QGridLayout( this ); | 81 | QGridLayout *layout = new QGridLayout( this ); |
82 | layout->setSpacing( 4 ); | 82 | layout->setSpacing( 4 ); |
83 | layout->setMargin( 4 ); | 83 | layout->setMargin( 4 ); |
84 | 84 | ||
85 | dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); | 85 | dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); |
86 | dirPathCombo->setEditable(TRUE); | 86 | dirPathCombo->setEditable(TRUE); |
87 | 87 | ||
88 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), | 88 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), |
89 | this, SLOT( dirPathComboActivated( const QString & ) ) ); | 89 | this, SLOT( dirPathComboActivated( const QString & ) ) ); |
90 | 90 | ||
91 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), | 91 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), |
92 | this, SLOT( dirPathEditPressed( ) ) ); | 92 | this, SLOT( dirPathEditPressed( ) ) ); |
93 | 93 | ||
94 | dirPathStringList << "/"; | 94 | dirPathStringList << "/"; |
95 | // we can get the storage here | 95 | // we can get the storage here |
96 | 96 | ||
97 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); | 97 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); |
98 | 98 | ||
99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
100 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); | 100 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); |
101 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); | 101 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); |
102 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 102 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
103 | cdUpButton ->setFlat(TRUE); | 103 | cdUpButton ->setFlat(TRUE); |
104 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); | 104 | layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); |
105 | 105 | ||
106 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 106 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
107 | docButton->setMinimumSize( QSize( 20, 20 ) ); | 107 | docButton->setMinimumSize( QSize( 20, 20 ) ); |
108 | docButton->setMaximumSize( QSize( 20, 20 ) ); | 108 | docButton->setMaximumSize( QSize( 20, 20 ) ); |
109 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 109 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
110 | docButton->setFlat(TRUE); | 110 | docButton->setFlat(TRUE); |
111 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 111 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
112 | 112 | ||
113 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 113 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
114 | homeButton->setMinimumSize( QSize( 20, 20 ) ); | 114 | homeButton->setMinimumSize( QSize( 20, 20 ) ); |
115 | homeButton->setMaximumSize( QSize( 20, 20 ) ); | 115 | homeButton->setMaximumSize( QSize( 20, 20 ) ); |
116 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 116 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
117 | homeButton->setFlat(TRUE); | 117 | homeButton->setFlat(TRUE); |
118 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); | 118 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); |
119 | 119 | ||
120 | FileStack = new QWidgetStack( this ); | 120 | FileStack = new QWidgetStack( this ); |
121 | 121 | ||
122 | ListView = new QListView( this, "ListView" ); | 122 | ListView = new QListView( this, "ListView" ); |
123 | // ListView->setMinimumSize( QSize( 100, 25 ) ); | 123 | // ListView->setMinimumSize( QSize( 100, 25 ) ); |
124 | ListView->addColumn( tr( "Name" ) ); | 124 | ListView->addColumn( tr( "Name" ) ); |
125 | ListView->setColumnWidth(0,120); | 125 | ListView->setColumnWidth(0,120); |
126 | ListView->setSorting( 2, FALSE); | 126 | ListView->setSorting( 2, FALSE); |
127 | ListView->addColumn( tr( "Size" ) ); | 127 | ListView->addColumn( tr( "Size" ) ); |
128 | ListView->setColumnWidth(1,-1); | 128 | ListView->setColumnWidth(1,-1); |
129 | ListView->addColumn( "Date",-1); | 129 | ListView->addColumn( "Date",-1); |
130 | 130 | ||
131 | ListView->setColumnWidthMode(0,QListView::Manual); | 131 | ListView->setColumnWidthMode(0,QListView::Manual); |
132 | ListView->setColumnAlignment(1,QListView::AlignRight); | 132 | ListView->setColumnAlignment(1,QListView::AlignRight); |
133 | ListView->setColumnAlignment(2,QListView::AlignRight); | 133 | ListView->setColumnAlignment(2,QListView::AlignRight); |
134 | ListView->setAllColumnsShowFocus( TRUE ); | 134 | ListView->setAllColumnsShowFocus( TRUE ); |
135 | 135 | ||
136 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 136 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
137 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 137 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
138 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 138 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
139 | 139 | ||
140 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 140 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
141 | 141 | ||
142 | FileStack->addWidget( ListView, get_unique_id() ); | 142 | FileStack->addWidget( ListView, get_unique_id() ); |
143 | mimeType="text/plain"; | 143 | mimeType="text/plain"; |
144 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 144 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
145 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 145 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
146 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 146 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
147 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), | 147 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), |
148 | this, SLOT( docOpen( const DocLnk & ) ) ); | 148 | this, SLOT( docOpen( const DocLnk & ) ) ); |
149 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); | 149 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); |
150 | 150 | ||
151 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); | 151 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); |
152 | SelectionCombo->insertItem( tr( "Documents" ) ); | 152 | SelectionCombo->insertItem( tr( "Documents" ) ); |
153 | SelectionCombo->insertItem( tr( "All files" ) ); | 153 | SelectionCombo->insertItem( tr( "All files" ) ); |
154 | SelectionCombo->insertItem( tr( "Hidden files" ) ); | 154 | SelectionCombo->insertItem( tr( "Hidden files" ) ); |
155 | // SelectionCombo->setMaximumWidth(120); | 155 | // SelectionCombo->setMaximumWidth(120); |
156 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); | 156 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); |
157 | 157 | ||
158 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), | 158 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), |
159 | this, SLOT( selectionChanged( const QString & ) ) ); | 159 | this, SLOT( selectionChanged( const QString & ) ) ); |
160 | 160 | ||
161 | typemb = new MenuButton(this); | 161 | typemb = new MenuButton(this); |
162 | typemb->setLabel(tr("Type: %1")); | 162 | typemb->setLabel(tr("Type: %1")); |
163 | typemb->setMinimumWidth(110); | 163 | typemb->setMinimumWidth(110); |
164 | typemb->setFixedHeight(22); | 164 | typemb->setFixedHeight(22); |
165 | layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); | 165 | layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); |
166 | updateMimeTypeMenu() ; | 166 | updateMimeTypeMenu() ; |
167 | 167 | ||
168 | currentDir.setPath(QDir::currentDirPath()); | 168 | currentDir.setPath(QDir::currentDirPath()); |
169 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 169 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
170 | currentDir.setNameFilter(filterStr); | 170 | currentDir.setNameFilter(filterStr); |
171 | 171 | ||
172 | populateList(); | 172 | populateList(); |
173 | move(0,15); | 173 | move(0,15); |
174 | } | 174 | } |
175 | 175 | ||
176 | fileBrowser::~fileBrowser() | 176 | fileBrowser::~fileBrowser() |
177 | { | 177 | { |
178 | } | 178 | } |
179 | 179 | ||
180 | void fileBrowser::setFileView( int selection ) | 180 | void fileBrowser::setFileView( int selection ) |
181 | { | 181 | { |
182 | SelectionCombo->setCurrentItem( selection ); | 182 | SelectionCombo->setCurrentItem( selection ); |
183 | selectionChanged( SelectionCombo->currentText() ); | 183 | selectionChanged( SelectionCombo->currentText() ); |
184 | } | 184 | } |
185 | 185 | ||
186 | void fileBrowser::populateList() | 186 | void fileBrowser::populateList() |
187 | { | 187 | { |
188 | ListView->clear(); | 188 | ListView->clear(); |
189 | QListViewItem * item; | 189 | QListViewItem * item; |
190 | bool isDir=FALSE; | 190 | bool isDir=FALSE; |
191 | //qDebug(currentDir.canonicalPath()); | 191 | //qDebug(currentDir.canonicalPath()); |
192 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 192 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
193 | currentDir.setMatchAllDirs(TRUE); | 193 | currentDir.setMatchAllDirs(TRUE); |
194 | 194 | ||
195 | // currentDir.setNameFilter("*.txt;*.etx"); | 195 | // currentDir.setNameFilter("*.txt;*.etx"); |
196 | QString fileL, fileS, fileDate; | 196 | QString fileL, fileS, fileDate; |
197 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 197 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
198 | QFileInfoListIterator it(*list); | 198 | QFileInfoListIterator it(*list); |
199 | QFileInfo *fi; | 199 | QFileInfo *fi; |
200 | while ( (fi=it.current()) ) { | 200 | while ( (fi=it.current()) ) { |