Diffstat (limited to 'noncore/apps/opie-write/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-write/mainwindow.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp index 90e1a70..aa03060 100644 --- a/noncore/apps/opie-write/mainwindow.cpp +++ b/noncore/apps/opie-write/mainwindow.cpp | |||
@@ -1,52 +1,56 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** Licensees holding valid Qtopia Developer license may use this | 6 | ** Licensees holding valid Qtopia Developer license may use this |
7 | ** file in accordance with the Qtopia Developer License Agreement | 7 | ** file in accordance with the Qtopia Developer License Agreement |
8 | ** provided with the Software. | 8 | ** provided with the Software. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING |
11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
12 | ** PURPOSE. | 12 | ** PURPOSE. |
13 | ** | 13 | ** |
14 | ** email sales@trolltech.com for information about Qtopia License | 14 | ** email sales@trolltech.com for information about Qtopia License |
15 | ** Agreements. | 15 | ** Agreements. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
23 | |||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
23 | #include <qpe/fileselector.h> | 26 | #include <qpe/fileselector.h> |
24 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
25 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
26 | #include <qpe/fontdatabase.h> | 29 | #include <qpe/fontdatabase.h> |
30 | using namespace Opie::Core; | ||
27 | 31 | ||
28 | //#include "qspellchecker.h" | 32 | /* QT */ |
29 | #include "qtextedit.h" | 33 | #include "qtextedit.h" |
30 | #include <qaction.h> | 34 | #include <qaction.h> |
31 | #include <qtoolbar.h> | 35 | #include <qtoolbar.h> |
32 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
33 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
34 | #include <qapplication.h> | 38 | #include <qapplication.h> |
35 | #include <qfontdatabase.h> | 39 | #include <qfontdatabase.h> |
36 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
37 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
38 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
39 | #include <qfile.h> | 43 | #include <qfile.h> |
40 | #include <qfiledialog.h> | 44 | #include <qfiledialog.h> |
41 | #include <qprinter.h> | 45 | #include <qprinter.h> |
42 | #include <qpaintdevicemetrics.h> | 46 | #include <qpaintdevicemetrics.h> |
43 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
44 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
45 | #include <qcolordialog.h> | 49 | #include <qcolordialog.h> |
46 | #include <qpainter.h> | 50 | #include <qpainter.h> |
47 | #include <qstyle.h> | 51 | #include <qstyle.h> |
48 | 52 | ||
49 | class ButtonMenu : public QToolButton | 53 | class ButtonMenu : public QToolButton |
50 | { | 54 | { |
51 | Q_OBJECT | 55 | Q_OBJECT |
52 | public: | 56 | public: |
@@ -423,80 +427,80 @@ void MainWindow::alignmentChanged( int a ) | |||
423 | } | 427 | } |
424 | 428 | ||
425 | void MainWindow::editorChanged( QWidget * ) | 429 | void MainWindow::editorChanged( QWidget * ) |
426 | { | 430 | { |
427 | if ( !currentEditor() ) | 431 | if ( !currentEditor() ) |
428 | return; | 432 | return; |
429 | fontChanged( currentEditor()->font() ); | 433 | fontChanged( currentEditor()->font() ); |
430 | colorChanged( currentEditor()->color() ); | 434 | colorChanged( currentEditor()->color() ); |
431 | alignmentChanged( currentEditor()->alignment() ); | 435 | alignmentChanged( currentEditor()->alignment() ); |
432 | } | 436 | } |
433 | 437 | ||
434 | void MainWindow::fileOpen() | 438 | void MainWindow::fileOpen() |
435 | { | 439 | { |
436 | save(); | 440 | save(); |
437 | editorStack->raiseWidget( fileSelector ); | 441 | editorStack->raiseWidget( fileSelector ); |
438 | fileSelector->reread(); | 442 | fileSelector->reread(); |
439 | hideEditTools(); | 443 | hideEditTools(); |
440 | fileSelector->setNewVisible( TRUE ); | 444 | fileSelector->setNewVisible( TRUE ); |
441 | clear(); | 445 | clear(); |
442 | updateCaption(); | 446 | updateCaption(); |
443 | } | 447 | } |
444 | 448 | ||
445 | void MainWindow::fileRevert() | 449 | void MainWindow::fileRevert() |
446 | { | 450 | { |
447 | qDebug( "QMainWindow::fileRevert needs to be done" ); | 451 | odebug << "QMainWindow::fileRevert needs to be done" << oendl; |
448 | } | 452 | } |
449 | 453 | ||
450 | void MainWindow::fileNew() | 454 | void MainWindow::fileNew() |
451 | { | 455 | { |
452 | editor->setTextFormat( Qt::RichText ); | 456 | editor->setTextFormat( Qt::RichText ); |
453 | save(); | 457 | save(); |
454 | newFile(DocLnk()); | 458 | newFile(DocLnk()); |
455 | } | 459 | } |
456 | 460 | ||
457 | void MainWindow::insertTable() | 461 | void MainWindow::insertTable() |
458 | { | 462 | { |
459 | qDebug( "MainWindow::insertTable() needs to be done" ); | 463 | odebug << "MainWindow::insertTable() needs to be done" << oendl; |
460 | } | 464 | } |
461 | 465 | ||
462 | void MainWindow::newFile( const DocLnk &dl ) | 466 | void MainWindow::newFile( const DocLnk &dl ) |
463 | { | 467 | { |
464 | DocLnk nf = dl; | 468 | DocLnk nf = dl; |
465 | nf.setType( "text/html" ); | 469 | nf.setType( "text/html" ); |
466 | clear(); | 470 | clear(); |
467 | editorStack->raiseWidget( editor ); | 471 | editorStack->raiseWidget( editor ); |
468 | editor->viewport()->setFocus(); | 472 | editor->viewport()->setFocus(); |
469 | doc = new DocLnk( nf ); | 473 | doc = new DocLnk( nf ); |
470 | updateCaption(); | 474 | updateCaption(); |
471 | } | 475 | } |
472 | 476 | ||
473 | void MainWindow::openFile( const DocLnk &dl ) | 477 | void MainWindow::openFile( const DocLnk &dl ) |
474 | { | 478 | { |
475 | FileManager fm; | 479 | FileManager fm; |
476 | QString txt; | 480 | QString txt; |
477 | if ( !fm.loadFile( dl, txt ) ) | 481 | if ( !fm.loadFile( dl, txt ) ) |
478 | qDebug( "couldn't open file" ); | 482 | odebug << "couldn't open file" << oendl; |
479 | clear(); | 483 | clear(); |
480 | editorStack->raiseWidget( editor ); | 484 | editorStack->raiseWidget( editor ); |
481 | editor->viewport()->setFocus(); | 485 | editor->viewport()->setFocus(); |
482 | doc = new DocLnk( dl ); | 486 | doc = new DocLnk( dl ); |
483 | editor->setText( txt ); | 487 | editor->setText( txt ); |
484 | editor->setModified( FALSE ); | 488 | editor->setModified( FALSE ); |
485 | updateCaption(); | 489 | updateCaption(); |
486 | } | 490 | } |
487 | 491 | ||
488 | void MainWindow::showEditTools( void ) | 492 | void MainWindow::showEditTools( void ) |
489 | { | 493 | { |
490 | tbMenu->show(); | 494 | tbMenu->show(); |
491 | tbEdit->show(); | 495 | tbEdit->show(); |
492 | tbFont->show(); | 496 | tbFont->show(); |
493 | tbStyle->show(); | 497 | tbStyle->show(); |
494 | } | 498 | } |
495 | 499 | ||
496 | void MainWindow::hideEditTools( void ) | 500 | void MainWindow::hideEditTools( void ) |
497 | { | 501 | { |
498 | // let's reset the buttons... | 502 | // let's reset the buttons... |
499 | actionTextBold->setOn( FALSE ); | 503 | actionTextBold->setOn( FALSE ); |
500 | actionTextItalic->setOn( FALSE ); | 504 | actionTextItalic->setOn( FALSE ); |
501 | actionTextUnderline->setOn( FALSE ); | 505 | actionTextUnderline->setOn( FALSE ); |
502 | //comboFont->setCurrentText( QApplication::font().family() ); | 506 | //comboFont->setCurrentText( QApplication::font().family() ); |