summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.cpp4
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.cpp b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
index ffdc9f0..57b1e74 100644
--- a/noncore/apps/opie-gutenbrowser/helpwindow.cpp
+++ b/noncore/apps/opie-gutenbrowser/helpwindow.cpp
@@ -1,212 +1,216 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of an example program for Qt. This example 6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9 copyright : (C) 2000 -2004 by llornkcor 9 copyright : (C) 2000 -2004 by llornkcor
10 email : ljp@llornkcor.com 10 email : ljp@llornkcor.com
11*****************************************************************************/ 11*****************************************************************************/
12 12
13#include "helpwindow.h" 13#include "helpwindow.h"
14#include <qstatusbar.h> 14#include <qstatusbar.h>
15 15
16#include <qmenubar.h> 16#include <qmenubar.h>
17#include <qtoolbar.h> 17#include <qtoolbar.h>
18#include <qtoolbutton.h> 18#include <qtoolbutton.h>
19#include <qcombobox.h> 19#include <qcombobox.h>
20 20
21#ifndef QT_NO_FILEDIALOG
22#include <qfiledialog.h>
23#endif
24
21#include <ctype.h> 25#include <ctype.h>
22 26
23HelpWindow::HelpWindow( const QString& home_, const QString&, QWidget* parent, const char *name ) 27HelpWindow::HelpWindow( const QString& home_, const QString&, QWidget* parent, const char *name )
24 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() 28 : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
25{ 29{
26 QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 30 QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
27// readHistory(); 31// readHistory();
28// readBookmarks(); 32// readBookmarks();
29 33
30 browser = new QTextBrowser( this ); 34 browser = new QTextBrowser( this );
31 QStringList Strlist; 35 QStringList Strlist;
32 Strlist.append( home_); 36 Strlist.append( home_);
33 browser->mimeSourceFactory()->setFilePath( Strlist ); 37 browser->mimeSourceFactory()->setFilePath( Strlist );
34 38
35 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 39 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
36 40
37 connect(browser,SIGNAL(textChanged()),this,SLOT(textChanged())); 41 connect(browser,SIGNAL(textChanged()),this,SLOT(textChanged()));
38 42
39 setCentralWidget( browser ); 43 setCentralWidget( browser );
40 44
41 if ( !home_.isEmpty() ) 45 if ( !home_.isEmpty() )
42 46
43//////////////////////////////// 47////////////////////////////////
44 browser->setSource( home_ ); 48 browser->setSource( home_ );
45 49
46//////////////////////////////// 50////////////////////////////////
47 connect( browser, SIGNAL( highlighted( const QString&) ), 51 connect( browser, SIGNAL( highlighted( const QString&) ),
48 statusBar(), SLOT( message( const QString&)) ); 52 statusBar(), SLOT( message( const QString&)) );
49 53
50// resize( 640,600 ); 54// resize( 640,600 );
51#ifdef Q_WS_QWS 55#ifdef Q_WS_QWS
52 setGeometry( 0,0,236,280); 56 setGeometry( 0,0,236,280);
53#else 57#else
54 setGeometry( 10,30,520,420 ); 58 setGeometry( 10,30,520,420 );
55// resize(520,420); 59// resize(520,420);
56#endif 60#endif
57 61
58 QPopupMenu* file = new QPopupMenu( this ); 62 QPopupMenu* file = new QPopupMenu( this );
59// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); 63// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
60 file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); 64 file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
61// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); 65// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
62 file->insertSeparator(); 66 file->insertSeparator();
63 file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); 67 file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
64// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); 68// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );
65 69
66 // The same three icons are used twice each. 70 // The same three icons are used twice each.
67////F FIXME 71////F FIXME
68 QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; 72 QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
69 QIconSet icon_back( QPixmap(pixs+"back.png") ); 73 QIconSet icon_back( QPixmap(pixs+"back.png") );
70 QIconSet icon_forward( QPixmap(pixs+"forward.png") ); 74 QIconSet icon_forward( QPixmap(pixs+"forward.png") );
71 QIconSet icon_home( QPixmap(pixs+"home.png") ); 75 QIconSet icon_home( QPixmap(pixs+"home.png") );
72 76
73 QPopupMenu* go = new QPopupMenu( this ); 77 QPopupMenu* go = new QPopupMenu( this );
74 backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); 78 backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
75 forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); 79 forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
76 go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); 80 go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
77 81
78// QPopupMenu* help = new QPopupMenu( this ); 82// QPopupMenu* help = new QPopupMenu( this );
79// help->insertItem( tr("&About ..."), this, SLOT( about() ) ); 83// help->insertItem( tr("&About ..."), this, SLOT( about() ) );
80// help->insertItem( tr("About &Qt ..."), this, SLOT( aboutQt() ) ); 84// help->insertItem( tr("About &Qt ..."), this, SLOT( aboutQt() ) );
81 85
82 86
83 hist = new QPopupMenu( this ); 87 hist = new QPopupMenu( this );
84 QStringList::Iterator it = history.begin(); 88 QStringList::Iterator it = history.begin();
85 for ( ; it != history.end(); ++it ) 89 for ( ; it != history.end(); ++it )
86 mHistory[ hist->insertItem( *it ) ] = *it; 90 mHistory[ hist->insertItem( *it ) ] = *it;
87 connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); 91 connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) );
88 92
89 bookm = new QPopupMenu( this ); 93 bookm = new QPopupMenu( this );
90 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); 94 bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
91 bookm->insertSeparator(); 95 bookm->insertSeparator();
92 96
93 QStringList::Iterator it2 = bookmarks.begin(); 97 QStringList::Iterator it2 = bookmarks.begin();
94 for ( ; it2 != bookmarks.end(); ++it2 ) 98 for ( ; it2 != bookmarks.end(); ++it2 )
95 mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; 99 mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
96 connect( bookm, SIGNAL( activated( int ) ), 100 connect( bookm, SIGNAL( activated( int ) ),
97 this, SLOT( bookmChosen( int ) ) ); 101 this, SLOT( bookmChosen( int ) ) );
98 102
99 menuBar()->insertItem( tr("&File"), file ); 103 menuBar()->insertItem( tr("&File"), file );
100 menuBar()->insertItem( tr("&Go"), go ); 104 menuBar()->insertItem( tr("&Go"), go );
101 menuBar()->insertItem( tr( "History" ), hist ); 105 menuBar()->insertItem( tr( "History" ), hist );
102 menuBar()->insertItem( tr( "Bookmarks" ), bookm ); 106 menuBar()->insertItem( tr( "Bookmarks" ), bookm );
103// menuBar()->insertSeparator(); 107// menuBar()->insertSeparator();
104// menuBar()->insertItem( tr("&Help"), help ); 108// menuBar()->insertItem( tr("&Help"), help );
105 109
106 menuBar()->setItemEnabled( forwardId, FALSE); 110 menuBar()->setItemEnabled( forwardId, FALSE);
107 menuBar()->setItemEnabled( backwardId, FALSE); 111 menuBar()->setItemEnabled( backwardId, FALSE);
108 connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); 112 connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) );
109 connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); 113 connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) );
110 114
111 115
112 QToolBar* toolbar = new QToolBar( this ); 116 QToolBar* toolbar = new QToolBar( this );
113 addToolBar( toolbar, "Toolbar"); 117 addToolBar( toolbar, "Toolbar");
114 QToolButton* button; 118 QToolButton* button;
115 119
116 button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); 120 button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
117 connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); 121 connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
118 button->setEnabled( FALSE ); 122 button->setEnabled( FALSE );
119 button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); 123 button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
120 connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); 124 connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
121 button->setEnabled( FALSE ); 125 button->setEnabled( FALSE );
122 button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); 126 button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
123 127
124 toolbar->addSeparator(); 128 toolbar->addSeparator();
125 129
126 pathCombo = new QComboBox( TRUE, toolbar ); 130 pathCombo = new QComboBox( TRUE, toolbar );
127 connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); 131 connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) );
128 toolbar->setStretchableWidget( pathCombo ); 132 toolbar->setStretchableWidget( pathCombo );
129 133
130// pathCombo->setMaximumWidth(190); 134// pathCombo->setMaximumWidth(190);
131// setRightJustification( TRUE ); 135// setRightJustification( TRUE );
132// setDockEnabled( Left, FALSE ); 136// setDockEnabled( Left, FALSE );
133// setDockEnabled( Right, FALSE ); 137// setDockEnabled( Right, FALSE );
134 138
135 pathCombo->insertItem( home_ ); 139 pathCombo->insertItem( home_ );
136 140
137 browser->setFocus(); 141 browser->setFocus();
138 142
139 143
140} 144}
141 145
142 146
143void HelpWindow::setBackwardAvailable( bool b) 147void HelpWindow::setBackwardAvailable( bool b)
144{ 148{
145 menuBar()->setItemEnabled( backwardId, b); 149 menuBar()->setItemEnabled( backwardId, b);
146} 150}
147 151
148void HelpWindow::setForwardAvailable( bool b) 152void HelpWindow::setForwardAvailable( bool b)
149{ 153{
150 menuBar()->setItemEnabled( forwardId, b); 154 menuBar()->setItemEnabled( forwardId, b);
151} 155}
152 156
153 157
154void HelpWindow::textChanged() 158void HelpWindow::textChanged()
155{ 159{
156 if ( browser->documentTitle().isNull() ) { 160 if ( browser->documentTitle().isNull() ) {
157 setCaption( "Gutenbrowser - Helpviewer - " + browser->context() ); 161 setCaption( "Gutenbrowser - Helpviewer - " + browser->context() );
158 selectedURL = browser->context(); 162 selectedURL = browser->context();
159 } 163 }
160 else { 164 else {
161 setCaption( "Gutenbrowser - Helpviewer - " + browser->documentTitle() ) ; 165 setCaption( "Gutenbrowser - Helpviewer - " + browser->documentTitle() ) ;
162 selectedURL = browser->documentTitle(); 166 selectedURL = browser->documentTitle();
163 } 167 }
164 168
165 if ( !selectedURL.isEmpty() && pathCombo ) { 169 if ( !selectedURL.isEmpty() && pathCombo ) {
166 bool exists = FALSE; 170 bool exists = FALSE;
167 int i; 171 int i;
168 for ( i = 0; i < pathCombo->count(); ++i ) { 172 for ( i = 0; i < pathCombo->count(); ++i ) {
169 if ( pathCombo->text( i ) == selectedURL ) { 173 if ( pathCombo->text( i ) == selectedURL ) {
170 exists = TRUE; 174 exists = TRUE;
171 break; 175 break;
172 } 176 }
173 } 177 }
174 if ( !exists ) { 178 if ( !exists ) {
175 pathCombo->insertItem( selectedURL, 0 ); 179 pathCombo->insertItem( selectedURL, 0 );
176 pathCombo->setCurrentItem( 0 ); 180 pathCombo->setCurrentItem( 0 );
177 mHistory[ hist->insertItem( selectedURL ) ] = selectedURL; 181 mHistory[ hist->insertItem( selectedURL ) ] = selectedURL;
178 } else 182 } else
179 pathCombo->setCurrentItem( i ); 183 pathCombo->setCurrentItem( i );
180 selectedURL = QString::null; 184 selectedURL = QString::null;
181 } 185 }
182} 186}
183 187
184HelpWindow::~HelpWindow() 188HelpWindow::~HelpWindow()
185{ 189{
186 history.clear(); 190 history.clear();
187 QMap<int, QString>::Iterator it = mHistory.begin(); 191 QMap<int, QString>::Iterator it = mHistory.begin();
188 for ( ; it != mHistory.end(); ++it ) 192 for ( ; it != mHistory.end(); ++it )
189 history.append( *it ); 193 history.append( *it );
190 194
191 QFile f( QDir::currentDirPath() + "/.history" ); 195 QFile f( QDir::currentDirPath() + "/.history" );
192 f.open( IO_WriteOnly ); 196 f.open( IO_WriteOnly );
193 QDataStream s( &f ); 197 QDataStream s( &f );
194 s << history; 198 s << history;
195 f.close(); 199 f.close();
196 200
197 bookmarks.clear(); 201 bookmarks.clear();
198 QMap<int, QString>::Iterator it2 = mBookmarks.begin(); 202 QMap<int, QString>::Iterator it2 = mBookmarks.begin();
199 for ( ; it2 != mBookmarks.end(); ++it2 ) 203 for ( ; it2 != mBookmarks.end(); ++it2 )
200 bookmarks.append( *it2 ); 204 bookmarks.append( *it2 );
201 205
202 QFile f2( QDir::currentDirPath() + "/.bookmarks" ); 206 QFile f2( QDir::currentDirPath() + "/.bookmarks" );
203 f2.open( IO_WriteOnly ); 207 f2.open( IO_WriteOnly );
204 QDataStream s2( &f2 ); 208 QDataStream s2( &f2 );
205 s2 << bookmarks; 209 s2 << bookmarks;
206 f2.close(); 210 f2.close();
207} 211}
208 212
209// void HelpWindow::about() 213// void HelpWindow::about()
210// { 214// {
211// QMessageBox::about( this, "Gutenbrowser", "<p>Thanks to Trolltech for this</p>" ); 215// QMessageBox::about( this, "Gutenbrowser", "<p>Thanks to Trolltech for this</p>" );
212// } 216// }
diff --git a/noncore/apps/opie-gutenbrowser/openetext.h b/noncore/apps/opie-gutenbrowser/openetext.h
index 6db71c4..ecc0bbd 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.h
+++ b/noncore/apps/opie-gutenbrowser/openetext.h
@@ -1,82 +1,79 @@
1/*************************************************************************** 1/***************************************************************************
2 openetext.h - description 2 openetext.h - description
3 ------------------- 3 -------------------
4 begin : Tue Jul 25 2000 4 begin : Tue Jul 25 2000
5 copyright : (C) 2000 -2004 by llornkcor 5 copyright : (C) 2000 -2004 by llornkcor
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 ***************************************************************************/ 7 ***************************************************************************/
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef OPENETEXT_H 17#ifndef OPENETEXT_H
18#define OPENETEXT_H 18#define OPENETEXT_H
19#include "gutenbrowser.h" 19#include "gutenbrowser.h"
20#include <qdialog.h> 20#include <qdialog.h>
21#include <qstringlist.h> 21#include <qstringlist.h>
22#ifndef Q_WS_QWS
23#include <qfiledialog.h>
24#endif
25//#include <fileselector.h> 22//#include <fileselector.h>
26#include <qlabel.h> 23#include <qlabel.h>
27#include <qlistbox.h> 24#include <qlistbox.h>
28#include <qpushbutton.h> 25#include <qpushbutton.h>
29#include <qstrlist.h> 26#include <qstrlist.h>
30#include <qwidget.h> 27#include <qwidget.h>
31//#include "CConfigFile.h" 28//#include "CConfigFile.h"
32 29
33/** 30/**
34 *@author llornkcor 31 *@author llornkcor
35 */ 32 */
36 33
37class OpenEtext : public QDialog { 34class OpenEtext : public QDialog {
38 Q_OBJECT 35 Q_OBJECT
39public: 36public:
40 OpenEtext(QWidget *parent, QString name); 37 OpenEtext(QWidget *parent, QString name);
41 ~OpenEtext(); 38 ~OpenEtext();
42 39
43 QPushButton* RemoveButton, * OpenFileButton, * OpenButton, *scanButton, *editButton; 40 QPushButton* RemoveButton, * OpenFileButton, * OpenButton, *scanButton, *editButton;
44 void getTitles(); 41 void getTitles();
45 QString title; 42 QString title;
46 QString file; 43 QString file;
47 QString selFile; 44 QString selFile;
48 QString s_numofFiles; 45 QString s_numofFiles;
49 QString fileName; 46 QString fileName;
50 QString name; 47 QString name;
51 QString openFileTitle; 48 QString openFileTitle;
52 QStringList fileList; 49 QStringList fileList;
53 QString local_library; 50 QString local_library;
54 QString local_index; 51 QString local_index;
55 QString title_text; 52 QString title_text;
56 void remFile(); 53 void remFile();
57 void removeSelection(); 54 void removeSelection();
58 QString titleFromLibrary( const QString fileName); 55 QString titleFromLibrary( const QString fileName);
59 bool FindTitle( const QString filename); 56 bool FindTitle( const QString filename);
60 bool checkConf(); 57 bool checkConf();
61// CConfigFile *config; 58// CConfigFile *config;
62 59
63protected: 60protected:
64 61
65 void initDialog(); 62 void initDialog();
66 QListBox *QListBox_1; 63 QListBox *QListBox_1;
67 QPushButton *QPushButton_OK; 64 QPushButton *QPushButton_OK;
68 QPushButton *QPushButton_Cancel; 65 QPushButton *QPushButton_Cancel;
69 QLabel *QLabel_1; 66 QLabel *QLabel_1;
70 67
71private: 68private:
72private slots: 69private slots:
73 70
74 virtual void select_title(int index ); 71 virtual void select_title(int index );
75 virtual void remove(); 72 virtual void remove();
76 virtual void scan(); 73 virtual void scan();
77 virtual void open(); 74 virtual void open();
78 virtual void OpenTitle(); 75 virtual void OpenTitle();
79 virtual void editTitle(); 76 virtual void editTitle();
80}; 77};
81 78
82#endif 79#endif