summaryrefslogtreecommitdiff
path: root/core/apps/textedit/fileBrowser.cpp
Unidiff
Diffstat (limited to 'core/apps/textedit/fileBrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index bc99348..f322513 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -45,13 +45,13 @@ static int get_unique_id()
45} 45}
46 46
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( tr("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// QStringList filterList; 56// QStringList filterList;
57// filterList=QStringList::split(";",mimeFilter,FALSE); 57// filterList=QStringList::split(";",mimeFilter,FALSE);
@@ -117,13 +117,13 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
117// ListView->setMinimumSize( QSize( 100, 25 ) ); 117// ListView->setMinimumSize( QSize( 100, 25 ) );
118 ListView->addColumn( tr( "Name" ) ); 118 ListView->addColumn( tr( "Name" ) );
119 ListView->setColumnWidth(0,120); 119 ListView->setColumnWidth(0,120);
120 ListView->setSorting( 2, FALSE); 120 ListView->setSorting( 2, FALSE);
121 ListView->addColumn( tr( "Size" ) ); 121 ListView->addColumn( tr( "Size" ) );
122 ListView->setColumnWidth(1,-1); 122 ListView->setColumnWidth(1,-1);
123 ListView->addColumn( tr("Date"),-1); 123 ListView->addColumn( "Date",-1);
124 124
125 ListView->setColumnWidthMode(0,QListView::Manual); 125 ListView->setColumnWidthMode(0,QListView::Manual);
126 ListView->setColumnAlignment(1,QListView::AlignRight); 126 ListView->setColumnAlignment(1,QListView::AlignRight);
127 ListView->setColumnAlignment(2,QListView::AlignRight); 127 ListView->setColumnAlignment(2,QListView::AlignRight);
128 ListView->setAllColumnsShowFocus( TRUE ); 128 ListView->setAllColumnsShowFocus( TRUE );
129 129
@@ -131,13 +131,13 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
131 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 131 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
132 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 132 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
133 133
134 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 134 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
135 135
136 FileStack->addWidget( ListView, get_unique_id() ); 136 FileStack->addWidget( ListView, get_unique_id() );
137 137mimeType="text/plain";
138 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy 138 fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
139// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); 139// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
140// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 140// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
141 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), 141 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ),
142 this, SLOT( docOpen( const DocLnk & ) ) ); 142 this, SLOT( docOpen( const DocLnk & ) ) );
143 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 ); 143 layout->addMultiCellWidget( FileStack, 1, 1, 0, 7 );
@@ -345,20 +345,20 @@ void fileBrowser::docButtonPushed() {
345 update(); 345 update();
346 346
347} 347}
348 348
349void fileBrowser::selectionChanged( const QString &select ) 349void fileBrowser::selectionChanged( const QString &select )
350{ 350{
351 if ( select == tr("Documents")) { 351 if ( select == "Documents") {
352 FileStack->raiseWidget( fileSelector ); 352 FileStack->raiseWidget( fileSelector );
353 dirPathCombo->hide(); 353 dirPathCombo->hide();
354 cdUpButton->hide(); 354 cdUpButton->hide();
355 docButton->hide(); 355 docButton->hide();
356 homeButton->hide(); 356 homeButton->hide();
357 } else { 357 } else {
358 if ( select == tr("All files") ) 358 if ( select == "All files" )
359 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All); 359 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::All);
360 else 360 else
361 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 361 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
362 362
363 populateList(); 363 populateList();
364 update(); 364 update();
@@ -409,56 +409,56 @@ void fileBrowser::showListMenu(QListViewItem *item) {
409void fileBrowser::doCd() { 409void fileBrowser::doCd() {
410 listClicked( ListView->currentItem()); 410 listClicked( ListView->currentItem());
411} 411}
412 412
413void fileBrowser::makDir() { 413void fileBrowser::makDir() {
414 InputDialog *fileDlg; 414 InputDialog *fileDlg;
415 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 415 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
416 fileDlg->exec(); 416 fileDlg->exec();
417 if( fileDlg->result() == 1 ) { 417 if( fileDlg->result() == 1 ) {
418 QString filename = fileDlg->LineEdit1->text(); 418 QString filename = fileDlg->LineEdit1->text();
419 qDebug("Make dir"); 419 qDebug("Make dir");
420 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 420 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
421 } 421 }
422 populateList(); 422 populateList();
423} 423}
424 424
425void fileBrowser::localRename() { 425void fileBrowser::localRename() {
426 QString curFile = ListView->currentItem()->text(0); 426 QString curFile = ListView->currentItem()->text(0);
427 InputDialog *fileDlg; 427 InputDialog *fileDlg;
428 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 428 fileDlg = new InputDialog(this,"Rename",TRUE, 0);
429 fileDlg->setTextEdit((const QString &) curFile); 429 fileDlg->setTextEdit((const QString &) curFile);
430 fileDlg->exec(); 430 fileDlg->exec();
431 if( fileDlg->result() == 1 ) { 431 if( fileDlg->result() == 1 ) {
432 QString oldname = currentDir.canonicalPath() + "/" + curFile; 432 QString oldname = currentDir.canonicalPath() + "/" + curFile;
433 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 433 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
434 if( rename(oldname.latin1(), newName.latin1())== -1) 434 if( rename(oldname.latin1(), newName.latin1())== -1)
435 QMessageBox::message(tr("Note"),tr("Could not rename")); 435 QMessageBox::message("Note","Could not rename");
436 } 436 }
437 populateList(); 437 populateList();
438} 438}
439 439
440void fileBrowser::localDelete() { 440void fileBrowser::localDelete() {
441 QString f = ListView->currentItem()->text(0); 441 QString f = ListView->currentItem()->text(0);
442 if(QDir(f).exists() ) { 442 if(QDir(f).exists() ) {
443 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 443 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
444 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 444 " ?\nIt must be empty","Yes","No",0,0,1) ) {
445 case 0: { 445 case 0: {
446 f=currentDir.canonicalPath()+"/"+f; 446 f=currentDir.canonicalPath()+"/"+f;
447 QString cmd="rmdir "+f; 447 QString cmd="rmdir "+f;
448 system( cmd.latin1()); 448 system( cmd.latin1());
449 populateList(); 449 populateList();
450 } 450 }
451 break; 451 break;
452 case 1: 452 case 1:
453 // exit 453 // exit
454 break; 454 break;
455 }; 455 };
456 } else { 456 } else {
457 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 457 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
458 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 458 +" ?","Yes","No",0,0,1) ) {
459 case 0: { 459 case 0: {
460 f=currentDir.canonicalPath()+"/"+f; 460 f=currentDir.canonicalPath()+"/"+f;
461 QString cmd="rm "+f; 461 QString cmd="rm "+f;
462 system( cmd.latin1()); 462 system( cmd.latin1());
463 populateList(); 463 populateList();
464 } 464 }
@@ -490,13 +490,13 @@ void fileBrowser::updateMimeTypeMenu() {
490 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 490 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
491} 491}
492 492
493void fileBrowser::showType(const QString &t) { 493void fileBrowser::showType(const QString &t) {
494 494
495 qDebug(t); 495 qDebug(t);
496 if(t.find(tr("All"),0,TRUE) != -1) { 496 if(t.find("All",0,TRUE) != -1) {
497 filterStr = "*"; 497 filterStr = "*";
498 } else { 498 } else {
499 QStringList list = mimetypes.grep( t,TRUE); 499 QStringList list = mimetypes.grep( t,TRUE);
500 QString ext; 500 QString ext;
501 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 501 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
502 mimeType =(*it); 502 mimeType =(*it);
@@ -602,13 +602,13 @@ void fileBrowser::fillCombo(const QString &currentPath) {
602 602
603 603
604InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 604InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
605 : QDialog( parent, name, modal, fl ) 605 : QDialog( parent, name, modal, fl )
606{ 606{
607 if ( !name ) 607 if ( !name )
608 setName( tr("InputDialog") ); 608 setName( "InputDialog" );
609 resize( 234, 50 ); 609 resize( 234, 50 );
610 setMaximumSize( QSize( 240, 50 ) ); 610 setMaximumSize( QSize( 240, 50 ) );
611 setCaption( tr(name ) ); 611 setCaption( tr(name ) );
612 612
613 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 613 LineEdit1 = new QLineEdit( this, "LineEdit1" );
614 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 614 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );