summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp60
1 files changed, 12 insertions, 48 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index ccc43fa..ea27e1b 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,90 +1,87 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// changes added by L. J. Potter Sun 02-17-2002 21:31:31 20// changes added by L. J. Potter Sun 02-17-2002 21:31:31
21 21
22#include "textedit.h" 22#include "textedit.h"
23//#include "fileBrowser.h"
24#include "fileSaver.h" 23#include "fileSaver.h"
25#include "filePermissions.h" 24#include "filePermissions.h"
26
27#include "fontDialog.h" 25#include "fontDialog.h"
28 26
27#include <opie/ofileselector.h>
28#include <opie/ofiledialog.h>
29
29#include <qpe/fontdatabase.h> 30#include <qpe/fontdatabase.h>
30#include <qpe/global.h> 31#include <qpe/global.h>
31#include <qpe/fileselector.h> 32#include <qpe/fileselector.h>
32#include <qpe/applnk.h> 33#include <qpe/applnk.h>
33#include <qpe/resource.h> 34#include <qpe/resource.h>
34#include <qpe/config.h> 35#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
36#include <qpe/qpemenubar.h> 37#include <qpe/qpemenubar.h>
37#include <qpe/qpetoolbar.h> 38#include <qpe/qpetoolbar.h>
38#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
39//#include <qpe/finddialog.h>
40
41#include <opie/ofileselector.h>
42#include <opie/ofiledialog.h>
43 40
44#include <qstringlist.h> 41#include <qstringlist.h>
45#include <qaction.h> 42#include <qaction.h>
46#include <qcolordialog.h> 43#include <qcolordialog.h>
47#include <qfileinfo.h> 44#include <qfileinfo.h>
48#include <qlineedit.h> 45#include <qlineedit.h>
49#include <qmessagebox.h> 46#include <qmessagebox.h>
50#include <qobjectlist.h> 47#include <qobjectlist.h>
51#include <qpopupmenu.h> 48#include <qpopupmenu.h>
52#include <qspinbox.h> 49#include <qspinbox.h>
53#include <qtoolbutton.h> 50#include <qtoolbutton.h>
54#include <qwidgetstack.h> 51#include <qwidgetstack.h>
55#include <qcheckbox.h> 52#include <qcheckbox.h>
56#include <qcombo.h> 53#include <qcombo.h>
57#include <unistd.h> 54#include <unistd.h>
58#include <sys/stat.h> 55#include <sys/stat.h>
59 56
60#include <stdlib.h> //getenv 57#include <stdlib.h> //getenv
61/* XPM */ 58/* XPM */
62static char * filesave_xpm[] = { 59static char * filesave_xpm[] = {
63"16 16 78 1", 60"16 16 78 1",
64" c None", 61" c None",
65". c #343434", 62". c #343434",
66"+ c #A0A0A0", 63"+ c #A0A0A0",
67"@ c #565656", 64"@ c #565656",
68"# c #9E9E9E", 65"# c #9E9E9E",
69"$ c #525252", 66"$ c #525252",
70"% c #929292", 67"% c #929292",
71"& c #676767", 68"& c #676767",
72"* c #848484", 69"* c #848484",
73"= c #666666", 70"= c #666666",
74"- c #D8D8D8", 71"- c #D8D8D8",
75"; c #FFFFFF", 72"; c #FFFFFF",
76"> c #DBDBDB", 73"> c #DBDBDB",
77", c #636363", 74", c #636363",
78"' c #989898", 75"' c #989898",
79") c #2D2D2D", 76") c #2D2D2D",
80"! c #909090", 77"! c #909090",
81"~ c #AEAEAE", 78"~ c #AEAEAE",
82"{ c #EAEAEA", 79"{ c #EAEAEA",
83"] c #575757", 80"] c #575757",
84"^ c #585858", 81"^ c #585858",
85"/ c #8A8A8A", 82"/ c #8A8A8A",
86"( c #828282", 83"( c #828282",
87"_ c #6F6F6F", 84"_ c #6F6F6F",
88": c #C9C9C9", 85": c #C9C9C9",
89"< c #050505", 86"< c #050505",
90"[ c #292929", 87"[ c #292929",
@@ -462,140 +459,107 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up)
462 s = fontsize[i]; 459 s = fontsize[i];
463 break; 460 break;
464 } 461 }
465 } 462 }
466 } 463 }
467 464
468 QFont f = editor->font(); 465 QFont f = editor->font();
469 f.setPointSize(s); 466 f.setPointSize(s);
470 editor->setFont(f); 467 editor->setFont(f);
471 468
472 zin->setEnabled(s != fontsize[nfontsizes-1]); 469 zin->setEnabled(s != fontsize[nfontsizes-1]);
473 zout->setEnabled(s != fontsize[0]); 470 zout->setEnabled(s != fontsize[0]);
474} 471}
475 472
476void TextEdit::setBold(bool y) 473void TextEdit::setBold(bool y)
477{ 474{
478 QFont f = editor->font(); 475 QFont f = editor->font();
479 f.setBold(y); 476 f.setBold(y);
480 editor->setFont(f); 477 editor->setFont(f);
481} 478}
482 479
483void TextEdit::setItalic(bool y) 480void TextEdit::setItalic(bool y)
484{ 481{
485 QFont f = editor->font(); 482 QFont f = editor->font();
486 f.setItalic(y); 483 f.setItalic(y);
487 editor->setFont(f); 484 editor->setFont(f);
488} 485}
489 486
490void TextEdit::setWordWrap(bool y) 487void TextEdit::setWordWrap(bool y)
491{ 488{
492 bool state = editor->edited(); 489 bool state = editor->edited();
493 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 490 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
494 editor->setEdited( state ); 491 editor->setEdited( state );
495} 492}
496 493
497void TextEdit::fileNew() 494void TextEdit::fileNew()
498{ 495{
499// if( !bFromDocView ) { 496// if( !bFromDocView ) {
500// saveAs(); 497// saveAs();
501// } 498// }
502 newFile(DocLnk()); 499 newFile(DocLnk());
503} 500}
504 501
505void TextEdit::fileOpen() 502void TextEdit::fileOpen()
506{ 503{
507 Config cfg("TextEdit"); 504 Config cfg("TextEdit");
508 cfg.setGroup("View"); 505 cfg.setGroup("View");
509 bool b=FALSE; 506 bool b=FALSE;
510// if(cfg.readEntry("useOldFileDialog") == "TRUE") 507
511// b=TRUE; 508 QMap<QString, QStringList> map;
512// if(!b) { 509 map.insert(tr("All"), QStringList() );
513 QMap<QString, QStringList> map; 510 QStringList text;
514 map.insert(tr("All"), QStringList() ); 511 text << "text/*";
515 QStringList text; 512 map.insert(tr("Text"), text );
516 text << "text/*"; 513 text << "*";
517 map.insert(tr("Text"), text ); 514 map.insert(tr("All"), text );
518 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);//,"", "*", this ); 515 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);
519 if(!str.isEmpty() ) 516 if(!str.isEmpty() )
520 openFile( str ); 517 openFile( str );
521// } else {
522// QString str;
523// browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); //
524// browseForFiles->setFileView( viewSelection );
525// browseForFiles->showMaximized();
526// // if( result != -1 )
527
528// if( browseForFiles->exec() != -1 ) {
529// QString selFile = browseForFiles->selectedFileName;
530// QStringList fileList = browseForFiles->fileList;
531// qDebug(selFile);
532// QStringList::ConstIterator f;
533// QString fileTemp;
534// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
535// fileTemp = *f;
536// fileTemp.right( fileTemp.length()-5);
537// QString fileName = fileTemp;
538// if( fileName != "Unnamed" || fileName != "Empty Text" ) {
539// currentFileName = fileName;
540// qDebug("please open "+currentFileName);
541// openFile(currentFileName );
542// }
543// }
544// viewSelection = browseForFiles->SelectionCombo->currentItem();
545// }
546// delete browseForFiles;
547// editor->setEdited( FALSE);
548// edited1=FALSE;
549// edited=FALSE;
550// if(caption().left(1)=="*")
551// setCaption(caption().right(caption().length()-1));
552// doSearchBar();
553// }
554 518
555} 519}
556 520
557void TextEdit::doSearchBar() 521void TextEdit::doSearchBar()
558{ 522{
559 Config cfg("TextEdit"); 523 Config cfg("TextEdit");
560 cfg.setGroup("View"); 524 cfg.setGroup("View");
561 if(cfg.readEntry("SearchBar","Closed") != "Opened") 525 if(cfg.readEntry("SearchBar","Closed") != "Opened")
562 searchBar->hide(); 526 searchBar->hide();
563} 527}
564 528
565#if 0 529#if 0
566void TextEdit::slotFind() 530void TextEdit::slotFind()
567{ 531{
568 FindDialog frmFind( tr("Text Editor"), this ); 532 FindDialog frmFind( tr("Text Editor"), this );
569 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 533 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
570 editor, SLOT(slotDoFind( const QString&,bool,bool))); 534 editor, SLOT(slotDoFind( const QString&,bool,bool)));
571 535
572 //case sensitive, backwards, [category] 536 //case sensitive, backwards, [category]
573 537
574 connect( editor, SIGNAL(notFound()), 538 connect( editor, SIGNAL(notFound()),
575 &frmFind, SLOT(slotNotFound()) ); 539 &frmFind, SLOT(slotNotFound()) );
576 connect( editor, SIGNAL(searchWrapped()), 540 connect( editor, SIGNAL(searchWrapped()),
577 &frmFind, SLOT(slotWrapAround()) ); 541 &frmFind, SLOT(slotWrapAround()) );
578 542
579 frmFind.exec(); 543 frmFind.exec();
580 544
581 545
582} 546}
583#endif 547#endif
584 548
585void TextEdit::fileRevert() 549void TextEdit::fileRevert()
586{ 550{
587 clear(); 551 clear();
588 fileOpen(); 552 fileOpen();
589} 553}
590 554
591void TextEdit::editCut() 555void TextEdit::editCut()
592{ 556{
593#ifndef QT_NO_CLIPBOARD 557#ifndef QT_NO_CLIPBOARD
594 editor->cut(); 558 editor->cut();
595#endif 559#endif
596} 560}
597 561
598void TextEdit::editCopy() 562void TextEdit::editCopy()
599{ 563{
600#ifndef QT_NO_CLIPBOARD 564#ifndef QT_NO_CLIPBOARD
601 editor->copy(); 565 editor->copy();