summaryrefslogtreecommitdiff
path: root/core/apps
authorllornkcor <llornkcor>2002-04-01 23:50:15 (UTC)
committer llornkcor <llornkcor>2002-04-01 23:50:15 (UTC)
commitdd9e49cca8cd9a32a52edfc6b6a0683579612a75 (patch) (unidiff)
treeca4bdb7f60150ae147be009a2967721489a81d54 /core/apps
parentcf0ee2d22d3f31ba992df6735968d15b3653820b (diff)
downloadopie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.zip
opie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.tar.gz
opie-dd9e49cca8cd9a32a52edfc6b6a0683579612a75.tar.bz2
input dialog
Diffstat (limited to 'core/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp43
-rw-r--r--core/apps/textedit/fileBrowser.h2
2 files changed, 28 insertions, 17 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
@@ -8,13 +8,13 @@
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>
@@ -47,31 +47,38 @@ static int get_unique_id()
47fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) 47fileBrowser::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( ) ),
@@ -127,13 +134,14 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
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" ) );
@@ -213,13 +221,13 @@ void fileBrowser::populateList()
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) {
@@ -414,13 +422,13 @@ void fileBrowser::makDir() {
414} 422}
415 423
416void fileBrowser::localRename() { 424void 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");
@@ -489,20 +497,20 @@ void fileBrowser::showType(const QString &t) {
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();
@@ -608,6 +616,9 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags
608InputDialog::~InputDialog() 616InputDialog::~InputDialog()
609{ 617{
610 inputText= LineEdit1->text(); 618 inputText= LineEdit1->text();
611 619
612} 620}
613 621
622void 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
@@ -110,10 +110,10 @@ class InputDialog : public QDialog
110 110
111public: 111public:
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