author | drw <drw> | 2005-05-16 17:37:44 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-16 17:37:44 (UTC) |
commit | a0276f0957bd503491e8d435b7ad1a6479ce24eb (patch) (unidiff) | |
tree | 12be007f41dcbe7666b1a53578216cf12423596d | |
parent | e90364376c77a2f218b2fb291bb97eda7f18c3cb (diff) | |
download | opie-a0276f0957bd503491e8d435b7ad1a6479ce24eb.zip opie-a0276f0957bd503491e8d435b7ad1a6479ce24eb.tar.gz opie-a0276f0957bd503491e8d435b7ad1a6479ce24eb.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/apps/opie-write/mainwindow.cpp | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp index aa03060..296a1b0 100644 --- a/noncore/apps/opie-write/mainwindow.cpp +++ b/noncore/apps/opie-write/mainwindow.cpp | |||
@@ -10,35 +10,35 @@ | |||
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING |
11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
12 | ** PURPOSE. | 12 | ** PURPOSE. |
13 | ** | 13 | ** |
14 | ** email sales@trolltech.com for information about Qtopia License | 14 | ** email sales@trolltech.com for information about Qtopia License |
15 | ** Agreements. | 15 | ** Agreements. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
23 | 23 | ||
24 | /* OPIE */ | 24 | /* OPIE */ |
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/oresource.h> | ||
26 | #include <qpe/fileselector.h> | 27 | #include <qpe/fileselector.h> |
27 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
28 | #include <qpe/resource.h> | ||
29 | #include <qpe/fontdatabase.h> | 29 | #include <qpe/fontdatabase.h> |
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include "qtextedit.h" | 33 | #include "qtextedit.h" |
34 | #include <qaction.h> | 34 | #include <qaction.h> |
35 | #include <qtoolbar.h> | 35 | #include <qtoolbar.h> |
36 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
37 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qfontdatabase.h> | 39 | #include <qfontdatabase.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | #include <qfiledialog.h> | 44 | #include <qfiledialog.h> |
@@ -155,128 +155,133 @@ void MainWindow::setupActions() | |||
155 | tbMenu->setHorizontalStretchable( TRUE ); | 155 | tbMenu->setHorizontalStretchable( TRUE ); |
156 | 156 | ||
157 | QMenuBar *menu = new QMenuBar( tbMenu ); | 157 | QMenuBar *menu = new QMenuBar( tbMenu ); |
158 | 158 | ||
159 | tbEdit = new QToolBar( this ); | 159 | tbEdit = new QToolBar( this ); |
160 | 160 | ||
161 | QPopupMenu *file = new QPopupMenu( this ); | 161 | QPopupMenu *file = new QPopupMenu( this ); |
162 | menu->insertItem( tr("File"), file ); | 162 | menu->insertItem( tr("File"), file ); |
163 | 163 | ||
164 | QPopupMenu *edit = new QPopupMenu( this ); | 164 | QPopupMenu *edit = new QPopupMenu( this ); |
165 | menu->insertItem( tr("Edit"), edit ); | 165 | menu->insertItem( tr("Edit"), edit ); |
166 | 166 | ||
167 | // ### perhaps these shortcut keys should have some | 167 | // ### perhaps these shortcut keys should have some |
168 | // IPaq keys defined??? | 168 | // IPaq keys defined??? |
169 | QAction *a; | 169 | QAction *a; |
170 | 170 | ||
171 | a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 ); | 171 | a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), |
172 | QString::null, 0, this, 0 ); | ||
172 | connect( a, SIGNAL(activated()), this, SLOT(fileNew()) ); | 173 | connect( a, SIGNAL(activated()), this, SLOT(fileNew()) ); |
173 | a->addTo( file ); | 174 | a->addTo( file ); |
174 | 175 | ||
175 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 176 | a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ), |
177 | QString::null, 0, this, 0 ); | ||
176 | connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) ); | 178 | connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) ); |
177 | a->addTo( file ); | 179 | a->addTo( file ); |
178 | 180 | ||
179 | a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"), | 181 | a = new QAction( tr( "Undo" ), Opie::Core::OResource::loadPixmap("undo", Opie::Core::OResource::SmallIcon), |
180 | QString::null, 0, this, "editUndo" ); | 182 | QString::null, 0, this, "editUndo" ); |
181 | connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); | 183 | connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); |
182 | connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) ); | 184 | connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) ); |
183 | a->addTo( tbEdit ); | 185 | a->addTo( tbEdit ); |
184 | a->addTo( edit ); | 186 | a->addTo( edit ); |
185 | a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"), | 187 | a = new QAction( tr( "Redo" ), Opie::Core::OResource::loadPixmap("redo", Opie::Core::OResource::SmallIcon), |
186 | QString::null, 0, this, "editRedo" ); | 188 | QString::null, 0, this, "editRedo" ); |
187 | connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); |
188 | connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) ); | 190 | connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) ); |
189 | a->addTo( tbEdit ); | 191 | a->addTo( tbEdit ); |
190 | a->addTo( edit ); | 192 | a->addTo( edit ); |
191 | 193 | ||
192 | edit->insertSeparator(); | 194 | edit->insertSeparator(); |
193 | 195 | ||
194 | a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"), | 196 | a = new QAction( tr( "Copy" ), Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), |
195 | QString::null, 0, this, "editCopy" ); | 197 | QString::null, 0, this, "editCopy" ); |
196 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
197 | connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); | 199 | connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); |
198 | a->addTo( tbEdit ); | 200 | a->addTo( tbEdit ); |
199 | a->addTo( edit ); | 201 | a->addTo( edit ); |
200 | a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"), | 202 | a = new QAction( tr( "Cut" ), Opie::Core::OResource::loadPixmap("cut", Opie::Core::OResource::SmallIcon ), |
201 | QString::null, 0, this, "editCut" ); | 203 | QString::null, 0, this, "editCut" ); |
202 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 204 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
203 | connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); | 205 | connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); |
204 | a->addTo( tbEdit ); | 206 | a->addTo( tbEdit ); |
205 | a->addTo( edit ); | 207 | a->addTo( edit ); |
206 | a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"), | 208 | a = new QAction( tr( "Paste" ), Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), |
207 | QString::null, 0, this, "editPaste" ); | 209 | QString::null, 0, this, "editPaste" ); |
208 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 210 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
209 | a->addTo( tbEdit ); | 211 | a->addTo( tbEdit ); |
210 | a->addTo( edit ); | 212 | a->addTo( edit ); |
211 | 213 | ||
212 | tbFont = new QToolBar( this ); | 214 | tbFont = new QToolBar( this ); |
213 | tbFont->setLabel( "Font Actions" ); | 215 | tbFont->setLabel( "Font Actions" ); |
214 | tbFont->setHorizontalStretchable(TRUE); | 216 | tbFont->setHorizontalStretchable(TRUE); |
215 | 217 | ||
216 | comboFont = new QComboBox( FALSE, tbFont ); | 218 | comboFont = new QComboBox( FALSE, tbFont ); |
217 | FontDatabase db; | 219 | FontDatabase db; |
218 | QStringList f= db.families(); | 220 | QStringList f= db.families(); |
219 | comboFont->insertStringList( db.families() ); | 221 | comboFont->insertStringList( db.families() ); |
220 | connect( comboFont, SIGNAL( activated(const QString&) ), | 222 | connect( comboFont, SIGNAL( activated(const QString&) ), |
221 | this, SLOT( textFamily(const QString&) ) ); | 223 | this, SLOT( textFamily(const QString&) ) ); |
222 | comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) ); | 224 | comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) ); |
223 | comboFont->setMaximumWidth(90); | 225 | comboFont->setMaximumWidth(90); |
224 | 226 | ||
225 | comboSize = new QComboBox( TRUE, tbFont ); | 227 | comboSize = new QComboBox( TRUE, tbFont ); |
226 | QValueList<int> sizes = db.standardSizes(); | 228 | QValueList<int> sizes = db.standardSizes(); |
227 | QValueList<int>::Iterator it = sizes.begin(); | 229 | QValueList<int>::Iterator it = sizes.begin(); |
228 | for ( ; it != sizes.end(); ++it ) | 230 | for ( ; it != sizes.end(); ++it ) |
229 | comboSize->insertItem( QString::number( *it ) ); | 231 | comboSize->insertItem( QString::number( *it ) ); |
230 | connect( comboSize, SIGNAL( activated(const QString&) ), | 232 | connect( comboSize, SIGNAL( activated(const QString&) ), |
231 | this, SLOT( textSize(const QString&) ) ); | 233 | this, SLOT( textSize(const QString&) ) ); |
232 | comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); | 234 | comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); |
233 | comboSize->setFixedWidth( 38 ); | 235 | comboSize->setFixedWidth( 38 ); |
234 | 236 | ||
235 | tbStyle = new QToolBar( this ); | 237 | tbStyle = new QToolBar( this ); |
236 | tbStyle->setLabel( "Style Actions" ); | 238 | tbStyle->setLabel( "Style Actions" ); |
237 | 239 | ||
238 | actionTextBold = new QAction( tr( "Bold" ), | 240 | actionTextBold = new QAction( tr( "Bold" ), |
239 | Resource::loadPixmap("bold"), | 241 | Opie::Core::OResource::loadPixmap("bold", Opie::Core::OResource::SmallIcon ), |
240 | QString::null, CTRL + Key_B, | 242 | QString::null, CTRL + Key_B, |
241 | this, "textBold" ); | 243 | this, "textBold" ); |
242 | connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); | 244 | connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); |
243 | actionTextBold->addTo( tbStyle ); | 245 | actionTextBold->addTo( tbStyle ); |
244 | actionTextBold->setToggleAction( TRUE ); | 246 | actionTextBold->setToggleAction( TRUE ); |
245 | actionTextItalic = new QAction( tr( "Italic" ), | 247 | actionTextItalic = new QAction( tr( "Italic" ), |
246 | Resource::loadPixmap("italic"), | 248 | Opie::Core::OResource::loadPixmap("italic", Opie::Core::OResource::SmallIcon ), |
247 | tr( "&Italic" ), CTRL + Key_I, | 249 | tr( "&Italic" ), CTRL + Key_I, |
248 | this, "textItalic" ); | 250 | this, "textItalic" ); |
249 | connect( actionTextItalic, SIGNAL( activated() ), this, | 251 | connect( actionTextItalic, SIGNAL( activated() ), this, |
250 | SLOT( textItalic() ) ); | 252 | SLOT( textItalic() ) ); |
251 | actionTextItalic->addTo( tbStyle ); | 253 | actionTextItalic->addTo( tbStyle ); |
252 | actionTextItalic->setToggleAction( TRUE ); | 254 | actionTextItalic->setToggleAction( TRUE ); |
253 | actionTextUnderline = new QAction( tr( "Underline" ), | 255 | actionTextUnderline = new QAction( tr( "Underline" ), |
254 | Resource::loadPixmap("underline"), | 256 | Opie::Core::OResource::loadPixmap("underline", Opie::Core::OResource::SmallIcon ), |
255 | tr( "&Underline" ), CTRL + Key_U, | 257 | tr( "&Underline" ), CTRL + Key_U, |
256 | this, "textUnderline" ); | 258 | this, "textUnderline" ); |
257 | connect( actionTextUnderline, SIGNAL( activated() ), | 259 | connect( actionTextUnderline, SIGNAL( activated() ), |
258 | this, SLOT( textUnderline() ) ); | 260 | this, SLOT( textUnderline() ) ); |
259 | actionTextUnderline->addTo( tbStyle ); | 261 | actionTextUnderline->addTo( tbStyle ); |
260 | actionTextUnderline->setToggleAction( TRUE ); | 262 | actionTextUnderline->setToggleAction( TRUE ); |
261 | 263 | ||
262 | alignMenu = new ButtonMenu( tbStyle ); | 264 | alignMenu = new ButtonMenu( tbStyle ); |
263 | alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft ); | 265 | alignMenu->insertItem( Opie::Core::OResource::loadPixmap("left", Opie::Core::OResource::SmallIcon), tr("Left"), AlignLeft ); |
264 | alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter ); | 266 | alignMenu->insertItem( Opie::Core::OResource::loadPixmap("center", Opie::Core::OResource::SmallIcon), |
265 | alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight ); | 267 | tr("Center"), AlignCenter ); |
266 | alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify ); | 268 | alignMenu->insertItem( Opie::Core::OResource::loadPixmap("right", Opie::Core::OResource::SmallIcon), |
269 | tr("Right"), AlignRight ); | ||
270 | alignMenu->insertItem( Opie::Core::OResource::loadPixmap("opie-write/justify", Opie::Core::OResource::SmallIcon), | ||
271 | tr("Full"), Qt3::AlignJustify ); | ||
267 | connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); | 272 | connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); |
268 | } | 273 | } |
269 | 274 | ||
270 | Qt3::QTextEdit *MainWindow::currentEditor() const | 275 | Qt3::QTextEdit *MainWindow::currentEditor() const |
271 | { | 276 | { |
272 | return editor; | 277 | return editor; |
273 | } | 278 | } |
274 | 279 | ||
275 | void MainWindow::doConnections( Qt3::QTextEdit *e ) | 280 | void MainWindow::doConnections( Qt3::QTextEdit *e ) |
276 | { | 281 | { |
277 | connect( e, SIGNAL( currentFontChanged(const QFont&) ), | 282 | connect( e, SIGNAL( currentFontChanged(const QFont&) ), |
278 | this, SLOT( fontChanged(const QFont&) ) ); | 283 | this, SLOT( fontChanged(const QFont&) ) ); |
279 | connect( e, SIGNAL( currentColorChanged(const QColor&) ), | 284 | connect( e, SIGNAL( currentColorChanged(const QColor&) ), |
280 | this, SLOT( colorChanged(const QColor&) ) ); | 285 | this, SLOT( colorChanged(const QColor&) ) ); |
281 | connect( e, SIGNAL( currentAlignmentChanged(int) ), | 286 | connect( e, SIGNAL( currentAlignmentChanged(int) ), |
282 | this, SLOT( alignmentChanged(int) ) ); | 287 | this, SLOT( alignmentChanged(int) ) ); |