-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 43 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/inputDialog.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/inputDialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 4 |
5 files changed, 35 insertions, 20 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 8ea8067..652f830 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -1,30 +1,30 @@ | |||
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> |
@@ -37,51 +37,58 @@ | |||
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 | mimeType = mimeFilter; | 53 | // mimeType = mimeFilter; |
54 | MimeType mt( mimeType); | 54 | // MimeType mt( mimeType); |
55 | if( mt.extension().isEmpty()) | 55 | // if( mt.extension().isEmpty()) |
56 | filterStr = "*"; | 56 | QStringList filterList; |
57 | else | 57 | filterList=QStringList::split(";",mimeFilter,FALSE); |
58 | filterStr = "*."+ mt.extension(); | 58 | for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { |
59 | printf( "%s \n", (*it).latin1() ); | ||
60 | } | ||
61 | |||
62 | filterStr = mimeFilter.right(mimeFilter.length()- mimeFilter.find("/",0,TRUE) - 1);// "*"; | ||
63 | qDebug(filterStr); | ||
64 | // else | ||
65 | // filterStr = "*."+ mt.extension(); | ||
59 | // qDebug("description "+mt.description()); | 66 | // qDebug("description "+mt.description()); |
60 | // qDebug( "id "+mt.id()); | 67 | // qDebug( "id "+mt.id()); |
61 | // qDebug("extension "+mt.extension()); | 68 | // qDebug("extension "+mt.extension()); |
62 | 69 | ||
63 | // channel = new QCopChannel( "QPE/fileDialog", this ); | 70 | // channel = new QCopChannel( "QPE/fileDialog", this ); |
64 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 71 | // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
65 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); | 72 | // this, SLOT(receive(const QCString&, const QByteArray&)) ); |
66 | 73 | ||
67 | QGridLayout *layout = new QGridLayout( this ); | 74 | QGridLayout *layout = new QGridLayout( this ); |
68 | layout->setSpacing( 4 ); | 75 | layout->setSpacing( 4 ); |
69 | layout->setMargin( 4 ); | 76 | layout->setMargin( 4 ); |
70 | 77 | ||
71 | dirPathCombo = new QComboBox( FALSE, this, "dorPathCombo" ); | 78 | dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); |
72 | dirPathCombo->setEditable(TRUE); | 79 | dirPathCombo->setEditable(TRUE); |
73 | 80 | ||
74 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), | 81 | connect( dirPathCombo, SIGNAL( activated( const QString & ) ), |
75 | this, SLOT( dirPathComboActivated( const QString & ) ) ); | 82 | this, SLOT( dirPathComboActivated( const QString & ) ) ); |
76 | 83 | ||
77 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), | 84 | connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), |
78 | this, SLOT( dirPathEditPressed( ) ) ); | 85 | this, SLOT( dirPathEditPressed( ) ) ); |
79 | 86 | ||
80 | dirPathStringList << "/"; | 87 | dirPathStringList << "/"; |
81 | // we can get the storage here | 88 | // we can get the storage here |
82 | 89 | ||
83 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); | 90 | layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); |
84 | 91 | ||
85 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 92 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
86 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); | 93 | cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); |
87 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); | 94 | cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); |
@@ -117,33 +124,34 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
117 | ListView->setColumnWidthMode(0,QListView::Manual); | 124 | ListView->setColumnWidthMode(0,QListView::Manual); |
118 | ListView->setColumnAlignment(1,QListView::AlignRight); | 125 | ListView->setColumnAlignment(1,QListView::AlignRight); |
119 | ListView->setColumnAlignment(2,QListView::AlignRight); | 126 | ListView->setColumnAlignment(2,QListView::AlignRight); |
120 | ListView->setAllColumnsShowFocus( TRUE ); | 127 | ListView->setAllColumnsShowFocus( TRUE ); |
121 | 128 | ||
122 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 129 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
123 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 130 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
124 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 131 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
125 | 132 | ||
126 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 133 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
127 | 134 | ||
128 | FileStack->addWidget( ListView, get_unique_id() ); | 135 | FileStack->addWidget( ListView, get_unique_id() ); |
129 | 136 | ||
130 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 137 | fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
131 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 138 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
132 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 139 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
133 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 140 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), |
141 | this, SLOT( docOpen( const DocLnk & ) ) ); | ||
134 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); | 142 | layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); |
135 | 143 | ||
136 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); | 144 | SelectionCombo = new QComboBox( FALSE, this, "SelectionCombo" ); |
137 | SelectionCombo->insertItem( tr( "Documents" ) ); | 145 | SelectionCombo->insertItem( tr( "Documents" ) ); |
138 | SelectionCombo->insertItem( tr( "All files" ) ); | 146 | SelectionCombo->insertItem( tr( "All files" ) ); |
139 | SelectionCombo->insertItem( tr( "Hidden files" ) ); | 147 | SelectionCombo->insertItem( tr( "Hidden files" ) ); |
140 | // SelectionCombo->setMaximumWidth(120); | 148 | // SelectionCombo->setMaximumWidth(120); |
141 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); | 149 | layout->addMultiCellWidget( SelectionCombo, 2, 2, 0, 3 ); |
142 | 150 | ||
143 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), | 151 | connect( SelectionCombo, SIGNAL( activated( const QString & ) ), |
144 | this, SLOT( selectionChanged( const QString & ) ) ); | 152 | this, SLOT( selectionChanged( const QString & ) ) ); |
145 | 153 | ||
146 | typemb = new MenuButton(this); | 154 | typemb = new MenuButton(this); |
147 | typemb->setLabel(tr("Type: %1")); | 155 | typemb->setLabel(tr("Type: %1")); |
148 | typemb->setMinimumWidth(110); | 156 | typemb->setMinimumWidth(110); |
149 | typemb->setFixedHeight(22); | 157 | typemb->setFixedHeight(22); |
@@ -203,33 +211,33 @@ void fileBrowser::populateList() | |||
203 | } | 211 | } |
204 | if(fileL !="./" && fi->exists()) { | 212 | if(fileL !="./" && fi->exists()) { |
205 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 213 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
206 | QPixmap pm; | 214 | QPixmap pm; |
207 | 215 | ||
208 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 216 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
209 | if( !QDir( fi->filePath() ).isReadable()) | 217 | if( !QDir( fi->filePath() ).isReadable()) |
210 | pm = Resource::loadPixmap( "lockedfolder" ); | 218 | pm = Resource::loadPixmap( "lockedfolder" ); |
211 | else | 219 | else |
212 | pm= Resource::loadPixmap( "folder" ); | 220 | pm= Resource::loadPixmap( "folder" ); |
213 | item->setPixmap( 0,pm ); | 221 | item->setPixmap( 0,pm ); |
214 | } else { | 222 | } else { |
215 | if( !fi->isReadable() ) | 223 | if( !fi->isReadable() ) |
216 | pm = Resource::loadPixmap( "locked" ); | 224 | pm = Resource::loadPixmap( "locked" ); |
217 | else { | 225 | else { |
218 | MimeType mt(fi->filePath()); | 226 | MimeType mt(fi->filePath()); |
219 | pm=mt.pixmap(); | 227 | pm=mt.pixmap();// sets the pixmap for the mimetype |
220 | if(pm.isNull()) | 228 | if(pm.isNull()) |
221 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 229 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
222 | item->setPixmap( 0,pm); | 230 | item->setPixmap( 0,pm); |
223 | } | 231 | } |
224 | } | 232 | } |
225 | if( fileL.find("->",0,TRUE) != -1) { | 233 | if( fileL.find("->",0,TRUE) != -1) { |
226 | // overlay link image | 234 | // overlay link image |
227 | pm= Resource::loadPixmap( "folder" ); | 235 | pm= Resource::loadPixmap( "folder" ); |
228 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 236 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
229 | QPainter painter( &pm ); | 237 | QPainter painter( &pm ); |
230 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 238 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
231 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 239 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
232 | item->setPixmap( 0, pm); | 240 | item->setPixmap( 0, pm); |
233 | } | 241 | } |
234 | } | 242 | } |
235 | isDir=FALSE; | 243 | isDir=FALSE; |
@@ -404,33 +412,33 @@ void fileBrowser::doCd() { | |||
404 | void fileBrowser::makDir() { | 412 | void fileBrowser::makDir() { |
405 | InputDialog *fileDlg; | 413 | InputDialog *fileDlg; |
406 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); | 414 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); |
407 | fileDlg->exec(); | 415 | fileDlg->exec(); |
408 | if( fileDlg->result() == 1 ) { | 416 | if( fileDlg->result() == 1 ) { |
409 | QString filename = fileDlg->LineEdit1->text(); | 417 | QString filename = fileDlg->LineEdit1->text(); |
410 | qDebug("Make dir"); | 418 | qDebug("Make dir"); |
411 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 419 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
412 | } | 420 | } |
413 | populateList(); | 421 | populateList(); |
414 | } | 422 | } |
415 | 423 | ||
416 | void fileBrowser::localRename() { | 424 | void fileBrowser::localRename() { |
417 | QString curFile = ListView->currentItem()->text(0); | 425 | QString curFile = ListView->currentItem()->text(0); |
418 | InputDialog *fileDlg; | 426 | InputDialog *fileDlg; |
419 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); | 427 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); |
420 | fileDlg->inputText = curFile; | 428 | fileDlg->setTextEdit((const QString &) curFile); |
421 | fileDlg->exec(); | 429 | fileDlg->exec(); |
422 | if( fileDlg->result() == 1 ) { | 430 | if( fileDlg->result() == 1 ) { |
423 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 431 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
424 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 432 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
425 | if( rename(oldname.latin1(), newName.latin1())== -1) | 433 | if( rename(oldname.latin1(), newName.latin1())== -1) |
426 | QMessageBox::message("Note","Could not rename"); | 434 | QMessageBox::message("Note","Could not rename"); |
427 | } | 435 | } |
428 | populateList(); | 436 | populateList(); |
429 | } | 437 | } |
430 | 438 | ||
431 | void fileBrowser::localDelete() { | 439 | void fileBrowser::localDelete() { |
432 | QString f = ListView->currentItem()->text(0); | 440 | QString f = ListView->currentItem()->text(0); |
433 | if(QDir(f).exists() ) { | 441 | if(QDir(f).exists() ) { |
434 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ | 442 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ |
435 | " ?\nIt must be empty","Yes","No",0,0,1) ) { | 443 | " ?\nIt must be empty","Yes","No",0,0,1) ) { |
436 | case 0: { | 444 | case 0: { |
@@ -479,40 +487,40 @@ void fileBrowser::updateMimeTypeMenu() { | |||
479 | // typemb->select(prev); | 487 | // typemb->select(prev); |
480 | 488 | ||
481 | connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); | 489 | connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); |
482 | } | 490 | } |
483 | 491 | ||
484 | void fileBrowser::showType(const QString &t) { | 492 | void fileBrowser::showType(const QString &t) { |
485 | 493 | ||
486 | qDebug(t); | 494 | qDebug(t); |
487 | if(t.find("All",0,TRUE) != -1) { | 495 | if(t.find("All",0,TRUE) != -1) { |
488 | filterStr = "*"; | 496 | filterStr = "*"; |
489 | } else { | 497 | } else { |
490 | QStringList list = mimetypes.grep( t,TRUE); | 498 | QStringList list = mimetypes.grep( t,TRUE); |
491 | QString ext; | 499 | QString ext; |
492 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 500 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
493 | mimeType =(*it); | 501 | mimeType =(*it); |
494 | MimeType mt( mimeType); | 502 | MimeType mt( mimeType); |
495 | qDebug("mime "+mimeType); | 503 | // qDebug("mime "+mimeType); |
496 | // qDebug("description "+mt.description()); | 504 | // qDebug("description "+mt.description()); |
497 | // qDebug( "id "+mt.id()); | 505 | // qDebug( "id "+mt.id()); |
498 | qDebug("extension "+mt.extension()); | 506 | // qDebug("extension "+mt.extension()); |
499 | if( mt.extension().isEmpty()) | 507 | // if( mt.extension().isEmpty()) |
500 | filterStr = "*"; | 508 | filterStr = "*"; |
501 | else | 509 | // else |
502 | filterStr = "*."+ mt.extension()+" "; | 510 | // filterStr = "*."+ mt.extension()+" "; |
503 | // printf( "%s \n", (*it).latin1() ); | 511 | // printf( "%s \n", (*it).latin1() ); |
504 | } | 512 | } |
505 | } | 513 | } |
506 | currentDir.setNameFilter(filterStr); | 514 | currentDir.setNameFilter(filterStr); |
507 | 515 | ||
508 | populateList(); | 516 | populateList(); |
509 | update(); | 517 | update(); |
510 | // if(fileSelector) { | 518 | // if(fileSelector) { |
511 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 519 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
512 | // delete fileSelector; | 520 | // delete fileSelector; |
513 | // } | 521 | // } |
514 | // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy | 522 | // fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy |
515 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); | 523 | // connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); |
516 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 524 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
517 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 525 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
518 | // fileSelector->reread(); | 526 | // fileSelector->reread(); |
@@ -598,16 +606,19 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
598 | if ( !name ) | 606 | if ( !name ) |
599 | setName( "InputDialog" ); | 607 | setName( "InputDialog" ); |
600 | resize( 234, 50 ); | 608 | resize( 234, 50 ); |
601 | setMaximumSize( QSize( 240, 50 ) ); | 609 | setMaximumSize( QSize( 240, 50 ) ); |
602 | setCaption( tr(name ) ); | 610 | setCaption( tr(name ) ); |
603 | 611 | ||
604 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 612 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
605 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 613 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
606 | } | 614 | } |
607 | 615 | ||
608 | InputDialog::~InputDialog() | 616 | InputDialog::~InputDialog() |
609 | { | 617 | { |
610 | inputText= LineEdit1->text(); | 618 | inputText= LineEdit1->text(); |
611 | 619 | ||
612 | } | 620 | } |
613 | 621 | ||
622 | void InputDialog::setTextEdit(const QString &string) { | ||
623 | LineEdit1->setText(string); | ||
624 | } | ||
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index e76c7df..3db6a27 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h | |||
@@ -100,20 +100,20 @@ private slots: | |||
100 | protected slots: | 100 | protected slots: |
101 | 101 | ||
102 | protected: | 102 | protected: |
103 | 103 | ||
104 | }; | 104 | }; |
105 | 105 | ||
106 | 106 | ||
107 | class InputDialog : public QDialog | 107 | class InputDialog : public QDialog |
108 | { | 108 | { |
109 | Q_OBJECT | 109 | Q_OBJECT |
110 | 110 | ||
111 | public: | 111 | public: |
112 | 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 ); |
113 | ~InputDialog(); | 113 | ~InputDialog(); |
114 | QString inputText; | 114 | QString inputText; |
115 | QLineEdit* LineEdit1; | 115 | QLineEdit* LineEdit1; |
116 | 116 | void setTextEdit(const QString &); | |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #endif // FILEBROWSER_H | 119 | #endif // FILEBROWSER_H |
diff --git a/noncore/net/opieftp/inputDialog.cpp b/noncore/net/opieftp/inputDialog.cpp index 89b345e..373db3b 100644 --- a/noncore/net/opieftp/inputDialog.cpp +++ b/noncore/net/opieftp/inputDialog.cpp | |||
@@ -25,16 +25,20 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
25 | if ( !name ) | 25 | if ( !name ) |
26 | setName( "InputDialog" ); | 26 | setName( "InputDialog" ); |
27 | resize( 234, 50 ); | 27 | resize( 234, 50 ); |
28 | setMaximumSize( QSize( 240, 50 ) ); | 28 | setMaximumSize( QSize( 240, 50 ) ); |
29 | setCaption( tr(name ) ); | 29 | setCaption( tr(name ) ); |
30 | 30 | ||
31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 31 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
32 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 32 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
33 | } | 33 | } |
34 | 34 | ||
35 | InputDialog::~InputDialog() | 35 | InputDialog::~InputDialog() |
36 | { | 36 | { |
37 | inputText= LineEdit1->text(); | 37 | inputText= LineEdit1->text(); |
38 | 38 | ||
39 | } | 39 | } |
40 | 40 | ||
41 | void InputDialog::setTextEdit(const QString &string) | ||
42 | { | ||
43 | LineEdit1->setText(string); | ||
44 | } | ||
diff --git a/noncore/net/opieftp/inputDialog.h b/noncore/net/opieftp/inputDialog.h index 2cd8285..dfe0e8a 100644 --- a/noncore/net/opieftp/inputDialog.h +++ b/noncore/net/opieftp/inputDialog.h | |||
@@ -15,20 +15,20 @@ | |||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | class QVBoxLayout; | 17 | class QVBoxLayout; |
18 | class QHBoxLayout; | 18 | class QHBoxLayout; |
19 | class QGridLayout; | 19 | class QGridLayout; |
20 | class QLineEdit; | 20 | class QLineEdit; |
21 | 21 | ||
22 | class InputDialog : public QDialog | 22 | class InputDialog : public QDialog |
23 | { | 23 | { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | 25 | ||
26 | public: | 26 | public: |
27 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 27 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
28 | ~InputDialog(); | 28 | ~InputDialog(); |
29 | QString inputText; | 29 | QString inputText; |
30 | QLineEdit* LineEdit1; | 30 | QLineEdit* LineEdit1; |
31 | 31 | void setTextEdit(const QString &); | |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #endif // INPUTDIALOG_H | 34 | #endif // INPUTDIALOG_H |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e64fd73..b451925 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -930,55 +930,55 @@ void OpieFtp::remoteDelete() | |||
930 | msg.replace(QRegExp(":"),"\n"); | 930 | msg.replace(QRegExp(":"),"\n"); |
931 | QMessageBox::message(tr("Note"),msg); | 931 | QMessageBox::message(tr("Note"),msg); |
932 | } | 932 | } |
933 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 933 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
934 | } | 934 | } |
935 | break; | 935 | break; |
936 | }; | 936 | }; |
937 | } | 937 | } |
938 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 938 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
939 | } | 939 | } |
940 | 940 | ||
941 | void OpieFtp::remoteRename() | 941 | void OpieFtp::remoteRename() |
942 | { | 942 | { |
943 | QString curFile = Remote_View->currentItem()->text(0); | 943 | QString curFile = Remote_View->currentItem()->text(0); |
944 | InputDialog *fileDlg; | 944 | InputDialog *fileDlg; |
945 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 945 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
946 | fileDlg->inputText = curFile; | 946 | fileDlg->setTextEdit((const QString &)curFile); |
947 | fileDlg->exec(); | 947 | fileDlg->exec(); |
948 | if( fileDlg->result() == 1 ) { | 948 | if( fileDlg->result() == 1 ) { |
949 | QString oldName = currentRemoteDir +"/"+ curFile; | 949 | QString oldName = currentRemoteDir +"/"+ curFile; |
950 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 950 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
951 | QCopEnvelope ( "QPE/System", "busy()" ); | 951 | QCopEnvelope ( "QPE/System", "busy()" ); |
952 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 952 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
953 | QString msg; | 953 | QString msg; |
954 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 954 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
955 | msg.replace(QRegExp(":"),"\n"); | 955 | msg.replace(QRegExp(":"),"\n"); |
956 | QMessageBox::message(tr("Note"),msg); | 956 | QMessageBox::message(tr("Note"),msg); |
957 | } | 957 | } |
958 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 958 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
959 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 959 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
960 | } | 960 | } |
961 | } | 961 | } |
962 | 962 | ||
963 | void OpieFtp::localRename() | 963 | void OpieFtp::localRename() |
964 | { | 964 | { |
965 | QString curFile = Local_View->currentItem()->text(0); | 965 | QString curFile = Local_View->currentItem()->text(0); |
966 | InputDialog *fileDlg; | 966 | InputDialog *fileDlg; |
967 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 967 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
968 | fileDlg->inputText = curFile; | 968 | fileDlg->setTextEdit((const QString &)curFile); |
969 | fileDlg->exec(); | 969 | fileDlg->exec(); |
970 | if( fileDlg->result() == 1 ) { | 970 | if( fileDlg->result() == 1 ) { |
971 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 971 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
972 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 972 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
973 | if( rename(oldname.latin1(), newName.latin1())== -1) | 973 | if( rename(oldname.latin1(), newName.latin1())== -1) |
974 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 974 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
975 | } | 975 | } |
976 | populateLocalView(); | 976 | populateLocalView(); |
977 | } | 977 | } |
978 | 978 | ||
979 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { | 979 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
980 | if (TabWidget->currentPageIndex() == 0) { | 980 | if (TabWidget->currentPageIndex() == 0) { |
981 | chdir( currentPath.latin1() ); | 981 | chdir( currentPath.latin1() ); |
982 | currentDir.cd( currentPath, TRUE); | 982 | currentDir.cd( currentPath, TRUE); |
983 | populateLocalView(); | 983 | populateLocalView(); |
984 | update(); | 984 | update(); |