summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-21 15:03:56 (UTC)
committer llornkcor <llornkcor>2002-05-21 15:03:56 (UTC)
commit0ba2d95e89f55b13f2247819b6672362a8b5a484 (patch) (unidiff)
tree3ee26bbcef62cca6192bd932658ed93708c23678
parentd65dc25caec62d4c554c99fbc151bf4d07c63b72 (diff)
downloadopie-0ba2d95e89f55b13f2247819b6672362a8b5a484.zip
opie-0ba2d95e89f55b13f2247819b6672362a8b5a484.tar.gz
opie-0ba2d95e89f55b13f2247819b6672362a8b5a484.tar.bz2
maybe fixed bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp24
-rw-r--r--core/apps/textedit/textedit.cpp4
2 files changed, 14 insertions, 14 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index fced326..9ad0d69 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,140 +1,140 @@
1/**************************************************************************** 1/****************************************************************************
2** copyright 2001 ljp ljp@llornkcor.com 2** copyright 2001 ljp ljp@llornkcor.com
3** Created: Fri Dec 14 08:16:46 2001 3** Created: Fri Dec 14 08:16:46 2001
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#define QTOPIA_INTERNAL_MIMEEXT 14#define QTOPIA_INTERNAL_MIMEEXT
15#include "fileBrowser.h" 15#include "fileBrowser.h"
16//#include "inputDialog.h" 16//#include "inputDialog.h"
17 17
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/fileselector.h> 20#include <qpe/fileselector.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/menubutton.h> 22#include <qpe/menubutton.h>
23#include <qpe/mimetype.h> 23#include <qpe/mimetype.h>
24 24
25#include <qdict.h> 25#include <qdict.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qcombo.h> 28#include <qcombo.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <unistd.h> 33#include <unistd.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qstringlist.h> 36#include <qstringlist.h>
37 37
38#include <unistd.h> 38#include <unistd.h>
39#include <stdlib.h> 39#include <stdlib.h>
40 40
41static int u_id = 1; 41static int u_id = 1;
42static int get_unique_id() 42static int get_unique_id()
43{ 43{
44 return u_id++; 44 return u_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( "fileBrowser" ); 51 setName( "fileBrowser" );
52 setCaption(tr( name ) ); 52 setCaption(tr( name ) );
53 53
54// getMimeTypes(); 54// getMimeTypes();
55 55
56 mimeType = mimeFilter; 56// mimeType = mimeFilter;
57 MimeType mt( mimeType); 57// MimeType mt( mimeType);
58 58
59 if( mt.extension().isEmpty()) { 59// if( mt.extension().isEmpty()) {
60 60
61 QStringList filterList; 61// QStringList filterList;
62 filterList=QStringList::split(";",mimeFilter,FALSE); 62// filterList=QStringList::split(";",mimeFilter,FALSE);
63 63
64 for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { 64// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) {
65 printf( "%s \n", (*it).latin1() ); 65// printf( "%s \n", (*it).latin1() );
66 } 66// }
67 67
68 filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; 68// filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*";
69 69
70 qDebug(filterStr); 70// qDebug(filterStr);
71 } else { 71// } else {
72 filterStr = "*."+ mt.extension(); 72 filterStr = "*."+ mt.extension();
73// qDebug("description "+mt.description()); 73// qDebug("description "+mt.description());
74// qDebug( "id "+mt.id()); 74// qDebug( "id "+mt.id());
75// qDebug("extension "+mt.extension()); 75// qDebug("extension "+mt.extension());
76 } 76// }
77// channel = new QCopChannel( "QPE/fileDialog", this ); 77// channel = new QCopChannel( "QPE/fileDialog", this );
78// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 78// connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
79// this, SLOT(receive(const QCString&, const QByteArray&)) ); 79// this, SLOT(receive(const QCString&, const QByteArray&)) );
80 80
81 QGridLayout *layout = new QGridLayout( this ); 81 QGridLayout *layout = new QGridLayout( this );
82 layout->setSpacing( 4 ); 82 layout->setSpacing( 4 );
83 layout->setMargin( 4 ); 83 layout->setMargin( 4 );
84 84
85 dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" ); 85 dirPathCombo = new QComboBox( FALSE, this, "dirPathCombo" );
86 dirPathCombo->setEditable(TRUE); 86 dirPathCombo->setEditable(TRUE);
87 87
88 connect( dirPathCombo, SIGNAL( activated( const QString & ) ), 88 connect( dirPathCombo, SIGNAL( activated( const QString & ) ),
89 this, SLOT( dirPathComboActivated( const QString & ) ) ); 89 this, SLOT( dirPathComboActivated( const QString & ) ) );
90 90
91 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ), 91 connect( dirPathCombo->lineEdit(), SIGNAL( returnPressed( ) ),
92 this, SLOT( dirPathEditPressed( ) ) ); 92 this, SLOT( dirPathEditPressed( ) ) );
93 93
94 dirPathStringList << "/"; 94 dirPathStringList << "/";
95// we can get the storage here 95// we can get the storage here
96 96
97 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 ); 97 layout->addMultiCellWidget( dirPathCombo, 0, 0, 0, 4 );
98 98
99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
100 cdUpButton ->setMinimumSize( QSize( 20, 20 ) ); 100 cdUpButton ->setMinimumSize( QSize( 20, 20 ) );
101 cdUpButton ->setMaximumSize( QSize( 20, 20 ) ); 101 cdUpButton ->setMaximumSize( QSize( 20, 20 ) );
102 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 102 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
103 cdUpButton ->setFlat(TRUE); 103 cdUpButton ->setFlat(TRUE);
104 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 ); 104 layout->addMultiCellWidget( cdUpButton, 0, 0, 5, 5 );
105 105
106 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 106 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
107 docButton->setMinimumSize( QSize( 20, 20 ) ); 107 docButton->setMinimumSize( QSize( 20, 20 ) );
108 docButton->setMaximumSize( QSize( 20, 20 ) ); 108 docButton->setMaximumSize( QSize( 20, 20 ) );
109 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 109 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
110 docButton->setFlat(TRUE); 110 docButton->setFlat(TRUE);
111 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 111 layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
112 112
113 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 113 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
114 homeButton->setMinimumSize( QSize( 20, 20 ) ); 114 homeButton->setMinimumSize( QSize( 20, 20 ) );
115 homeButton->setMaximumSize( QSize( 20, 20 ) ); 115 homeButton->setMaximumSize( QSize( 20, 20 ) );
116 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 116 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
117 homeButton->setFlat(TRUE); 117 homeButton->setFlat(TRUE);
118 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 ); 118 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7 );
119 119
120 FileStack = new QWidgetStack( this ); 120 FileStack = new QWidgetStack( this );
121 121
122 ListView = new QListView( this, "ListView" ); 122 ListView = new QListView( this, "ListView" );
123// ListView->setMinimumSize( QSize( 100, 25 ) ); 123// ListView->setMinimumSize( QSize( 100, 25 ) );
124 ListView->addColumn( tr( "Name" ) ); 124 ListView->addColumn( tr( "Name" ) );
125 ListView->setColumnWidth(0,120); 125 ListView->setColumnWidth(0,120);
126 ListView->setSorting( 2, FALSE); 126 ListView->setSorting( 2, FALSE);
127 ListView->addColumn( tr( "Size" ) ); 127 ListView->addColumn( tr( "Size" ) );
128 ListView->setColumnWidth(1,-1); 128 ListView->setColumnWidth(1,-1);
129 ListView->addColumn( "Date",-1); 129 ListView->addColumn( "Date",-1);
130 130
131 ListView->setColumnWidthMode(0,QListView::Manual); 131 ListView->setColumnWidthMode(0,QListView::Manual);
132 ListView->setColumnAlignment(1,QListView::AlignRight); 132 ListView->setColumnAlignment(1,QListView::AlignRight);
133 ListView->setColumnAlignment(2,QListView::AlignRight); 133 ListView->setColumnAlignment(2,QListView::AlignRight);
134 ListView->setAllColumnsShowFocus( TRUE ); 134 ListView->setAllColumnsShowFocus( TRUE );
135 135
136 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 136 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
137 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 137 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
138 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 138 this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
139 139
140 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 140 connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 19449cb..b8d62db 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -449,134 +449,134 @@ void TextEdit::zoomOut()
449 449
450void TextEdit::setFontSize(int sz, bool round_down_not_up) 450void TextEdit::setFontSize(int sz, bool round_down_not_up)
451{ 451{
452 int s=10; 452 int s=10;
453 for (int i=0; i<nfontsizes; i++) { 453 for (int i=0; i<nfontsizes; i++) {
454 if ( fontsize[i] == sz ) { 454 if ( fontsize[i] == sz ) {
455 s = sz; 455 s = sz;
456 break; 456 break;
457 } else if ( round_down_not_up ) { 457 } else if ( round_down_not_up ) {
458 if ( fontsize[i] < sz ) 458 if ( fontsize[i] < sz )
459 s = fontsize[i]; 459 s = fontsize[i];
460 } else { 460 } else {
461 if ( fontsize[i] > sz ) { 461 if ( fontsize[i] > sz ) {
462 s = fontsize[i]; 462 s = fontsize[i];
463 break; 463 break;
464 } 464 }
465 } 465 }
466 } 466 }
467 467
468 QFont f = editor->font(); 468 QFont f = editor->font();
469 f.setPointSize(s); 469 f.setPointSize(s);
470 editor->setFont(f); 470 editor->setFont(f);
471 471
472 zin->setEnabled(s != fontsize[nfontsizes-1]); 472 zin->setEnabled(s != fontsize[nfontsizes-1]);
473 zout->setEnabled(s != fontsize[0]); 473 zout->setEnabled(s != fontsize[0]);
474} 474}
475 475
476void TextEdit::setBold(bool y) 476void TextEdit::setBold(bool y)
477{ 477{
478 QFont f = editor->font(); 478 QFont f = editor->font();
479 f.setBold(y); 479 f.setBold(y);
480 editor->setFont(f); 480 editor->setFont(f);
481} 481}
482 482
483void TextEdit::setItalic(bool y) 483void TextEdit::setItalic(bool y)
484{ 484{
485 QFont f = editor->font(); 485 QFont f = editor->font();
486 f.setItalic(y); 486 f.setItalic(y);
487 editor->setFont(f); 487 editor->setFont(f);
488} 488}
489 489
490void TextEdit::setWordWrap(bool y) 490void TextEdit::setWordWrap(bool y)
491{ 491{
492 bool state = editor->edited(); 492 bool state = editor->edited();
493 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 493 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
494 editor->setEdited( state ); 494 editor->setEdited( state );
495} 495}
496 496
497void TextEdit::fileNew() 497void TextEdit::fileNew()
498{ 498{
499// if( !bFromDocView ) { 499// if( !bFromDocView ) {
500// saveAs(); 500// saveAs();
501// } 501// }
502 newFile(DocLnk()); 502 newFile(DocLnk());
503} 503}
504 504
505void TextEdit::fileOpen() 505void TextEdit::fileOpen()
506{ 506{
507 Config cfg("TextEdit"); 507 Config cfg("TextEdit");
508 cfg.setGroup("View"); 508 cfg.setGroup("View");
509 bool b=FALSE; 509 bool b=FALSE;
510 if(cfg.readEntry("useOldFileDialog") == "TRUE") 510 if(cfg.readEntry("useOldFileDialog") == "TRUE")
511 b=TRUE; 511 b=TRUE;
512 if(!b) { 512 if(!b) {
513 QString str = OFileDialog::getOpenFileName( 1,"/","", "text/plain", this ); 513 QString str = OFileDialog::getOpenFileName( 1,"/","", "*", this );
514 if(!str.isEmpty() ) 514 if(!str.isEmpty() )
515 openFile( str ); 515 openFile( str );
516 } else { 516 } else {
517 QString str; 517 QString str;
518 browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "text/*"); // 518 browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); //
519 browseForFiles->setFileView( viewSelection ); 519 browseForFiles->setFileView( viewSelection );
520 browseForFiles->showMaximized(); 520 browseForFiles->showMaximized();
521// if( result != -1 ) 521// if( result != -1 )
522 522
523 if( browseForFiles->exec() != -1 ) { 523 if( browseForFiles->exec() != -1 ) {
524 QString selFile = browseForFiles->selectedFileName; 524 QString selFile = browseForFiles->selectedFileName;
525 QStringList fileList = browseForFiles->fileList; 525 QStringList fileList = browseForFiles->fileList;
526 qDebug(selFile); 526 qDebug(selFile);
527 QStringList::ConstIterator f; 527 QStringList::ConstIterator f;
528 QString fileTemp; 528 QString fileTemp;
529 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 529 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
530 fileTemp = *f; 530 fileTemp = *f;
531 fileTemp.right( fileTemp.length()-5); 531 fileTemp.right( fileTemp.length()-5);
532 QString fileName = fileTemp; 532 QString fileName = fileTemp;
533 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 533 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
534 currentFileName = fileName; 534 currentFileName = fileName;
535 qDebug("please open "+currentFileName); 535 qDebug("please open "+currentFileName);
536 openFile(currentFileName ); 536 openFile(currentFileName );
537 } 537 }
538 } 538 }
539 viewSelection = browseForFiles->SelectionCombo->currentItem(); 539 viewSelection = browseForFiles->SelectionCombo->currentItem();
540 } 540 }
541 delete browseForFiles; 541 delete browseForFiles;
542 editor->setEdited( FALSE); 542 editor->setEdited( FALSE);
543 edited1=FALSE; 543 edited1=FALSE;
544 edited=FALSE; 544 edited=FALSE;
545 if(caption().left(1)=="*") 545 if(caption().left(1)=="*")
546 setCaption(caption().right(caption().length()-1)); 546 setCaption(caption().right(caption().length()-1));
547 doSearchBar(); 547 doSearchBar();
548 } 548 }
549} 549}
550 550
551void TextEdit::doSearchBar() 551void TextEdit::doSearchBar()
552{ 552{
553 Config cfg("TextEdit"); 553 Config cfg("TextEdit");
554 cfg.setGroup("View"); 554 cfg.setGroup("View");
555 if(cfg.readEntry("SearchBar","Closed") != "Opened") 555 if(cfg.readEntry("SearchBar","Closed") != "Opened")
556 searchBar->hide(); 556 searchBar->hide();
557} 557}
558 558
559#if 0 559#if 0
560void TextEdit::slotFind() 560void TextEdit::slotFind()
561{ 561{
562 FindDialog frmFind( tr("Text Editor"), this ); 562 FindDialog frmFind( tr("Text Editor"), this );
563 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 563 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
564 editor, SLOT(slotDoFind( const QString&,bool,bool))); 564 editor, SLOT(slotDoFind( const QString&,bool,bool)));
565 565
566 //case sensitive, backwards, [category] 566 //case sensitive, backwards, [category]
567 567
568 connect( editor, SIGNAL(notFound()), 568 connect( editor, SIGNAL(notFound()),
569 &frmFind, SLOT(slotNotFound()) ); 569 &frmFind, SLOT(slotNotFound()) );
570 connect( editor, SIGNAL(searchWrapped()), 570 connect( editor, SIGNAL(searchWrapped()),
571 &frmFind, SLOT(slotWrapAround()) ); 571 &frmFind, SLOT(slotWrapAround()) );
572 572
573 frmFind.exec(); 573 frmFind.exec();
574 574
575 575
576} 576}
577#endif 577#endif
578 578
579void TextEdit::fileRevert() 579void TextEdit::fileRevert()
580{ 580{
581 clear(); 581 clear();
582 fileOpen(); 582 fileOpen();