summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index ed95e83..bcafd16 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -2,48 +2,50 @@
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** Licensees holding valid Qtopia Developer license may use this 6** Licensees holding valid Qtopia Developer license may use this
7** file in accordance with the Qtopia Developer License Agreement 7** file in accordance with the Qtopia Developer License Agreement
8** provided with the Software. 8** provided with the Software.
9** 9**
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#include <qpe/fileselector.h> 23#include <qpe/fileselector.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/fontdatabase.h>
27
26//#include "qspellchecker.h" 28//#include "qspellchecker.h"
27#include "qtextedit.h" 29#include "qtextedit.h"
28#include <qaction.h> 30#include <qaction.h>
29#include <qtoolbar.h> 31#include <qtoolbar.h>
30#include <qtoolbutton.h> 32#include <qtoolbutton.h>
31#include <qtabwidget.h> 33#include <qtabwidget.h>
32#include <qapplication.h> 34#include <qapplication.h>
33#include <qfontdatabase.h> 35#include <qfontdatabase.h>
34#include <qcombobox.h> 36#include <qcombobox.h>
35#include <qlineedit.h> 37#include <qlineedit.h>
36#include <qfileinfo.h> 38#include <qfileinfo.h>
37#include <qfile.h> 39#include <qfile.h>
38#include <qfiledialog.h> 40#include <qfiledialog.h>
39#include <qprinter.h> 41#include <qprinter.h>
40#include <qpaintdevicemetrics.h> 42#include <qpaintdevicemetrics.h>
41#include <qmenubar.h> 43#include <qmenubar.h>
42#include <qpopupmenu.h> 44#include <qpopupmenu.h>
43#include <qcolordialog.h> 45#include <qcolordialog.h>
44#include <qpainter.h> 46#include <qpainter.h>
45#include <qstyle.h> 47#include <qstyle.h>
46 48
47class ButtonMenu : public QToolButton 49class ButtonMenu : public QToolButton
48{ 50{
49 Q_OBJECT 51 Q_OBJECT
@@ -187,53 +189,55 @@ void MainWindow::setupActions()
187 189
188 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"), 190 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"),
189 QString::null, 0, this, "editCopy" ); 191 QString::null, 0, this, "editCopy" );
190 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 192 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
191 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); 193 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
192 a->addTo( tbEdit ); 194 a->addTo( tbEdit );
193 a->addTo( edit ); 195 a->addTo( edit );
194 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"), 196 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"),
195 QString::null, 0, this, "editCut" ); 197 QString::null, 0, this, "editCut" );
196 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
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( "Paste" ), Resource::loadPixmap("paste"), 202 a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"),
201 QString::null, 0, this, "editPaste" ); 203 QString::null, 0, this, "editPaste" );
202 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 204 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
203 a->addTo( tbEdit ); 205 a->addTo( tbEdit );
204 a->addTo( edit ); 206 a->addTo( edit );
205 207
206 tbFont = new QToolBar( this ); 208 tbFont = new QToolBar( this );
207 tbFont->setLabel( "Font Actions" ); 209 tbFont->setLabel( "Font Actions" );
208 tbFont->setHorizontalStretchable(TRUE); 210 tbFont->setHorizontalStretchable(TRUE);
209 211
210 comboFont = new QComboBox( FALSE, tbFont ); 212 comboFont = new QComboBox( FALSE, tbFont );
211 QFontDatabase db; 213 FontDatabase db;
214 QStringList f= db.families();
212 comboFont->insertStringList( db.families() ); 215 comboFont->insertStringList( db.families() );
213 connect( comboFont, SIGNAL( activated( const QString & ) ), 216 connect( comboFont, SIGNAL( activated( const QString & ) ),
214 this, SLOT( textFamily( const QString & ) ) ); 217 this, SLOT( textFamily( const QString & ) ) );
215 comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) ); 218 comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) );
219 comboFont->setMaximumWidth(90);
216 220
217 comboSize = new QComboBox( TRUE, tbFont ); 221 comboSize = new QComboBox( TRUE, tbFont );
218 QValueList<int> sizes = db.standardSizes(); 222 QValueList<int> sizes = db.standardSizes();
219 QValueList<int>::Iterator it = sizes.begin(); 223 QValueList<int>::Iterator it = sizes.begin();
220 for ( ; it != sizes.end(); ++it ) 224 for ( ; it != sizes.end(); ++it )
221 comboSize->insertItem( QString::number( *it ) ); 225 comboSize->insertItem( QString::number( *it ) );
222 connect( comboSize, SIGNAL( activated( const QString & ) ), 226 connect( comboSize, SIGNAL( activated( const QString & ) ),
223 this, SLOT( textSize( const QString & ) ) ); 227 this, SLOT( textSize( const QString & ) ) );
224 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); 228 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
225 comboSize->setFixedWidth( 38 ); 229 comboSize->setFixedWidth( 38 );
226 230
227 tbStyle = new QToolBar( this ); 231 tbStyle = new QToolBar( this );
228 tbStyle->setLabel( "Style Actions" ); 232 tbStyle->setLabel( "Style Actions" );
229 233
230 actionTextBold = new QAction( tr( "Bold" ), 234 actionTextBold = new QAction( tr( "Bold" ),
231 Resource::loadPixmap("bold"), 235 Resource::loadPixmap("bold"),
232 QString::null, CTRL + Key_B, 236 QString::null, CTRL + Key_B,
233 this, "textBold" ); 237 this, "textBold" );
234 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); 238 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
235 actionTextBold->addTo( tbStyle ); 239 actionTextBold->addTo( tbStyle );
236 actionTextBold->setToggleAction( TRUE ); 240 actionTextBold->setToggleAction( TRUE );
237 actionTextItalic = new QAction( tr( "Italic" ), 241 actionTextItalic = new QAction( tr( "Italic" ),
238 Resource::loadPixmap("italic"), 242 Resource::loadPixmap("italic"),
239 tr( "&Italic" ), CTRL + Key_I, 243 tr( "&Italic" ), CTRL + Key_I,
@@ -256,49 +260,49 @@ void MainWindow::setupActions()
256 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter ); 260 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter );
257 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight ); 261 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight );
258 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify ); 262 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify );
259 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); 263 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) );
260} 264}
261 265
262Qt3::QTextEdit *MainWindow::currentEditor() const 266Qt3::QTextEdit *MainWindow::currentEditor() const
263{ 267{
264 return editor; 268 return editor;
265} 269}
266 270
267void MainWindow::doConnections( Qt3::QTextEdit *e ) 271void MainWindow::doConnections( Qt3::QTextEdit *e )
268{ 272{
269 connect( e, SIGNAL( currentFontChanged( const QFont & ) ), 273 connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
270 this, SLOT( fontChanged( const QFont & ) ) ); 274 this, SLOT( fontChanged( const QFont & ) ) );
271 connect( e, SIGNAL( currentColorChanged( const QColor & ) ), 275 connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
272 this, SLOT( colorChanged( const QColor & ) ) ); 276 this, SLOT( colorChanged( const QColor & ) ) );
273 connect( e, SIGNAL( currentAlignmentChanged( int ) ), 277 connect( e, SIGNAL( currentAlignmentChanged( int ) ),
274 this, SLOT( alignmentChanged( int ) ) ); 278 this, SLOT( alignmentChanged( int ) ) );
275} 279}
276 280
277void MainWindow::updateFontSizeCombo( const QFont &f ) 281void MainWindow::updateFontSizeCombo( const QFont &f )
278{ 282{
279 comboSize->clear(); 283 comboSize->clear();
280 QFontDatabase fdb; 284 FontDatabase fdb;
281 QValueList<int> sizes = fdb.pointSizes( f.family() ); 285 QValueList<int> sizes = fdb.pointSizes( f.family() );
282 QValueList<int>::Iterator it = sizes.begin(); 286 QValueList<int>::Iterator it = sizes.begin();
283 for ( ; it != sizes.end(); ++it ) 287 for ( ; it != sizes.end(); ++it )
284 comboSize->insertItem( QString::number( *it ) ); 288 comboSize->insertItem( QString::number( *it ) );
285} 289}
286 290
287void MainWindow::editUndo() 291void MainWindow::editUndo()
288{ 292{
289 if ( !currentEditor() ) 293 if ( !currentEditor() )
290 return; 294 return;
291 currentEditor()->undo(); 295 currentEditor()->undo();
292} 296}
293 297
294void MainWindow::editRedo() 298void MainWindow::editRedo()
295{ 299{
296 if ( !currentEditor() ) 300 if ( !currentEditor() )
297 return; 301 return;
298 currentEditor()->redo(); 302 currentEditor()->redo();
299} 303}
300 304
301void MainWindow::editCut() 305void MainWindow::editCut()
302{ 306{
303 if ( !currentEditor() ) 307 if ( !currentEditor() )
304 return; 308 return;