summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-25 02:55:43 (UTC)
committer llornkcor <llornkcor>2002-03-25 02:55:43 (UTC)
commitf978777e3dfe6c02e19d7601b20e60a95d65b1e9 (patch) (unidiff)
tree7bd1a6c46227e4354700500bda55f667c34efbdb
parentb43c59f2f8da6edfa37042e0838b38702636f4d1 (diff)
downloadopie-f978777e3dfe6c02e19d7601b20e60a95d65b1e9.zip
opie-f978777e3dfe6c02e19d7601b20e60a95d65b1e9.tar.gz
opie-f978777e3dfe6c02e19d7601b20e60a95d65b1e9.tar.bz2
moved inputDialog to fileBrowser
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp23
-rw-r--r--core/apps/textedit/fileBrowser.h17
-rw-r--r--core/apps/textedit/inputDialog.cpp40
-rw-r--r--core/apps/textedit/inputDialog.h34
-rw-r--r--core/apps/textedit/textedit.pro4
5 files changed, 41 insertions, 77 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index ebb78d1..f3e4e1e 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,555 +1,576 @@
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 53
54// channel = new QCopChannel( "QPE/fileDialog", this ); 54// channel = new QCopChannel( "QPE/fileDialog", this );
55// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 55// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
56// this, SLOT(receive(const QCString&, const QByteArray&)) ); 56// this, SLOT(receive(const QCString&, const QByteArray&)) );
57 57
58 QGridLayout *layout = new QGridLayout( this ); 58 QGridLayout *layout = new QGridLayout( this );
59 layout->setSpacing( 4 ); 59 layout->setSpacing( 4 );
60 layout->setMargin( 4 ); 60 layout->setMargin( 4 );
61 61
62 dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" ); 62 dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" );
63 dirPathCombo->setEditable(TRUE); 63 dirPathCombo->setEditable(TRUE);
64 64
65 connect( dirPathCombo, SIGNAL( activated( const QString & ) ), 65 connect( dirPathCombo, SIGNAL( activated( const QString & ) ),
66 this, SLOT( dirPathComboActivated( const QString & ) ) ); 66 this, SLOT( dirPathComboActivated( const QString & ) ) );
67 67
68 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), 68 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ),
69 this, SLOT( dirPathEditPressed( ) ) ); 69 this, SLOT( dirPathEditPressed( ) ) );
70 70
71 dirPathStringList << "/"; 71 dirPathStringList << "/";
72// we can get the storage here 72// we can get the storage here
73 73
74 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); 74 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 );
75 75
76 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 76 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
77 cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); 77 cdUpButton ->setMinimumSize( QSize( 20, 20 ) );
78 cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); 78 cdUpButton ->setMaximumSize( QSize( 20, 20 ) );
79 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 79 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
80 cdUpButton ->setFlat(TRUE); 80 cdUpButton ->setFlat(TRUE);
81 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); 81 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 );
82 82
83 83
84 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 84 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
85 docButton->setMinimumSize( QSize( 20, 20 ) ); 85 docButton->setMinimumSize( QSize( 20, 20 ) );
86 docButton->setMaximumSize( QSize( 20, 20 ) ); 86 docButton->setMaximumSize( QSize( 20, 20 ) );
87 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 87 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
88 docButton->setFlat(TRUE); 88 docButton->setFlat(TRUE);
89 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 89 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
90 90
91 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 91 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
92 homeButton->setMinimumSize( QSize( 20, 20 ) ); 92 homeButton->setMinimumSize( QSize( 20, 20 ) );
93 homeButton->setMaximumSize( QSize( 20, 20 ) ); 93 homeButton->setMaximumSize( QSize( 20, 20 ) );
94 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 94 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
95 homeButton->setFlat(TRUE); 95 homeButton->setFlat(TRUE);
96 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); 96 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 );
97 97
98 FileStack = new QWidgetStack( this ); 98 FileStack = new QWidgetStack( this );
99 99
100 100
101 ListView = new QListView( this, "ListView" ); 101 ListView = new QListView( this, "ListView" );
102// ListView->setMinimumSize( QSize( 100, 25 ) ); 102// ListView->setMinimumSize( QSize( 100, 25 ) );
103 ListView->addColumn( tr( "Name" ) ); 103 ListView->addColumn( tr( "Name" ) );
104 ListView->setColumnWidth(0,120); 104 ListView->setColumnWidth(0,120);
105 ListView->setSorting( 2, FALSE); 105 ListView->setSorting( 2, FALSE);
106 ListView->addColumn( tr( "Size" ) ); 106 ListView->addColumn( tr( "Size" ) );
107 ListView->setColumnWidth(1,-1); 107 ListView->setColumnWidth(1,-1);
108 ListView->addColumn( "Date",-1); 108 ListView->addColumn( "Date",-1);
109 109
110 ListView->setColumnWidthMode(0,QListView::Manual); 110 ListView->setColumnWidthMode(0,QListView::Manual);
111 ListView->setColumnAlignment(1,QListView::AlignRight); 111 ListView->setColumnAlignment(1,QListView::AlignRight);
112 ListView->setColumnAlignment(2,QListView::AlignRight); 112 ListView->setColumnAlignment(2,QListView::AlignRight);
113 ListView->setAllColumnsShowFocus( TRUE ); 113 ListView->setAllColumnsShowFocus( TRUE );
114 114
115 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 115 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
116 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 116 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
117 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 117 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
118 118
119 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 119 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
120 120
121 FileStack->addWidget( ListView, get_unique_id() ); 121 FileStack->addWidget( ListView, get_unique_id() );
122mimeType="text/*"; 122mimeType="text/*";
123 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 123 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
124// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 124// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
125// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 125// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
126 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 126 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
127 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); 127 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
128 128
129 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); 129 SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" );
130 SelectionCombo->insertItem( tr( "Documents" ) ); 130 SelectionCombo->insertItem( tr( "Documents" ) );
131 SelectionCombo->insertItem( tr( "All files" ) ); 131 SelectionCombo->insertItem( tr( "All files" ) );
132 SelectionCombo->insertItem( tr( "Hidden files" ) ); 132 SelectionCombo->insertItem( tr( "Hidden files" ) );
133// SelectionCombo->setMaximumWidth(120); 133// SelectionCombo->setMaximumWidth(120);
134 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); 134 layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 );
135 135
136 connect( SelectionCombo, SIGNAL( activated( const QString & ) ), 136 connect( SelectionCombo, SIGNAL( activated( const QString & ) ),
137 this, SLOT( selectionChanged( const QString & ) ) ); 137 this, SLOT( selectionChanged( const QString & ) ) );
138 138
139 typemb = new MenuButton(this); 139 typemb = new MenuButton(this);
140 typemb->setLabel(tr("Type: %1")); 140 typemb->setLabel(tr("Type: %1"));
141 typemb->setMinimumWidth(110); 141 typemb->setMinimumWidth(110);
142 typemb->setFixedHeight(22); 142 typemb->setFixedHeight(22);
143 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 ); 143 layout->addMultiCellWidget( typemb, 2, 2, 4, 7 );
144 updateMimeTypeMenu() ; 144 updateMimeTypeMenu() ;
145 145
146 currentDir.setPath(QDir::currentDirPath()); 146 currentDir.setPath(QDir::currentDirPath());
147 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); 147 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
148 148
149 populateList(); 149 populateList();
150 move(0,15); 150 move(0,15);
151} 151}
152 152
153fileBrowser::~fileBrowser() 153fileBrowser::~fileBrowser()
154{ 154{
155} 155}
156 156
157void fileBrowser::setFileView( int selection ) 157void fileBrowser::setFileView( int selection )
158{ 158{
159 SelectionCombo->setCurrentItem( selection ); 159 SelectionCombo->setCurrentItem( selection );
160 selectionChanged( SelectionCombo->currentText() ); 160 selectionChanged( SelectionCombo->currentText() );
161} 161}
162 162
163void fileBrowser::populateList() 163void fileBrowser::populateList()
164{ 164{
165 ListView->clear(); 165 ListView->clear();
166 bool isDir=FALSE; 166 bool isDir=FALSE;
167//qDebug(currentDir.canonicalPath()); 167//qDebug(currentDir.canonicalPath());
168 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 168 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
169 currentDir.setMatchAllDirs(TRUE); 169 currentDir.setMatchAllDirs(TRUE);
170 170
171 currentDir.setNameFilter(filterStr); 171 currentDir.setNameFilter(filterStr);
172// currentDir.setNameFilter("*.txt;*.etx"); 172// currentDir.setNameFilter("*.txt;*.etx");
173 QString fileL, fileS, fileDate; 173 QString fileL, fileS, fileDate;
174 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 174 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
175 QFileInfoListIterator it(*list); 175 QFileInfoListIterator it(*list);
176 QFileInfo *fi; 176 QFileInfo *fi;
177 while ( (fi=it.current()) ) { 177 while ( (fi=it.current()) ) {
178 178
179 if (fi->isSymLink() ){ 179 if (fi->isSymLink() ){
180 QString symLink=fi->readLink(); 180 QString symLink=fi->readLink();
181// qDebug("Symlink detected "+symLink); 181// qDebug("Symlink detected "+symLink);
182 QFileInfo sym( symLink); 182 QFileInfo sym( symLink);
183 fileS.sprintf( "%10li", sym.size() ); 183 fileS.sprintf( "%10li", sym.size() );
184 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 184 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
185 fileDate = sym.lastModified().toString(); 185 fileDate = sym.lastModified().toString();
186 } else { 186 } else {
187// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 187// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
188 fileS.sprintf( "%10li", fi->size() ); 188 fileS.sprintf( "%10li", fi->size() );
189 fileL.sprintf( "%s",fi->fileName().data() ); 189 fileL.sprintf( "%s",fi->fileName().data() );
190 fileDate= fi->lastModified().toString(); 190 fileDate= fi->lastModified().toString();
191 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 191 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
192 fileL+="/"; 192 fileL+="/";
193 isDir=TRUE; 193 isDir=TRUE;
194// qDebug( fileL); 194// qDebug( fileL);
195 } 195 }
196 } 196 }
197 if(fileL !="./") { 197 if(fileL !="./") {
198 item= new QListViewItem( ListView,fileL,fileS , fileDate); 198 item= new QListViewItem( ListView,fileL,fileS , fileDate);
199 QPixmap pm; 199 QPixmap pm;
200 200
201 if(isDir || fileL.find("/",0,TRUE) != -1) { 201 if(isDir || fileL.find("/",0,TRUE) != -1) {
202 if( !QDir( fi->filePath() ).isReadable()) 202 if( !QDir( fi->filePath() ).isReadable())
203 pm = Resource::loadPixmap( "lockedfolder" ); 203 pm = Resource::loadPixmap( "lockedfolder" );
204 else 204 else
205 pm= Resource::loadPixmap( "folder" ); 205 pm= Resource::loadPixmap( "folder" );
206 item->setPixmap( 0,pm ); 206 item->setPixmap( 0,pm );
207 } else { 207 } else {
208 if( !fi->isReadable() ) 208 if( !fi->isReadable() )
209 pm = Resource::loadPixmap( "locked" ); 209 pm = Resource::loadPixmap( "locked" );
210 else { 210 else {
211 MimeType mt(fi->filePath()); 211 MimeType mt(fi->filePath());
212 pm=mt.pixmap(); 212 pm=mt.pixmap();
213 if(pm.isNull()) 213 if(pm.isNull())
214 pm = Resource::loadPixmap( "UnknownDocument-14" ); 214 pm = Resource::loadPixmap( "UnknownDocument-14" );
215 item->setPixmap( 0,pm); 215 item->setPixmap( 0,pm);
216 } 216 }
217 } 217 }
218 if( fileL.find("->",0,TRUE) != -1) { 218 if( fileL.find("->",0,TRUE) != -1) {
219 // overlay link image 219 // overlay link image
220 pm= Resource::loadPixmap( "folder" ); 220 pm= Resource::loadPixmap( "folder" );
221 QPixmap lnk = Resource::loadPixmap( "symlink" ); 221 QPixmap lnk = Resource::loadPixmap( "symlink" );
222 QPainter painter( &pm ); 222 QPainter painter( &pm );
223 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 223 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
224 pm.setMask( pm.createHeuristicMask( FALSE ) ); 224 pm.setMask( pm.createHeuristicMask( FALSE ) );
225 item->setPixmap( 0, pm); 225 item->setPixmap( 0, pm);
226 } 226 }
227 } 227 }
228 isDir=FALSE; 228 isDir=FALSE;
229 ++it; 229 ++it;
230 } 230 }
231 ListView->setSorting( 3, FALSE); 231 ListView->setSorting( 3, FALSE);
232 QString currentPath = currentDir.canonicalPath(); 232 QString currentPath = currentDir.canonicalPath();
233 233
234 fillCombo( (const QString &)currentPath); 234 fillCombo( (const QString &)currentPath);
235// dirPathCombo->lineEdit()->setText(currentPath); 235// dirPathCombo->lineEdit()->setText(currentPath);
236 236
237// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 237// if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
238// dirPathCombo->clear(); 238// dirPathCombo->clear();
239// dirPathStringList.prepend(currentPath ); 239// dirPathStringList.prepend(currentPath );
240// dirPathCombo->insertStringList( dirPathStringList,-1); 240// dirPathCombo->insertStringList( dirPathStringList,-1);
241// } 241// }
242} 242}
243 243
244void fileBrowser::upDir() 244void fileBrowser::upDir()
245{ 245{
246 QString current = currentDir.canonicalPath(); 246 QString current = currentDir.canonicalPath();
247 QDir dir(current); 247 QDir dir(current);
248 dir.cdUp(); 248 dir.cdUp();
249 current = dir.canonicalPath(); 249 current = dir.canonicalPath();
250 chdir( current.latin1() ); 250 chdir( current.latin1() );
251 currentDir.cd( current, TRUE); 251 currentDir.cd( current, TRUE);
252 populateList(); 252 populateList();
253 update(); 253 update();
254} 254}
255 255
256// you may want to switch these 2 functions. I like single clicks 256// you may want to switch these 2 functions. I like single clicks
257void fileBrowser::listClicked(QListViewItem *selectedItem) 257void fileBrowser::listClicked(QListViewItem *selectedItem)
258{ 258{
259 QString strItem=selectedItem->text(0); 259 QString strItem=selectedItem->text(0);
260 QString strSize=selectedItem->text(1); 260 QString strSize=selectedItem->text(1);
261// qDebug("strItem is "+strItem); 261// qDebug("strItem is "+strItem);
262 strSize.stripWhiteSpace(); 262 strSize.stripWhiteSpace();
263// qDebug(strSize); 263// qDebug(strSize);
264 264
265 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 265 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
266 // is symlink 266 // is symlink
267 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 267 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4);
268// qDebug("strItem symlink is "+strItem2); 268// qDebug("strItem symlink is "+strItem2);
269 if(QDir(strItem2).exists() ) { 269 if(QDir(strItem2).exists() ) {
270 currentDir.cd(strItem2, TRUE); 270 currentDir.cd(strItem2, TRUE);
271 populateList(); 271 populateList();
272 } 272 }
273 } else { // not a symlink 273 } else { // not a symlink
274 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 274 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
275 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 275 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
276 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 276 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
277 currentDir.cd(strItem,FALSE); 277 currentDir.cd(strItem,FALSE);
278// qDebug("Path is "+strItem); 278// qDebug("Path is "+strItem);
279 populateList(); 279 populateList();
280 } else { 280 } else {
281 currentDir.cdUp(); 281 currentDir.cdUp();
282 populateList(); 282 populateList();
283 } 283 }
284 if(QDir(strItem).exists()){ 284 if(QDir(strItem).exists()){
285 currentDir.cd(strItem, TRUE); 285 currentDir.cd(strItem, TRUE);
286 populateList(); 286 populateList();
287 } 287 }
288 } else { 288 } else {
289 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 289 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
290 if( QFile::exists(strItem ) ) { 290 if( QFile::exists(strItem ) ) {
291//currentDir.canonicalPath() 291//currentDir.canonicalPath()
292 qDebug("We found our files!!"+strItem); 292 qDebug("We found our files!!"+strItem);
293 OnOK(); 293 OnOK();
294 } 294 }
295 } //end not symlink 295 } //end not symlink
296 chdir(strItem.latin1()); 296 chdir(strItem.latin1());
297 } 297 }
298} 298}
299 299
300void fileBrowser::OnOK() 300void fileBrowser::OnOK()
301{ 301{
302 QListViewItemIterator it1( ListView); 302 QListViewItemIterator it1( ListView);
303 for ( ; it1.current(); ++it1 ) { 303 for ( ; it1.current(); ++it1 ) {
304 if ( it1.current()->isSelected() ) { 304 if ( it1.current()->isSelected() ) {
305 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); 305 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0));
306 qDebug("selected filename is "+selectedFileName); 306 qDebug("selected filename is "+selectedFileName);
307 fileList.append( selectedFileName ); 307 fileList.append( selectedFileName );
308 } 308 }
309 } 309 }
310 accept(); 310 accept();
311} 311}
312 312
313void fileBrowser::homeButtonPushed() { 313void fileBrowser::homeButtonPushed() {
314 QString current = QDir::homeDirPath(); 314 QString current = QDir::homeDirPath();
315 chdir( current.latin1() ); 315 chdir( current.latin1() );
316 currentDir.cd( current, TRUE); 316 currentDir.cd( current, TRUE);
317 populateList(); 317 populateList();
318 update(); 318 update();
319} 319}
320 320
321void fileBrowser::docButtonPushed() { 321void fileBrowser::docButtonPushed() {
322 QString current = QPEApplication::documentDir(); 322 QString current = QPEApplication::documentDir();
323 chdir( current.latin1() ); 323 chdir( current.latin1() );
324 currentDir.cd( current, TRUE); 324 currentDir.cd( current, TRUE);
325 populateList(); 325 populateList();
326 update(); 326 update();
327 327
328} 328}
329 329
330void fileBrowser::selectionChanged( const QString &select ) 330void fileBrowser::selectionChanged( const QString &select )
331{ 331{
332 if ( select == "Documents") { 332 if ( select == "Documents") {
333 FileStack->raiseWidget( fileSelector ); 333 FileStack->raiseWidget( fileSelector );
334 dirPathCombo->hide(); 334 dirPathCombo->hide();
335 cdUpButton->hide(); 335 cdUpButton->hide();
336 docButton->hide(); 336 docButton->hide();
337 homeButton->hide(); 337 homeButton->hide();
338 } else { 338 } else {
339 if ( select == "All files" ) 339 if ( select == "All files" )
340 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All); 340 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All);
341 else 341 else
342 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 342 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
343 343
344 populateList(); 344 populateList();
345 update(); 345 update();
346 dirPathCombo->show(); 346 dirPathCombo->show();
347 cdUpButton->show(); 347 cdUpButton->show();
348 docButton->show(); 348 docButton->show();
349 homeButton->show(); 349 homeButton->show();
350 FileStack->raiseWidget( ListView ); 350 FileStack->raiseWidget( ListView );
351 } 351 }
352} 352}
353 353
354void fileBrowser::docOpen( const DocLnk &doc ) 354void fileBrowser::docOpen( const DocLnk &doc )
355{ 355{
356 fileList.append( doc.file().latin1() ); 356 fileList.append( doc.file().latin1() );
357 accept(); 357 accept();
358} 358}
359 359
360void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 360void fileBrowser::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
361{ 361{
362 switch (mouse) { 362 switch (mouse) {
363 case 1: 363 case 1:
364 break; 364 break;
365 case 2: 365 case 2:
366 showListMenu(item); 366 showListMenu(item);
367 break; 367 break;
368 }; 368 };
369} 369}
370 370
371void fileBrowser::showListMenu(QListViewItem *item) { 371void fileBrowser::showListMenu(QListViewItem *item) {
372 372
373 QPopupMenu m;// = new QPopupMenu( Local_View ); 373 QPopupMenu m;// = new QPopupMenu( Local_View );
374 if( item->text(0).find("/",0,TRUE)) 374 if( item->text(0).find("/",0,TRUE))
375 m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); 375 m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() ));
376 else 376 else
377 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); 377 m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() ));
378 m.insertItem( tr( "Rescan" ), this, SLOT( populateList()() )); 378 m.insertItem( tr( "Rescan" ), this, SLOT( populateList()() ));
379 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 379 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
380 m.insertSeparator(); 380 m.insertSeparator();
381 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 381 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
382 m.exec( QCursor::pos() ); 382 m.exec( QCursor::pos() );
383 383
384} 384}
385 385
386void fileBrowser::doCd() { 386void fileBrowser::doCd() {
387 listClicked( ListView->currentItem()); 387 listClicked( ListView->currentItem());
388} 388}
389 389
390void fileBrowser::makDir() { 390void fileBrowser::makDir() {
391 InputDialog *fileDlg; 391 InputDialog *fileDlg;
392 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 392 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
393 fileDlg->exec(); 393 fileDlg->exec();
394 if( fileDlg->result() == 1 ) { 394 if( fileDlg->result() == 1 ) {
395 QString filename = fileDlg->LineEdit1->text(); 395 QString filename = fileDlg->LineEdit1->text();
396 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 396 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
397 } 397 }
398 populateList(); 398 populateList();
399} 399}
400 400
401void fileBrowser::localRename() { 401void fileBrowser::localRename() {
402 QString curFile = ListView->currentItem()->text(0); 402 QString curFile = ListView->currentItem()->text(0);
403 InputDialog *fileDlg; 403 InputDialog *fileDlg;
404 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 404 fileDlg = new InputDialog(this,"Rename",TRUE, 0);
405 fileDlg->inputText = curFile; 405 fileDlg->inputText = curFile;
406 fileDlg->exec(); 406 fileDlg->exec();
407 if( fileDlg->result() == 1 ) { 407 if( fileDlg->result() == 1 ) {
408 QString oldname = currentDir.canonicalPath() + "/" + curFile; 408 QString oldname = currentDir.canonicalPath() + "/" + curFile;
409 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 409 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
410 if( rename(oldname.latin1(), newName.latin1())== -1) 410 if( rename(oldname.latin1(), newName.latin1())== -1)
411 QMessageBox::message("Note","Could not rename"); 411 QMessageBox::message("Note","Could not rename");
412 } 412 }
413 populateList(); 413 populateList();
414} 414}
415 415
416void fileBrowser::localDelete() { 416void fileBrowser::localDelete() {
417 QString f = ListView->currentItem()->text(0); 417 QString f = ListView->currentItem()->text(0);
418 if(QDir(f).exists() ) { 418 if(QDir(f).exists() ) {
419 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ 419 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
420 " ?\nIt must be empty","Yes","No",0,0,1) ) { 420 " ?\nIt must be empty","Yes","No",0,0,1) ) {
421 case 0: { 421 case 0: {
422 f=currentDir.canonicalPath()+"/"+f; 422 f=currentDir.canonicalPath()+"/"+f;
423 QString cmd="rmdir "+f; 423 QString cmd="rmdir "+f;
424 system( cmd.latin1()); 424 system( cmd.latin1());
425 populateList(); 425 populateList();
426 } 426 }
427 break; 427 break;
428 case 1: 428 case 1:
429 // exit 429 // exit
430 break; 430 break;
431 }; 431 };
432 432
433 } else { 433 } else {
434 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f 434 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
435 +" ?","Yes","No",0,0,1) ) { 435 +" ?","Yes","No",0,0,1) ) {
436 case 0: { 436 case 0: {
437 f=currentDir.canonicalPath()+"/"+f; 437 f=currentDir.canonicalPath()+"/"+f;
438 QString cmd="rm "+f; 438 QString cmd="rm "+f;
439 system( cmd.latin1()); 439 system( cmd.latin1());
440 populateList(); 440 populateList();
441 } 441 }
442 break; 442 break;
443 case 1: 443 case 1:
444 // exit 444 // exit
445 break; 445 break;
446 }; 446 };
447 } 447 }
448} 448}
449 449
450void fileBrowser::updateMimeTypeMenu() { 450void fileBrowser::updateMimeTypeMenu() {
451 451
452 disconnect( typemb, SIGNAL(selected(const QString&)), 452 disconnect( typemb, SIGNAL(selected(const QString&)),
453 this, SLOT(showType(const QString&)) ); 453 this, SLOT(showType(const QString&)) );
454 454
455 QString prev; 455 QString prev;
456 456
457 // Type filter 457 // Type filter
458 QStringList types; 458 QStringList types;
459 types << tr("All"); 459 types << tr("All");
460 types << "--"; 460 types << "--";
461 types += getMimeTypes(); 461 types += getMimeTypes();
462 prev = typemb->currentText(); 462 prev = typemb->currentText();
463 typemb->clear(); 463 typemb->clear();
464 typemb->insertItems(types); 464 typemb->insertItems(types);
465 // typemb->select(prev); 465 // typemb->select(prev);
466 466
467 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 467 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
468} 468}
469 469
470void fileBrowser::showType(const QString &t) { 470void fileBrowser::showType(const QString &t) {
471 471
472 qDebug(t); 472 qDebug(t);
473 mimeType = t+"/*"; 473 mimeType = t+"/*";
474// if(fileSelector) { 474// if(fileSelector) {
475// disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 475// disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
476// delete fileSelector; 476// delete fileSelector;
477 // } 477 // }
478 // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 478 // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
479// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 479// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
480// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 480// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
481 // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); 481 // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
482// fileSelector->reread(); 482// fileSelector->reread();
483 repaint(); 483 repaint();
484// if ( t == tr("All") ) { 484// if ( t == tr("All") ) {
485// icons->setTypeFilter("",TRUE); 485// icons->setTypeFilter("",TRUE);
486// } else { 486// } else {
487// icons->setTypeFilter(t+"/*",TRUE); 487// icons->setTypeFilter(t+"/*",TRUE);
488// } 488// }
489 489
490} 490}
491 491
492QStringList fileBrowser::getMimeTypes() { 492QStringList fileBrowser::getMimeTypes() {
493 QStringList r; 493 QStringList r;
494 AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); 494 AppLnkSet apps( QPEApplication::qpeDir() + "apps" );
495 QFile file( QPEApplication::qpeDir()+"etc/available.mime"); 495 QFile file( QPEApplication::qpeDir()+"etc/available.mime");
496 file.open( IO_WriteOnly|IO_Truncate);//) 496 file.open( IO_WriteOnly|IO_Truncate);//)
497 for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) { 497 for ( QListIterator<AppLnk> it( apps.children() ); it.current(); ++it ) {
498 AppLnk* l; 498 AppLnk* l;
499 l = it.current(); 499 l = it.current();
500 QStringList maj = l->mimeTypes(); 500 QStringList maj = l->mimeTypes();
501 QStringList::ConstIterator f; 501 QStringList::ConstIterator f;
502 for ( f = maj.begin(); f != maj.end(); f++ ) { 502 for ( f = maj.begin(); f != maj.end(); f++ ) {
503 QString temp = *f; 503 QString temp = *f;
504 int sl = temp.find('/'); 504 int sl = temp.find('/');
505 if (sl >= 0) { 505 if (sl >= 0) {
506 QString k = temp.left(sl); 506 QString k = temp.left(sl);
507 if( r.grep(k,TRUE).isEmpty() ) { 507 if( r.grep(k,TRUE).isEmpty() ) {
508 r << k; 508 r << k;
509 k+="\n"; 509 k+="\n";
510 file.writeBlock( k.latin1(), k.length()); 510 file.writeBlock( k.latin1(), k.length());
511 } 511 }
512 } 512 }
513 } 513 }
514 } 514 }
515 r.sort(); 515 r.sort();
516 file.close(); 516 file.close();
517 return r; 517 return r;
518} 518}
519 519
520void fileBrowser::receive( const QCString &msg, const QByteArray &data ) { 520void fileBrowser::receive( const QCString &msg, const QByteArray &data ) {
521// QDataStream stream( data, IO_ReadOnly ); 521// QDataStream stream( data, IO_ReadOnly );
522// if (msg == "keyRegister(int key, QString channel, QString message)") 522// if (msg == "keyRegister(int key, QString channel, QString message)")
523// { 523// {
524// int k; 524// int k;
525// QString c, m; 525// QString c, m;
526// stream >> k; 526// stream >> k;
527// stream >> c; 527// stream >> c;
528// stream >> m; 528// stream >> m;
529} 529}
530 530
531void fileBrowser::dirPathComboActivated( const QString & current) { 531void fileBrowser::dirPathComboActivated( const QString & current) {
532 chdir( current.latin1() ); 532 chdir( current.latin1() );
533 currentDir.cd( current, TRUE); 533 currentDir.cd( current, TRUE);
534 populateList(); 534 populateList();
535 update(); 535 update();
536} 536}
537 537
538void fileBrowser::dirPathEditPressed() { 538void fileBrowser::dirPathEditPressed() {
539 QString current = dirPathCombo->lineEdit()->text(); 539 QString current = dirPathCombo->lineEdit()->text();
540 chdir( current.latin1() ); 540 chdir( current.latin1() );
541 currentDir.cd( current, TRUE); 541 currentDir.cd( current, TRUE);
542 populateList(); 542 populateList();
543 update(); 543 update();
544} 544}
545 545
546void fileBrowser::fillCombo(const QString &currentPath) { 546void fileBrowser::fillCombo(const QString &currentPath) {
547 547
548 dirPathCombo->lineEdit()->setText(currentPath); 548 dirPathCombo->lineEdit()->setText(currentPath);
549 549
550 if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 550 if( dirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
551 dirPathCombo->clear(); 551 dirPathCombo->clear();
552 dirPathStringList.prepend(currentPath ); 552 dirPathStringList.prepend(currentPath );
553 dirPathCombo->insertStringList( dirPathStringList,-1); 553 dirPathCombo->insertStringList( dirPathStringList,-1);
554 } 554 }
555} 555}
556
557
558InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
559 : QDialog( parent, name, modal, fl )
560{
561 if ( !name )
562 setName( "InputDialog" );
563 resize( 234, 50 );
564 setMaximumSize( QSize( 240, 50 ) );
565 setCaption( tr(name ) );
566
567 LineEdit1 = new QLineEdit( this, "LineEdit1" );
568 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
569}
570
571InputDialog::~InputDialog()
572{
573 inputText= LineEdit1->text();
574
575}
576
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h
index bac3d2e..42f93b6 100644
--- a/core/apps/textedit/fileBrowser.h
+++ b/core/apps/textedit/fileBrowser.h
@@ -1,101 +1,118 @@
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>
30#include <qdialog.h>
31class QLineEdit;
32
29class QVBoxLayout; 33class QVBoxLayout;
30class QHBoxLayout; 34class QHBoxLayout;
31class QGridLayout; 35class QGridLayout;
32class QListView; 36class QListView;
33class QListViewItem; 37class QListViewItem;
34class QPushButton; 38class QPushButton;
35class QComboBox; 39class QComboBox;
36class QWidgetStack; 40class QWidgetStack;
37class FileSelector; 41class FileSelector;
38class QPoint; 42class QPoint;
39class MenuButton; 43class MenuButton;
40class QRegExp; 44class QRegExp;
41 45
42 46
43class fileBrowser : public QDialog 47class fileBrowser : public QDialog
44{ 48{
45 Q_OBJECT 49 Q_OBJECT
46 50
47public: 51public:
48 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);
49 ~fileBrowser(); 53 ~fileBrowser();
50 54
51 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton; 55 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton, *cdUpButton;
52 QListView* ListView; 56 QListView* ListView;
53 57
54 QLabel *dirLabel; 58 QLabel *dirLabel;
55 QString selectedFileName, filterStr; 59 QString selectedFileName, filterStr;
56 QDir currentDir; 60 QDir currentDir;
57 QFile file; 61 QFile file;
58 QStringList fileList, dirPathStringList; 62 QStringList fileList, dirPathStringList;
59 QListViewItem * item; 63 QListViewItem * item;
60 QComboBox *SelectionCombo, *dirPathCombo; 64 QComboBox *SelectionCombo, *dirPathCombo;
61 MenuButton *typemb; 65 MenuButton *typemb;
62 QWidgetStack *FileStack; 66 QWidgetStack *FileStack;
63 FileSelector *fileSelector; 67 FileSelector *fileSelector;
64 QString mimeType; 68 QString mimeType;
65public slots: 69public slots:
66 void setFileView( int ); 70 void setFileView( int );
67 71
68private: 72private:
69// QDict<void> mimes; 73// QDict<void> mimes;
70 QRegExp tf; 74 QRegExp tf;
71 QStringList getMimeTypes(); 75 QStringList getMimeTypes();
72 void fillCombo( const QString&); 76 void fillCombo( const QString&);
73 77
74private slots: 78private slots:
75 void populateList(); 79 void populateList();
76 void homeButtonPushed(); 80 void homeButtonPushed();
77 void docButtonPushed(); 81 void docButtonPushed();
78 void ListPressed( int, QListViewItem *, const QPoint&, int); 82 void ListPressed( int, QListViewItem *, const QPoint&, int);
79 void showListMenu(QListViewItem*); 83 void showListMenu(QListViewItem*);
80 void doCd(); 84 void doCd();
81 void makDir(); 85 void makDir();
82 void localRename(); 86 void localRename();
83 void localDelete(); 87 void localDelete();
84 void receive( const QCString &msg, const QByteArray &data ); 88 void receive( const QCString &msg, const QByteArray &data );
85 void dirPathComboActivated( const QString & ); 89 void dirPathComboActivated( const QString & );
86 void upDir(); 90 void upDir();
87 void listClicked( QListViewItem * ); 91 void listClicked( QListViewItem * );
88 void selectionChanged( const QString & ); 92 void selectionChanged( const QString & );
89 void OnOK(); 93 void OnOK();
90 void docOpen( const DocLnk & ); 94 void docOpen( const DocLnk & );
91 void updateMimeTypeMenu(); 95 void updateMimeTypeMenu();
92 void showType(const QString &); 96 void showType(const QString &);
93 void dirPathEditPressed(); 97 void dirPathEditPressed();
94 98
95protected slots: 99protected slots:
96 100
97protected: 101protected:
98 102
99}; 103};
100 104
105
106class InputDialog : public QDialog
107{
108 Q_OBJECT
109
110public:
111 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
112 ~InputDialog();
113 QString inputText;
114 QLineEdit* LineEdit1;
115
116};
117
101#endif // FILEBROWSER_H 118#endif // FILEBROWSER_H
diff --git a/core/apps/textedit/inputDialog.cpp b/core/apps/textedit/inputDialog.cpp
deleted file mode 100644
index 22205d3..0000000
--- a/core/apps/textedit/inputDialog.cpp
+++ b/dev/null
@@ -1,40 +0,0 @@
1/****************************************************************************
2 inputDialog.cpp
3 -------------------
4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 ***************************************************************************/
12
13#include "inputDialog.h"
14
15#include <qlineedit.h>
16#include <qlayout.h>
17#include <qvariant.h>
18#include <qtooltip.h>
19#include <qwhatsthis.h>
20
21
22InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
23 : QDialog( parent, name, modal, fl )
24{
25 if ( !name )
26 setName( "InputDialog" );
27 resize( 234, 50 );
28 setMaximumSize( QSize( 240, 50 ) );
29 setCaption( tr(name ) );
30
31 LineEdit1 = new QLineEdit( this, "LineEdit1" );
32 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
33}
34
35InputDialog::~InputDialog()
36{
37 inputText= LineEdit1->text();
38
39}
40
diff --git a/core/apps/textedit/inputDialog.h b/core/apps/textedit/inputDialog.h
deleted file mode 100644
index 2cd8285..0000000
--- a/core/apps/textedit/inputDialog.h
+++ b/dev/null
@@ -1,34 +0,0 @@
1/***************************************************************************
2 inputDialog.h
3 -------------------
4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 ***************************************************************************/
12#ifndef INPUTDIALOG_H
13#define INPUTDIALOG_H
14
15#include <qvariant.h>
16#include <qdialog.h>
17class QVBoxLayout;
18class QHBoxLayout;
19class QGridLayout;
20class QLineEdit;
21
22class InputDialog : public QDialog
23{
24 Q_OBJECT
25
26public:
27 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
28 ~InputDialog();
29 QString inputText;
30 QLineEdit* LineEdit1;
31
32};
33
34#endif // INPUTDIALOG_H
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro
index 37ddf15..9b743d3 100644
--- a/core/apps/textedit/textedit.pro
+++ b/core/apps/textedit/textedit.pro
@@ -1,15 +1,15 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 3
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = textedit.h fileBrowser.h fontDialog.h fileSaver.h filePermissions.h inputDialog.h 5HEADERS = textedit.h fileBrowser.h fontDialog.h fileSaver.h filePermissions.h
6SOURCES = main.cpp textedit.cpp fileBrowser.cpp fontDialog.cpp fileSaver.cpp filePermissions.cpp inputDialog.cpp 6SOURCES = main.cpp textedit.cpp fileBrowser.cpp fontDialog.cpp fileSaver.cpp filePermissions.cpp
7 7
8INCLUDEPATH += $(OPIEDIR)/include 8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDPATH += $(OPIEDIR)/include 9DEPENDPATH += $(OPIEDIR)/include
10LIBS += -lqpe 10LIBS += -lqpe
11 11
12TARGET = textedit 12TARGET = textedit
13 13
14TRANSLATIONS += ../i18n/de/textedit.ts 14TRANSLATIONS += ../i18n/de/textedit.ts
15TRANSLATIONS += ../i18n/pt_BR/textedit.ts 15TRANSLATIONS += ../i18n/pt_BR/textedit.ts