author | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
commit | 1ab4ca95e4d2cf24d32b38c9031cb6076351e730 (patch) (unidiff) | |
tree | 644d196b01c7f280981bd17da23c7592a18e5643 /core/apps | |
parent | ec14206f63dd93e9fb84c76cbc76fc1968637590 (diff) | |
download | opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.zip opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.gz opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | core/apps/.cvsignore | 1 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 1 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 48 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.h | 4 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.pro | 4 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.cpp | 99 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.h | 42 | ||||
-rw-r--r-- | core/apps/helpbrowser/main.cpp | 9 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 8 |
9 files changed, 188 insertions, 28 deletions
diff --git a/core/apps/.cvsignore b/core/apps/.cvsignore index faa68ae..6d678c6 100644 --- a/core/apps/.cvsignore +++ b/core/apps/.cvsignore | |||
@@ -1,2 +1 @@ | |||
1 | binconfig.in | ||
2 | config.in | config.in | |
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index 9adc248..7e820ad 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp | |||
@@ -142,48 +142,49 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
142 | { | 142 | { |
143 | // This is code from the Qt DumbTerminal example | 143 | // This is code from the Qt DumbTerminal example |
144 | cpid = fork(); | 144 | cpid = fork(); |
145 | 145 | ||
146 | if ( !cpid ) { | 146 | if ( !cpid ) { |
147 | // child - exec shell on tty | 147 | // child - exec shell on tty |
148 | for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); | 148 | for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); |
149 | int ttyfd = open(ttynam, O_RDWR); | 149 | int ttyfd = open(ttynam, O_RDWR); |
150 | dup2(ttyfd, STDIN_FILENO); | 150 | dup2(ttyfd, STDIN_FILENO); |
151 | dup2(ttyfd, STDOUT_FILENO); | 151 | dup2(ttyfd, STDOUT_FILENO); |
152 | dup2(ttyfd, STDERR_FILENO); | 152 | dup2(ttyfd, STDERR_FILENO); |
153 | // should be done with tty, so close it | 153 | // should be done with tty, so close it |
154 | close(ttyfd); | 154 | close(ttyfd); |
155 | static struct termios ttmode; | 155 | static struct termios ttmode; |
156 | if ( setsid() < 0 ) | 156 | if ( setsid() < 0 ) |
157 | perror( "failed to set process group" ); | 157 | perror( "failed to set process group" ); |
158 | #if defined (TIOCSCTTY) | 158 | #if defined (TIOCSCTTY) |
159 | // grabbed from APUE by Stevens | 159 | // grabbed from APUE by Stevens |
160 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); | 160 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); |
161 | #endif | 161 | #endif |
162 | tcgetattr( STDIN_FILENO, &ttmode ); | 162 | tcgetattr( STDIN_FILENO, &ttmode ); |
163 | ttmode.c_cc[VINTR] = 3; | 163 | ttmode.c_cc[VINTR] = 3; |
164 | ttmode.c_cc[VERASE] = 8; | 164 | ttmode.c_cc[VERASE] = 8; |
165 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); | 165 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); |
166 | if(strlen(getenv("TERM"))<=0) | ||
166 | setenv("TERM","vt100",1); | 167 | setenv("TERM","vt100",1); |
167 | setenv("COLORTERM","0",1); | 168 | setenv("COLORTERM","0",1); |
168 | 169 | ||
169 | if (getuid() == 0) { | 170 | if (getuid() == 0) { |
170 | char msg[] = "WARNING: You are running this shell as root!\n"; | 171 | char msg[] = "WARNING: You are running this shell as root!\n"; |
171 | write(ttyfd, msg, sizeof(msg)); | 172 | write(ttyfd, msg, sizeof(msg)); |
172 | } | 173 | } |
173 | 174 | ||
174 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell | 175 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell |
175 | 176 | ||
176 | execl(cmd, ccmd.latin1(), 0); | 177 | execl(cmd, ccmd.latin1(), 0); |
177 | 178 | ||
178 | donePty(); | 179 | donePty(); |
179 | exit(-1); | 180 | exit(-1); |
180 | } | 181 | } |
181 | 182 | ||
182 | // parent - continue as a widget | 183 | // parent - continue as a widget |
183 | QSocketNotifier* sn_r = new QSocketNotifier(fd,QSocketNotifier::Read,this); | 184 | QSocketNotifier* sn_r = new QSocketNotifier(fd,QSocketNotifier::Read,this); |
184 | QSocketNotifier* sn_e = new QSocketNotifier(fd,QSocketNotifier::Exception,this); | 185 | QSocketNotifier* sn_e = new QSocketNotifier(fd,QSocketNotifier::Exception,this); |
185 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); | 186 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); |
186 | connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); | 187 | connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); |
187 | 188 | ||
188 | return 0; | 189 | return 0; |
189 | } | 190 | } |
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index 48da7c6..531dbff 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp | |||
@@ -1,155 +1,177 @@ | |||
1 | #/********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the 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 | 20 | ||
21 | #define QTOPIA_INTERNAL_LANGLIST | ||
22 | |||
21 | #include "helpbrowser.h" | 23 | #include "helpbrowser.h" |
22 | 24 | ||
23 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/mimetype.h> | ||
28 | #include <qpe/applnk.h> | ||
25 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
26 | 30 | ||
27 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
28 | #include <qdragobject.h> | 32 | #include <qdragobject.h> |
29 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
30 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
31 | #include <qpe/qpemenubar.h> | 35 | #include <qpe/qpemenubar.h> |
32 | #include <qpe/qpetoolbar.h> | 36 | #include <qpe/qpetoolbar.h> |
37 | #include <qpe/qcopenvelope_qws.h> | ||
33 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
34 | #include <qiconset.h> | 39 | #include <qiconset.h> |
35 | #include <qfile.h> | 40 | #include <qfile.h> |
36 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
37 | #include <qstylesheet.h> | 42 | #include <qstylesheet.h> |
38 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
39 | #include <qfiledialog.h> | 44 | #include <qfiledialog.h> |
40 | #include <qevent.h> | 45 | #include <qevent.h> |
41 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
42 | #include <qobjectlist.h> | 47 | #include <qobjectlist.h> |
43 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
44 | #include <qfile.h> | 49 | #include <qfile.h> |
45 | #include <qdatastream.h> | 50 | #include <qdatastream.h> |
46 | #include <qprinter.h> | 51 | #include <qprinter.h> |
47 | #include <qsimplerichtext.h> | 52 | #include <qsimplerichtext.h> |
48 | #include <qpaintdevicemetrics.h> | 53 | #include <qpaintdevicemetrics.h> |
49 | #include <qaction.h> | 54 | #include <qaction.h> |
50 | 55 | ||
51 | #include <ctype.h> | 56 | #include <cctype> |
52 | 57 | ||
58 | #include "magictextbrowser.h" | ||
53 | 59 | ||
54 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) | 60 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) |
55 | : QMainWindow( parent, name, f ), | 61 | : QMainWindow( parent, name, f ), |
56 | selectedURL() | 62 | selectedURL() |
57 | { | 63 | { |
58 | init( "index.html" ); | 64 | init( "index.html" ); |
59 | } | 65 | } |
60 | 66 | ||
67 | |||
68 | |||
61 | void HelpBrowser::init( const QString& _home ) | 69 | void HelpBrowser::init( const QString& _home ) |
62 | { | 70 | { |
63 | setIcon( Resource::loadPixmap( "help_icon" ) ); | 71 | setIcon( Resource::loadPixmap( "HelpBrowser" ) ); |
72 | setBackgroundMode( PaletteButton ); | ||
64 | 73 | ||
65 | browser = new QTextBrowser( this ); | 74 | browser = new MagicTextBrowser( this ); |
66 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 75 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
67 | connect( browser, SIGNAL( textChanged() ), | 76 | connect( browser, SIGNAL( textChanged() ), |
68 | this, SLOT( textChanged() ) ); | 77 | this, SLOT( textChanged() ) ); |
69 | 78 | ||
70 | setCentralWidget( browser ); | 79 | setCentralWidget( browser ); |
71 | setToolBarsMovable( FALSE ); | 80 | setToolBarsMovable( FALSE ); |
72 | 81 | ||
73 | if ( !_home.isEmpty() ) | 82 | if ( !_home.isEmpty() ) |
74 | browser->setSource( _home ); | 83 | browser->setSource( _home ); |
75 | 84 | ||
76 | QPEToolBar* toolbar = new QPEToolBar( this ); | 85 | QPEToolBar* toolbar = new QPEToolBar( this ); |
77 | toolbar->setHorizontalStretchable( TRUE ); | 86 | toolbar->setHorizontalStretchable( TRUE ); |
78 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 87 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
79 | 88 | ||
80 | toolbar = new QPEToolBar( this ); | 89 | toolbar = new QPEToolBar( this ); |
81 | // addToolBar( toolbar, "Toolbar"); | 90 | // addToolBar( toolbar, "Toolbar"); |
82 | 91 | ||
83 | //QPopupMenu* go = new QPopupMenu( this ); | 92 | QPopupMenu* go = new QPopupMenu( this ); |
84 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); | 93 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); |
85 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); | 94 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); |
86 | connect( browser, SIGNAL( backwardAvailable( bool ) ), | 95 | connect( browser, SIGNAL( backwardAvailable( bool ) ), |
87 | backAction, SLOT( setEnabled( bool ) ) ); | 96 | backAction, SLOT( setEnabled( bool ) ) ); |
88 | //backAction->addTo( go ); | 97 | backAction->addTo( go ); |
89 | backAction->addTo( toolbar ); | 98 | backAction->addTo( toolbar ); |
90 | backAction->setEnabled( FALSE ); | 99 | backAction->setEnabled( FALSE ); |
91 | 100 | ||
92 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); | 101 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); |
93 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); | 102 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); |
94 | connect( browser, SIGNAL( forwardAvailable( bool ) ), | 103 | connect( browser, SIGNAL( forwardAvailable( bool ) ), |
95 | forwardAction, SLOT( setEnabled( bool ) ) ); | 104 | forwardAction, SLOT( setEnabled( bool ) ) ); |
96 | //forwardAction->addTo( go ); | 105 | forwardAction->addTo( go ); |
97 | forwardAction->addTo( toolbar ); | 106 | forwardAction->addTo( toolbar ); |
98 | forwardAction->setEnabled( FALSE ); | 107 | forwardAction->setEnabled( FALSE ); |
99 | 108 | ||
100 | QAction *a = new QAction( tr( "Home" ), Resource::loadPixmap( | 109 | QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 ); |
101 | "home" ), QString::null, 0, this, 0 ); | ||
102 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); | 110 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); |
103 | //a->addTo( go ); | 111 | a->addTo( go ); |
104 | a->addTo( toolbar ); | 112 | a->addTo( toolbar ); |
105 | 113 | ||
106 | bookm = new QPopupMenu( this ); | 114 | bookm = new QPopupMenu( this ); |
107 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 115 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
108 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); | 116 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); |
109 | bookm->insertSeparator(); | 117 | bookm->insertSeparator(); |
110 | connect( bookm, SIGNAL( activated( int ) ), | 118 | connect( bookm, SIGNAL( activated( int ) ), |
111 | this, SLOT( bookmChosen( int ) ) ); | 119 | this, SLOT( bookmChosen( int ) ) ); |
112 | 120 | ||
113 | readBookmarks(); | 121 | readBookmarks(); |
114 | 122 | ||
115 | //menu->insertItem( tr("Go"), go ); | 123 | menu->insertItem( tr("Go"), go ); |
116 | menu->insertItem( tr( "Bookmarks" ), bookm ); | 124 | menu->insertItem( tr( "Bookmarks" ), bookm ); |
117 | 125 | ||
118 | resize( 240, 300 ); | 126 | resize( 240, 300 ); |
119 | browser->setFocus(); | 127 | browser->setFocus(); |
128 | browser->setFrameStyle( QFrame::NoFrame ); | ||
129 | |||
130 | #if !defined(QT_NO_COP) | ||
131 | QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this ); | ||
132 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | ||
133 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | ||
134 | #endif | ||
120 | 135 | ||
121 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 136 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
122 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 137 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
123 | } | 138 | } |
124 | 139 | ||
125 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | 140 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) |
126 | { | 141 | { |
142 | qDebug("reached appMessage"); | ||
127 | if ( msg == "showFile(QString)" ) { | 143 | if ( msg == "showFile(QString)" ) { |
128 | QDataStream ds(data,IO_ReadOnly); | 144 | QDataStream ds(data,IO_ReadOnly); |
129 | QString fn; | 145 | QString fn; |
130 | ds >> fn; | 146 | ds >> fn; |
131 | setDocument( fn ); | 147 | setDocument( fn ); |
148 | |||
149 | QPEApplication::setKeepRunning(); | ||
150 | |||
151 | showMaximized(); | ||
152 | setActiveWindow(); | ||
153 | raise(); | ||
132 | } | 154 | } |
133 | } | 155 | } |
134 | 156 | ||
135 | void HelpBrowser::setDocument( const QString &doc ) | 157 | void HelpBrowser::setDocument( const QString &doc ) |
136 | { | 158 | { |
137 | if ( !doc.isEmpty() ) | 159 | if ( !doc.isEmpty() ) |
138 | browser->setSource( doc ); | 160 | browser->setSource( doc ); |
139 | raise(); | 161 | raise(); |
140 | } | 162 | } |
141 | 163 | ||
142 | 164 | ||
143 | void HelpBrowser::textChanged() | 165 | void HelpBrowser::textChanged() |
144 | { | 166 | { |
145 | if ( browser->documentTitle().isNull() ) | 167 | if ( browser->documentTitle().isNull() ) |
146 | setCaption( tr("Help Browser") ); | 168 | setCaption( tr("Help Browser") ); |
147 | else | 169 | else |
148 | setCaption( browser->documentTitle() ) ; | 170 | setCaption( browser->documentTitle() ) ; |
149 | 171 | ||
150 | selectedURL = caption(); | 172 | selectedURL = caption(); |
151 | } | 173 | } |
152 | 174 | ||
153 | HelpBrowser::~HelpBrowser() | 175 | HelpBrowser::~HelpBrowser() |
154 | { | 176 | { |
155 | QStringList bookmarks; | 177 | QStringList bookmarks; |
diff --git a/core/apps/helpbrowser/helpbrowser.h b/core/apps/helpbrowser/helpbrowser.h index 2f7153a..5f7e6b6 100644 --- a/core/apps/helpbrowser/helpbrowser.h +++ b/core/apps/helpbrowser/helpbrowser.h | |||
@@ -1,28 +1,28 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the 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 | 20 | ||
21 | #ifndef HELPWINDOW_H | 21 | #ifndef HELPWINDOW_H |
22 | #define HELPWINDOW_H | 22 | #define HELPWINDOW_H |
23 | 23 | ||
24 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
25 | #include <qtextbrowser.h> | 25 | #include <qtextbrowser.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | 28 | ||
diff --git a/core/apps/helpbrowser/helpbrowser.pro b/core/apps/helpbrowser/helpbrowser.pro index 6bb43bd..3525b7e 100644 --- a/core/apps/helpbrowser/helpbrowser.pro +++ b/core/apps/helpbrowser/helpbrowser.pro | |||
@@ -1,29 +1,29 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = helpbrowser.h | 4 | HEADERS = helpbrowser.h magictextbrowser.h |
5 | SOURCES = helpbrowser.cpp \ | 5 | SOURCES = helpbrowser.cpp magictextbrowser.cpp \ |
6 | main.cpp | 6 | main.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= | 10 | INTERFACES= |
11 | TARGET = helpbrowser | 11 | TARGET = helpbrowser |
12 | TRANSLATIONS = ../../../i18n/de/helpbrowser.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/helpbrowser.ts \ |
13 | ../../../i18n/nl/helpbrowser.ts \ | 13 | ../../../i18n/nl/helpbrowser.ts \ |
14 | ../../../i18n/xx/helpbrowser.ts \ | 14 | ../../../i18n/xx/helpbrowser.ts \ |
15 | ../../../i18n/en/helpbrowser.ts \ | 15 | ../../../i18n/en/helpbrowser.ts \ |
16 | ../../../i18n/es/helpbrowser.ts \ | 16 | ../../../i18n/es/helpbrowser.ts \ |
17 | ../../../i18n/fr/helpbrowser.ts \ | 17 | ../../../i18n/fr/helpbrowser.ts \ |
18 | ../../../i18n/hu/helpbrowser.ts \ | 18 | ../../../i18n/hu/helpbrowser.ts \ |
19 | ../../../i18n/ja/helpbrowser.ts \ | 19 | ../../../i18n/ja/helpbrowser.ts \ |
20 | ../../../i18n/ko/helpbrowser.ts \ | 20 | ../../../i18n/ko/helpbrowser.ts \ |
21 | ../../../i18n/no/helpbrowser.ts \ | 21 | ../../../i18n/no/helpbrowser.ts \ |
22 | ../../../i18n/pl/helpbrowser.ts \ | 22 | ../../../i18n/pl/helpbrowser.ts \ |
23 | ../../../i18n/pt/helpbrowser.ts \ | 23 | ../../../i18n/pt/helpbrowser.ts \ |
24 | ../../../i18n/pt_BR/helpbrowser.ts \ | 24 | ../../../i18n/pt_BR/helpbrowser.ts \ |
25 | ../../../i18n/sl/helpbrowser.ts \ | 25 | ../../../i18n/sl/helpbrowser.ts \ |
26 | ../../../i18n/zh_CN/helpbrowser.ts \ | 26 | ../../../i18n/zh_CN/helpbrowser.ts \ |
27 | ../../../i18n/it/helpbrowser.ts \ | 27 | ../../../i18n/it/helpbrowser.ts \ |
28 | ../../../i18n/zh_TW/helpbrowser.ts \ | 28 | ../../../i18n/zh_TW/helpbrowser.ts \ |
29 | ../../../i18n/da/helpbrowser.ts | 29 | ../../../i18n/da/helpbrowser.ts |
diff --git a/core/apps/helpbrowser/magictextbrowser.cpp b/core/apps/helpbrowser/magictextbrowser.cpp new file mode 100644 index 0000000..8ce0325 --- a/dev/null +++ b/core/apps/helpbrowser/magictextbrowser.cpp | |||
@@ -0,0 +1,99 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qstring.h> | ||
3 | #include <qdragobject.h> | ||
4 | #include <qregexp.h> | ||
5 | |||
6 | /* need to get Global::helpPath() */ | ||
7 | #define QTOPIA_INTERNAL_LANGLIST | ||
8 | |||
9 | #include <qtopia/global.h> | ||
10 | #include <qtopia/mimetype.h> | ||
11 | #include <qtopia/applnk.h> | ||
12 | |||
13 | #include "magictextbrowser.h" | ||
14 | |||
15 | |||
16 | |||
17 | MagicTextBrowser::MagicTextBrowser(QWidget* parent) : | ||
18 | QTextBrowser(parent){ | ||
19 | } | ||
20 | |||
21 | void MagicTextBrowser::setSource( const QString& source ) { | ||
22 | QTextBrowser::setSource(source); | ||
23 | if ( magicQpe(source,"applications") || magicQpe(source,"games") || magicQpe(source,"settings") || magicQpe(source, "1Pim") ) // No tr | ||
24 | return; | ||
25 | if ( magicOpe(source, "applets") || magicOpe(source, "input") ) | ||
26 | return; | ||
27 | // Just those are magic (for now). Could do CGI here, | ||
28 | // or in Qtopia's mime source factory. | ||
29 | } | ||
30 | |||
31 | bool MagicTextBrowser::magicQpe(const QString& source, const QString& name) { | ||
32 | if ( name+".html" == source || "help/"+name+".html" == source) { | ||
33 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | ||
34 | const QMimeSource* m = mimeSourceFactory()->data( fn, context() ); | ||
35 | if ( m ) { | ||
36 | QString txt; | ||
37 | if ( QTextDrag::decode(m,txt) ) { | ||
38 | QRegExp re("<qtopia-"+name+">.*</qtopia-"+name+">"); | ||
39 | int start,len; | ||
40 | if ( (start=re.match(txt,0,&len))>=0 ) { | ||
41 | QString generated = generateQpe(name); | ||
42 | txt.replace(start,len,generated); | ||
43 | setText(txt); | ||
44 | return true; | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | return false; | ||
50 | } | ||
51 | bool MagicTextBrowser::magicOpe( const QString& source, const QString& name ) { | ||
52 | if ( name+".html" != source && "help/"+name+".html" != source) return false; | ||
53 | |||
54 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | ||
55 | const QMimeSource* m = mimeSourceFactory()->data(fn, context() ); | ||
56 | if (!m) return false; | ||
57 | |||
58 | QString txt; | ||
59 | if ( !QTextDrag::decode(m, txt ) ) return false; | ||
60 | |||
61 | QRegExp re("<opie-"+name+">.*</opie-"+name+">"); | ||
62 | int start,len; | ||
63 | if ( (start=re.match(txt,0,&len))>=0 ) { | ||
64 | QString generated = generateOpe(name); | ||
65 | txt.replace(start,len,generated); | ||
66 | setText(txt); | ||
67 | return true; | ||
68 | } | ||
69 | return false; | ||
70 | } | ||
71 | QString MagicTextBrowser::generateOpe(const QString& name)const { | ||
72 | if ( name == QString::fromLatin1("applets") ) { | ||
73 | return QString::fromLatin1("<h3>No Applets found</h3>"); | ||
74 | }else if ( name == QString::fromLatin1("input") ) { | ||
75 | return QString::fromLatin1("<h3>No input methods available</h3>"); | ||
76 | }else | ||
77 | return QString::null; | ||
78 | } | ||
79 | |||
80 | QString MagicTextBrowser::generateQpe(const QString& name) const { | ||
81 | QString dir = MimeType::appsFolderName()+"/"+name[0].upper()+name.mid(1); | ||
82 | AppLnkSet lnkset(dir); | ||
83 | AppLnk* lnk; | ||
84 | QString r; | ||
85 | for (QListIterator<AppLnk> it(lnkset.children()); (lnk=it.current()); ++it) { | ||
86 | QString name = lnk->name(); | ||
87 | QString icon = lnk->icon(); | ||
88 | QString helpFile = lnk->exec()+".html"; | ||
89 | QStringList helpPath = Global::helpPath(); | ||
90 | bool helpExists = FALSE; | ||
91 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) | ||
92 | helpExists = QFile::exists( *it + "/" + helpFile ); | ||
93 | |||
94 | if ( helpExists ) { | ||
95 | r += "<h3><a href="+helpFile+"><img src="+icon+">"+name+"</a></h3>\n"; | ||
96 | } | ||
97 | } | ||
98 | return r; | ||
99 | } | ||
diff --git a/core/apps/helpbrowser/magictextbrowser.h b/core/apps/helpbrowser/magictextbrowser.h new file mode 100644 index 0000000..ff91e68 --- a/dev/null +++ b/core/apps/helpbrowser/magictextbrowser.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** Copyright (C) 2003 zecke | ||
4 | ** | ||
5 | ** This file is part of the Qtopia Environment. | ||
6 | ** | ||
7 | ** This file may be distributed and/or modified under the terms of the | ||
8 | ** GNU General Public License version 2 as published by the Free Software | ||
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
10 | ** packaging of this file. | ||
11 | ** | ||
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | ** | ||
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
16 | ** | ||
17 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
18 | ** not clear to you. | ||
19 | ** | ||
20 | **********************************************************************/ | ||
21 | #ifndef HELP_BROWSER_MAGIC_TEXT_BROWSER_H | ||
22 | #define HELP_BROWSER_MAGIC_TEXT_BROWSER_H | ||
23 | |||
24 | #include <qtextbrowser.h> | ||
25 | |||
26 | class MagicTextBrowser : public QTextBrowser { | ||
27 | public: | ||
28 | MagicTextBrowser(QWidget* parent); | ||
29 | |||
30 | void setSource( const QString& source ); | ||
31 | |||
32 | /** honor QPE Attributes */ | ||
33 | bool magicQpe(const QString& source, const QString& name); | ||
34 | /** honor OPIE Attributes */ | ||
35 | bool magicOpe(const QString& source, const QString& name ); | ||
36 | private: | ||
37 | |||
38 | QString generateQpe(const QString& name) const; | ||
39 | QString generateOpe(const QString& name) const; | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/core/apps/helpbrowser/main.cpp b/core/apps/helpbrowser/main.cpp index 1cb10b7..b1bea56 100644 --- a/core/apps/helpbrowser/main.cpp +++ b/core/apps/helpbrowser/main.cpp | |||
@@ -1,34 +1,33 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the 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 | 20 | ||
21 | #include "helpbrowser.h" | 21 | #include "helpbrowser.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qtopia/qpeapplication.h> |
24 | 24 | ||
25 | int main( int argc, char ** argv ) | 25 | int main( int argc, char ** argv ) |
26 | { | 26 | { |
27 | QPEApplication a( argc, argv ); | 27 | QPEApplication a( argc, argv ); |
28 | 28 | ||
29 | HelpBrowser mw; | 29 | HelpBrowser mw; |
30 | mw.setCaption( HelpBrowser::tr("HelpBrowser") ); | 30 | a.showMainWidget( &mw ); |
31 | a.showMainDocumentWidget( &mw ); | ||
32 | 31 | ||
33 | return a.exec(); | 32 | return a.exec(); |
34 | } | 33 | } |
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 6f96574..1c95a97 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -548,62 +548,60 @@ void TextEdit::setWordWrap(bool y) { | |||
548 | 548 | ||
549 | void TextEdit::setSearchBar(bool b) { | 549 | void TextEdit::setSearchBar(bool b) { |
550 | useSearchBar=b; | 550 | useSearchBar=b; |
551 | Config cfg("TextEdit"); | 551 | Config cfg("TextEdit"); |
552 | cfg.setGroup("View"); | 552 | cfg.setGroup("View"); |
553 | cfg.writeEntry ( "SearchBar", b ); | 553 | cfg.writeEntry ( "SearchBar", b ); |
554 | searchBarAction->setOn(b); | 554 | searchBarAction->setOn(b); |
555 | if(b) | 555 | if(b) |
556 | searchBar->show(); | 556 | searchBar->show(); |
557 | else | 557 | else |
558 | searchBar->hide(); | 558 | searchBar->hide(); |
559 | editor->setFocus(); | 559 | editor->setFocus(); |
560 | } | 560 | } |
561 | 561 | ||
562 | void TextEdit::fileNew() { | 562 | void TextEdit::fileNew() { |
563 | // if( !bFromDocView ) { | 563 | // if( !bFromDocView ) { |
564 | // saveAs(); | 564 | // saveAs(); |
565 | // } | 565 | // } |
566 | newFile(DocLnk()); | 566 | newFile(DocLnk()); |
567 | } | 567 | } |
568 | 568 | ||
569 | void TextEdit::fileOpen() { | 569 | void TextEdit::fileOpen() { |
570 | Config cfg("TextEdit"); | 570 | Config cfg("TextEdit"); |
571 | cfg. setGroup ( "View" ); | 571 | cfg. setGroup ( "View" ); |
572 | QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir()); | ||
573 | QMap<QString, QStringList> map; | 572 | QMap<QString, QStringList> map; |
574 | map.insert(tr("All"), QStringList() ); | 573 | map.insert(tr("All"), QStringList() ); |
575 | QStringList text; | 574 | QStringList text; |
576 | text << "text/*"; | 575 | text << "text/*"; |
577 | map.insert(tr("Text"), text ); | 576 | map.insert(tr("Text"), text ); |
578 | text << "*"; | 577 | text << "*"; |
579 | map.insert(tr("All"), text ); | 578 | map.insert(tr("All"), text ); |
580 | QString str = OFileDialog::getOpenFileName( 2, | 579 | QString str = OFileDialog::getOpenFileName( 2, |
581 | dir , | 580 | QString::null , |
582 | QString::null, map); | 581 | QString::null, map); |
583 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) | 582 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) |
584 | { | 583 | { |
585 | cfg.writeEntry("LastOpenDirectory", QFileInfo(str).dirPath(false)); | ||
586 | openFile( str ); | 584 | openFile( str ); |
587 | } | 585 | } |
588 | else | 586 | else |
589 | updateCaption(); | 587 | updateCaption(); |
590 | } | 588 | } |
591 | 589 | ||
592 | void TextEdit::doSearchBar() { | 590 | void TextEdit::doSearchBar() { |
593 | if(!useSearchBar) | 591 | if(!useSearchBar) |
594 | searchBar->hide(); | 592 | searchBar->hide(); |
595 | else | 593 | else |
596 | searchBar->show(); | 594 | searchBar->show(); |
597 | } | 595 | } |
598 | 596 | ||
599 | #if 0 | 597 | #if 0 |
600 | void TextEdit::slotFind() { | 598 | void TextEdit::slotFind() { |
601 | FindDialog frmFind( tr("Text Editor"), this ); | 599 | FindDialog frmFind( tr("Text Editor"), this ); |
602 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 600 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
603 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 601 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
604 | 602 | ||
605 | //case sensitive, backwards, [category] | 603 | //case sensitive, backwards, [category] |
606 | 604 | ||
607 | connect( editor, SIGNAL(notFound()), | 605 | connect( editor, SIGNAL(notFound()), |
608 | &frmFind, SLOT(slotNotFound()) ); | 606 | &frmFind, SLOT(slotNotFound()) ); |
609 | connect( editor, SIGNAL(searchWrapped()), | 607 | connect( editor, SIGNAL(searchWrapped()), |
@@ -955,95 +953,95 @@ bool TextEdit::saveAs() { | |||
955 | qDebug("returning false"); | 953 | qDebug("returning false"); |
956 | return false; | 954 | return false; |
957 | } //end saveAs | 955 | } //end saveAs |
958 | 956 | ||
959 | void TextEdit::clear() { | 957 | void TextEdit::clear() { |
960 | delete doc; | 958 | delete doc; |
961 | doc = 0; | 959 | doc = 0; |
962 | editor->clear(); | 960 | editor->clear(); |
963 | } | 961 | } |
964 | 962 | ||
965 | void TextEdit::updateCaption( const QString &name ) { | 963 | void TextEdit::updateCaption( const QString &name ) { |
966 | 964 | ||
967 | if ( name.isEmpty() ) | 965 | if ( name.isEmpty() ) |
968 | setCaption( tr("Text Editor") ); | 966 | setCaption( tr("Text Editor") ); |
969 | else { | 967 | else { |
970 | QString s = name; | 968 | QString s = name; |
971 | if ( s.isNull() ) | 969 | if ( s.isNull() ) |
972 | s = doc->name(); | 970 | s = doc->name(); |
973 | if ( s.isEmpty() ) { | 971 | if ( s.isEmpty() ) { |
974 | s = tr( "Unnamed" ); | 972 | s = tr( "Unnamed" ); |
975 | currentFileName=s; | 973 | currentFileName=s; |
976 | } | 974 | } |
977 | // if(s.left(1) == "/") | 975 | // if(s.left(1) == "/") |
978 | // s = s.right(s.length()-1); | 976 | // s = s.right(s.length()-1); |
979 | setCaption( s + " - " + tr("Text Editor") ); | 977 | setCaption( tr("%1 - Text Editor").arg( s ) ); |
980 | } | 978 | } |
981 | } | 979 | } |
982 | 980 | ||
983 | void TextEdit::setDocument(const QString& fileref) { | 981 | void TextEdit::setDocument(const QString& fileref) { |
984 | if(fileref != "Unnamed") { | 982 | if(fileref != "Unnamed") { |
985 | currentFileName=fileref; | 983 | currentFileName=fileref; |
986 | qDebug("setDocument"); | 984 | qDebug("setDocument"); |
987 | QFileInfo fi(currentFileName); | 985 | QFileInfo fi(currentFileName); |
988 | qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); | 986 | qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); |
989 | if( (fi.baseName().left(1)).isEmpty() ) { | 987 | if( (fi.baseName().left(1)).isEmpty() ) { |
990 | openDotFile(currentFileName); | 988 | openDotFile(currentFileName); |
991 | 989 | ||
992 | } else { | 990 | } else { |
993 | qDebug("setDoc open"); | 991 | qDebug("setDoc open"); |
994 | bFromDocView = true; | 992 | bFromDocView = true; |
995 | openFile(fileref); | 993 | openFile(fileref); |
996 | editor->setEdited(true); | 994 | editor->setEdited(true); |
997 | edited1=false; | 995 | edited1=false; |
998 | edited=true; | 996 | edited=true; |
999 | // fromSetDocument=false; | 997 | // fromSetDocument=false; |
1000 | // doSearchBar(); | 998 | // doSearchBar(); |
1001 | } | 999 | } |
1002 | } | 1000 | } |
1003 | updateCaption( currentFileName); | 1001 | updateCaption( currentFileName); |
1004 | } | 1002 | } |
1005 | 1003 | ||
1006 | void TextEdit::changeFont() { | 1004 | void TextEdit::changeFont() { |
1007 | QDialog *d = new QDialog ( this, "FontDialog", true ); | 1005 | QDialog *d = new QDialog ( this, "FontDialog", true ); |
1008 | d-> setCaption ( tr( "Choose font" )); | 1006 | d-> setCaption ( tr( "Choose font" )); |
1009 | QBoxLayout *lay = new QVBoxLayout ( d ); | 1007 | QBoxLayout *lay = new QVBoxLayout ( d ); |
1010 | OFontSelector *ofs = new OFontSelector ( true, d ); | 1008 | OFontSelector *ofs = new OFontSelector ( true, d ); |
1011 | lay-> addWidget ( ofs ); | 1009 | lay-> addWidget ( ofs ); |
1012 | ofs-> setSelectedFont ( editor-> font ( )); | 1010 | ofs-> setSelectedFont ( editor-> font ( )); |
1013 | 1011 | ||
1014 | d-> showMaximized ( ); | 1012 | d-> showMaximized ( ); |
1015 | if ( d-> exec ( ) == QDialog::Accepted ) | 1013 | if ( d-> exec ( ) == QDialog::Accepted ) |
1016 | editor-> setFont ( ofs-> selectedFont ( )); | 1014 | editor-> setFont ( ofs-> selectedFont ( )); |
1017 | delete d; | 1015 | delete d; |
1018 | 1016 | ||
1019 | } | 1017 | } |
1020 | 1018 | ||
1021 | void TextEdit::editDelete() { | 1019 | void TextEdit::editDelete() { |
1022 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 1020 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
1023 | tr("Do you really want<BR>to <B>delete</B> " | 1021 | tr("Do you really want<BR>to <B>delete</B> " |
1024 | "the current file\nfrom the disk?<BR>This is " | 1022 | "the current file\nfrom the disk?<BR>This is " |
1025 | "<B>irreversable!!</B>"), | 1023 | "<B>irreversable!</B>"), |
1026 | tr("Yes"),tr("No"),0,0,1) ) { | 1024 | tr("Yes"),tr("No"),0,0,1) ) { |
1027 | case 0: | 1025 | case 0: |
1028 | if(doc) { | 1026 | if(doc) { |
1029 | doc->removeFiles(); | 1027 | doc->removeFiles(); |
1030 | clear(); | 1028 | clear(); |
1031 | setCaption( tr("Text Editor") ); | 1029 | setCaption( tr("Text Editor") ); |
1032 | } | 1030 | } |
1033 | break; | 1031 | break; |
1034 | case 1: | 1032 | case 1: |
1035 | // exit | 1033 | // exit |
1036 | break; | 1034 | break; |
1037 | }; | 1035 | }; |
1038 | } | 1036 | } |
1039 | 1037 | ||
1040 | void TextEdit::changeStartConfig( bool b ) { | 1038 | void TextEdit::changeStartConfig( bool b ) { |
1041 | startWithNew=b; | 1039 | startWithNew=b; |
1042 | Config cfg("TextEdit"); | 1040 | Config cfg("TextEdit"); |
1043 | cfg.setGroup("View"); | 1041 | cfg.setGroup("View"); |
1044 | cfg.writeEntry("startNew",b); | 1042 | cfg.writeEntry("startNew",b); |
1045 | update(); | 1043 | update(); |
1046 | } | 1044 | } |
1047 | 1045 | ||
1048 | void TextEdit::editorChanged() { | 1046 | void TextEdit::editorChanged() { |
1049 | // qDebug("editor changed"); | 1047 | // qDebug("editor changed"); |