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 | |||
@@ -160,12 +160,13 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
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)); |
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,10 +1,10 @@ | |||
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 | ** |
@@ -15,24 +15,29 @@ | |||
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> |
@@ -45,27 +50,31 @@ | |||
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 ); |
@@ -77,61 +86,74 @@ void HelpBrowser::init( const QString& _home ) | |||
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() ) |
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,10 +1,10 @@ | |||
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 | ** |
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,11 +1,11 @@ | |||
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 |
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,10 +1,10 @@ | |||
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 | ** |
@@ -17,18 +17,17 @@ | |||
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 | |||
@@ -566,26 +566,24 @@ void TextEdit::fileNew() { | |||
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 | ||
@@ -973,13 +971,13 @@ void TextEdit::updateCaption( const QString &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; |
@@ -1019,13 +1017,13 @@ void TextEdit::changeFont() { | |||
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") ); |