author | harlekin <harlekin> | 2003-03-22 18:08:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-22 18:08:59 (UTC) |
commit | cc2d8a80b388a219baa9d92c847ea081099879d1 (patch) (unidiff) | |
tree | c148d151a6f15f40b1765fab8b844227aded0b16 | |
parent | 44547fd13797c03192b4e416e5a1945e4d6b9e6b (diff) | |
download | opie-cc2d8a80b388a219baa9d92c847ea081099879d1.zip opie-cc2d8a80b388a219baa9d92c847ea081099879d1.tar.gz opie-cc2d8a80b388a219baa9d92c847ea081099879d1.tar.bz2 |
home icon from inline
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 6 | ||||
-rw-r--r-- | core/apps/helpbrowser/pics/home.png | bin | 693 -> 0 bytes |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index e20d49b..48da7c6 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp | |||
@@ -77,87 +77,87 @@ void HelpBrowser::init( const QString& _home ) | |||
77 | toolbar->setHorizontalStretchable( TRUE ); | 77 | toolbar->setHorizontalStretchable( TRUE ); |
78 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 78 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
79 | 79 | ||
80 | toolbar = new QPEToolBar( this ); | 80 | toolbar = new QPEToolBar( this ); |
81 | // addToolBar( toolbar, "Toolbar"); | 81 | // addToolBar( toolbar, "Toolbar"); |
82 | 82 | ||
83 | //QPopupMenu* go = new QPopupMenu( this ); | 83 | //QPopupMenu* go = new QPopupMenu( this ); |
84 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); | 84 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); |
85 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); | 85 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); |
86 | connect( browser, SIGNAL( backwardAvailable( bool ) ), | 86 | connect( browser, SIGNAL( backwardAvailable( bool ) ), |
87 | backAction, SLOT( setEnabled( bool ) ) ); | 87 | backAction, SLOT( setEnabled( bool ) ) ); |
88 | //backAction->addTo( go ); | 88 | //backAction->addTo( go ); |
89 | backAction->addTo( toolbar ); | 89 | backAction->addTo( toolbar ); |
90 | backAction->setEnabled( FALSE ); | 90 | backAction->setEnabled( FALSE ); |
91 | 91 | ||
92 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); | 92 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); |
93 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); | 93 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); |
94 | connect( browser, SIGNAL( forwardAvailable( bool ) ), | 94 | connect( browser, SIGNAL( forwardAvailable( bool ) ), |
95 | forwardAction, SLOT( setEnabled( bool ) ) ); | 95 | forwardAction, SLOT( setEnabled( bool ) ) ); |
96 | //forwardAction->addTo( go ); | 96 | //forwardAction->addTo( go ); |
97 | forwardAction->addTo( toolbar ); | 97 | forwardAction->addTo( toolbar ); |
98 | forwardAction->setEnabled( FALSE ); | 98 | forwardAction->setEnabled( FALSE ); |
99 | 99 | ||
100 | QAction *a = new QAction( tr( "Home" ), Resource::loadPixmap( | 100 | QAction *a = new QAction( tr( "Home" ), Resource::loadPixmap( |
101 | "helpbrowser/home" ), QString::null, 0, this, 0 ); | 101 | "home" ), QString::null, 0, this, 0 ); |
102 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); | 102 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); |
103 | //a->addTo( go ); | 103 | //a->addTo( go ); |
104 | a->addTo( toolbar ); | 104 | a->addTo( toolbar ); |
105 | 105 | ||
106 | bookm = new QPopupMenu( this ); | 106 | bookm = new QPopupMenu( this ); |
107 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 107 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
108 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); | 108 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); |
109 | bookm->insertSeparator(); | 109 | bookm->insertSeparator(); |
110 | connect( bookm, SIGNAL( activated( int ) ), | 110 | connect( bookm, SIGNAL( activated( int ) ), |
111 | this, SLOT( bookmChosen( int ) ) ); | 111 | this, SLOT( bookmChosen( int ) ) ); |
112 | 112 | ||
113 | readBookmarks(); | 113 | readBookmarks(); |
114 | 114 | ||
115 | //menu->insertItem( tr("Go"), go ); | 115 | //menu->insertItem( tr("Go"), go ); |
116 | menu->insertItem( tr( "Bookmarks" ), bookm ); | 116 | menu->insertItem( tr( "Bookmarks" ), bookm ); |
117 | 117 | ||
118 | resize( 240, 300 ); | 118 | resize( 240, 300 ); |
119 | browser->setFocus(); | 119 | browser->setFocus(); |
120 | 120 | ||
121 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 121 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
122 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 122 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | 125 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) |
126 | { | 126 | { |
127 | if ( msg == "showFile(QString)" ) { | 127 | if ( msg == "showFile(QString)" ) { |
128 | QDataStream ds(data,IO_ReadOnly); | 128 | QDataStream ds(data,IO_ReadOnly); |
129 | QString fn; | 129 | QString fn; |
130 | ds >> fn; | 130 | ds >> fn; |
131 | setDocument( fn ); | 131 | setDocument( fn ); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | void HelpBrowser::setDocument( const QString &doc ) | 135 | void HelpBrowser::setDocument( const QString &doc ) |
136 | { | 136 | { |
137 | if ( !doc.isEmpty() ) | 137 | if ( !doc.isEmpty() ) |
138 | browser->setSource( doc ); | 138 | browser->setSource( doc ); |
139 | raise(); | 139 | raise(); |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | void HelpBrowser::textChanged() | 143 | void HelpBrowser::textChanged() |
144 | { | 144 | { |
145 | if ( browser->documentTitle().isNull() ) | 145 | if ( browser->documentTitle().isNull() ) |
146 | setCaption( tr("Help Browser") ); | 146 | setCaption( tr("Help Browser") ); |
147 | else | 147 | else |
148 | setCaption( browser->documentTitle() ) ; | 148 | setCaption( browser->documentTitle() ) ; |
149 | 149 | ||
150 | selectedURL = caption(); | 150 | selectedURL = caption(); |
151 | } | 151 | } |
152 | 152 | ||
153 | HelpBrowser::~HelpBrowser() | 153 | HelpBrowser::~HelpBrowser() |
154 | { | 154 | { |
155 | QStringList bookmarks; | 155 | QStringList bookmarks; |
156 | QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); | 156 | QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); |
157 | for ( ; it2 != mBookmarks.end(); ++it2 ) | 157 | for ( ; it2 != mBookmarks.end(); ++it2 ) |
158 | bookmarks.append( (*it2).name + "=" + (*it2).file ); | 158 | bookmarks.append( (*it2).name + "=" + (*it2).file ); |
159 | 159 | ||
160 | QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); | 160 | QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); |
161 | if ( f2.open( IO_WriteOnly ) ) { | 161 | if ( f2.open( IO_WriteOnly ) ) { |
162 | QDataStream s2( &f2 ); | 162 | QDataStream s2( &f2 ); |
163 | s2 << bookmarks; | 163 | s2 << bookmarks; |
@@ -170,49 +170,49 @@ void HelpBrowser::pathSelected( const QString &_path ) | |||
170 | browser->setSource( _path ); | 170 | browser->setSource( _path ); |
171 | } | 171 | } |
172 | 172 | ||
173 | void HelpBrowser::readBookmarks() | 173 | void HelpBrowser::readBookmarks() |
174 | { | 174 | { |
175 | QString file = Global::applicationFileName("helpbrowser", "bookmarks"); | 175 | QString file = Global::applicationFileName("helpbrowser", "bookmarks"); |
176 | if ( QFile::exists( file ) ) { | 176 | if ( QFile::exists( file ) ) { |
177 | QStringList bookmarks; | 177 | QStringList bookmarks; |
178 | QFile f( file ); | 178 | QFile f( file ); |
179 | if ( f.open( IO_ReadOnly ) ) { | 179 | if ( f.open( IO_ReadOnly ) ) { |
180 | QDataStream s( &f ); | 180 | QDataStream s( &f ); |
181 | s >> bookmarks; | 181 | s >> bookmarks; |
182 | f.close(); | 182 | f.close(); |
183 | } | 183 | } |
184 | QStringList::Iterator it = bookmarks.begin(); | 184 | QStringList::Iterator it = bookmarks.begin(); |
185 | for ( ; it != bookmarks.end(); ++it ) { | 185 | for ( ; it != bookmarks.end(); ++it ) { |
186 | Bookmark b; | 186 | Bookmark b; |
187 | QString current = *it; | 187 | QString current = *it; |
188 | int equal = current.find( "=" ); | 188 | int equal = current.find( "=" ); |
189 | if ( equal < 1 || equal == (int)current.length() - 1 ) | 189 | if ( equal < 1 || equal == (int)current.length() - 1 ) |
190 | continue; | 190 | continue; |
191 | b.name = current.left( equal ); | 191 | b.name = current.left( equal ); |
192 | b.file = current.mid( equal + 1 ); | 192 | b.file = current.mid( equal + 1 ); |
193 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 193 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | void HelpBrowser::bookmChosen( int i ) | 198 | void HelpBrowser::bookmChosen( int i ) |
199 | { | 199 | { |
200 | if ( mBookmarks.contains( i ) ) | 200 | if ( mBookmarks.contains( i ) ) |
201 | browser->setSource( mBookmarks[ i ].file ); | 201 | browser->setSource( mBookmarks[ i ].file ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void HelpBrowser::addBookmark() | 204 | void HelpBrowser::addBookmark() |
205 | { | 205 | { |
206 | Bookmark b; | 206 | Bookmark b; |
207 | b.name = browser->documentTitle(); | 207 | b.name = browser->documentTitle(); |
208 | b.file = browser->source(); | 208 | b.file = browser->source(); |
209 | if (b.name.isEmpty() ) { | 209 | if (b.name.isEmpty() ) { |
210 | b.name = b.file.left( b.file.length() - 5 ); // remove .html | 210 | b.name = b.file.left( b.file.length() - 5 ); // remove .html |
211 | } | 211 | } |
212 | QMap<int, Bookmark>::Iterator it; | 212 | QMap<int, Bookmark>::Iterator it; |
213 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) | 213 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) |
214 | if ( (*it).file == b.file ) return; | 214 | if ( (*it).file == b.file ) return; |
215 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 215 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
216 | } | 216 | } |
217 | 217 | ||
218 | void HelpBrowser::removeBookmark() | 218 | void HelpBrowser::removeBookmark() |
diff --git a/core/apps/helpbrowser/pics/home.png b/core/apps/helpbrowser/pics/home.png deleted file mode 100644 index e9ba024..0000000 --- a/core/apps/helpbrowser/pics/home.png +++ b/dev/null | |||
Binary files differ | |||