summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-write/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-write/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index 6bb524f..90e1a70 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -30,345 +30,345 @@
30#include <qaction.h> 30#include <qaction.h>
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qfontdatabase.h> 35#include <qfontdatabase.h>
36#include <qcombobox.h> 36#include <qcombobox.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qfileinfo.h> 38#include <qfileinfo.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qfiledialog.h> 40#include <qfiledialog.h>
41#include <qprinter.h> 41#include <qprinter.h>
42#include <qpaintdevicemetrics.h> 42#include <qpaintdevicemetrics.h>
43#include <qmenubar.h> 43#include <qmenubar.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qcolordialog.h> 45#include <qcolordialog.h>
46#include <qpainter.h> 46#include <qpainter.h>
47#include <qstyle.h> 47#include <qstyle.h>
48 48
49class ButtonMenu : public QToolButton 49class ButtonMenu : public QToolButton
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52public: 52public:
53 ButtonMenu( QWidget *parent, const char *name=0 ) 53 ButtonMenu( QWidget *parent, const char *name=0 )
54 : QToolButton( parent, name ), current(0) 54 : QToolButton( parent, name ), current(0)
55 { 55 {
56 setPopup( new QPopupMenu( this ) ); 56 setPopup( new QPopupMenu( this ) );
57 setPopupDelay( 1 ); 57 setPopupDelay( 1 );
58 connect( popup(), SIGNAL(activated(int)), this, SLOT(selected(int)) ); 58 connect( popup(), SIGNAL(activated(int)), this, SLOT(selected(int)) );
59 } 59 }
60 60
61 int insertItem(const QIconSet &icon, const QString &text, int id ) { 61 int insertItem(const QIconSet &icon, const QString &text, int id ) {
62 if ( !popup()->count() ) { 62 if ( !popup()->count() ) {
63 setIconSet( icon ); 63 setIconSet( icon );
64 current = id; 64 current = id;
65 } 65 }
66 return popup()->insertItem( icon, text, id ); 66 return popup()->insertItem( icon, text, id );
67 } 67 }
68 68
69 void setCurrentItem( int id ) { 69 void setCurrentItem( int id ) {
70 if ( id != current ) { 70 if ( id != current ) {
71 current = id; 71 current = id;
72 setIconSet( *popup()->iconSet( id ) ); 72 setIconSet( *popup()->iconSet( id ) );
73 } 73 }
74 } 74 }
75 75
76 virtual QSize sizeHint() const { 76 virtual QSize sizeHint() const {
77 return QToolButton::sizeHint() + QSize( 4, 0 ); 77 return QToolButton::sizeHint() + QSize( 4, 0 );
78 } 78 }
79 79
80signals: 80signals:
81 void activated( int id ); 81 void activated( int id );
82 82
83protected slots: 83protected slots:
84 void selected( int id ) { 84 void selected( int id ) {
85 current = id; 85 current = id;
86 setIconSet( *popup()->iconSet( id ) ); 86 setIconSet( *popup()->iconSet( id ) );
87 emit activated( id ); 87 emit activated( id );
88 } 88 }
89 89
90protected: 90protected:
91 virtual void drawButtonLabel( QPainter *p ) { 91 virtual void drawButtonLabel( QPainter *p ) {
92 p->translate( -4, 0 ); 92 p->translate( -4, 0 );
93 QToolButton::drawButtonLabel( p ); 93 QToolButton::drawButtonLabel( p );
94 p->translate( 4, 0 ); 94 p->translate( 4, 0 );
95 } 95 }
96 96
97private: 97private:
98 int current; 98 int current;
99}; 99};
100 100
101//=========================================================================== 101//===========================================================================
102 102
103MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) 103MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
104 : QMainWindow( parent, name, fl ), 104 : QMainWindow( parent, name, fl ),
105 doc( 0 ) 105 doc( 0 )
106{ 106{
107 setRightJustification(TRUE); 107 setRightJustification(TRUE);
108 108
109 editorStack = new QWidgetStack( this ); 109 editorStack = new QWidgetStack( this );
110 110
111 fileSelector = new FileSelector( "text/html", 111 fileSelector = new FileSelector( "text/html",
112 editorStack, "fileselector" ); 112 editorStack, "fileselector" );
113 113
114 114
115 fileSelector->setCloseVisible( FALSE ); 115 fileSelector->setCloseVisible( FALSE );
116 editorStack->addWidget( fileSelector, 0 ); 116 editorStack->addWidget( fileSelector, 0 );
117 117
118 editor = new Qt3::QTextEdit( editorStack ); 118 editor = new Qt3::QTextEdit( editorStack );
119 editor->setTextFormat( Qt::RichText ); 119 editor->setTextFormat( Qt::RichText );
120 editorStack->addWidget( editor, 1 ); 120 editorStack->addWidget( editor, 1 );
121 121
122 setupActions(); 122 setupActions();
123 123
124 QObject::connect( fileSelector, SIGNAL(closeMe()), 124 QObject::connect( fileSelector, SIGNAL(closeMe()),
125 this, SLOT(showEditTools()) ); 125 this, SLOT(showEditTools()) );
126 QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk &)), 126 QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk&)),
127 this, SLOT(openFile(const DocLnk &)) ); 127 this, SLOT(openFile(const DocLnk&)) );
128 QObject::connect( fileSelector, SIGNAL(newSelected(const DocLnk&)), 128 QObject::connect( fileSelector, SIGNAL(newSelected(const DocLnk&)),
129 this, SLOT(newFile(const DocLnk&)) ); 129 this, SLOT(newFile(const DocLnk&)) );
130 130
131 if ( fileSelector->fileCount() < 1 ) 131 if ( fileSelector->fileCount() < 1 )
132 fileNew(); 132 fileNew();
133 else { 133 else {
134 fileOpen(); 134 fileOpen();
135 } 135 }
136 doConnections( editor ); 136 doConnections( editor );
137 137
138 setCentralWidget( editorStack ); 138 setCentralWidget( editorStack );
139} 139}
140 140
141MainWindow::~MainWindow() 141MainWindow::~MainWindow()
142{ 142{
143 save(); 143 save();
144} 144}
145 145
146void MainWindow::setupActions() 146void MainWindow::setupActions()
147{ 147{
148 setToolBarsMovable(false); 148 setToolBarsMovable(false);
149 149
150 tbMenu = new QToolBar( this ); 150 tbMenu = new QToolBar( this );
151 tbMenu->setHorizontalStretchable( TRUE ); 151 tbMenu->setHorizontalStretchable( TRUE );
152 152
153 QMenuBar *menu = new QMenuBar( tbMenu ); 153 QMenuBar *menu = new QMenuBar( tbMenu );
154 154
155 tbEdit = new QToolBar( this ); 155 tbEdit = new QToolBar( this );
156 156
157 QPopupMenu *file = new QPopupMenu( this ); 157 QPopupMenu *file = new QPopupMenu( this );
158 menu->insertItem( tr("File"), file ); 158 menu->insertItem( tr("File"), file );
159 159
160 QPopupMenu *edit = new QPopupMenu( this ); 160 QPopupMenu *edit = new QPopupMenu( this );
161 menu->insertItem( tr("Edit"), edit ); 161 menu->insertItem( tr("Edit"), edit );
162 162
163 // ### perhaps these shortcut keys should have some 163 // ### perhaps these shortcut keys should have some
164 // IPaq keys defined??? 164 // IPaq keys defined???
165 QAction *a; 165 QAction *a;
166 166
167 a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 ); 167 a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 );
168 connect( a, SIGNAL(activated()), this, SLOT(fileNew()) ); 168 connect( a, SIGNAL(activated()), this, SLOT(fileNew()) );
169 a->addTo( file ); 169 a->addTo( file );
170 170
171 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 171 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
172 connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) ); 172 connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) );
173 a->addTo( file ); 173 a->addTo( file );
174 174
175 a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"), 175 a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"),
176 QString::null, 0, this, "editUndo" ); 176 QString::null, 0, this, "editUndo" );
177 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); 177 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
178 connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) ); 178 connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) );
179 a->addTo( tbEdit ); 179 a->addTo( tbEdit );
180 a->addTo( edit ); 180 a->addTo( edit );
181 a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"), 181 a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"),
182 QString::null, 0, this, "editRedo" ); 182 QString::null, 0, this, "editRedo" );
183 connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); 183 connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
184 connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) ); 184 connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) );
185 a->addTo( tbEdit ); 185 a->addTo( tbEdit );
186 a->addTo( edit ); 186 a->addTo( edit );
187 187
188 edit->insertSeparator(); 188 edit->insertSeparator();
189 189
190 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"), 190 a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"),
191 QString::null, 0, this, "editCopy" ); 191 QString::null, 0, this, "editCopy" );
192 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 192 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
193 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); 193 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
194 a->addTo( tbEdit ); 194 a->addTo( tbEdit );
195 a->addTo( edit ); 195 a->addTo( edit );
196 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"), 196 a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"),
197 QString::null, 0, this, "editCut" ); 197 QString::null, 0, this, "editCut" );
198 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
199 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); 199 connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
200 a->addTo( tbEdit ); 200 a->addTo( tbEdit );
201 a->addTo( edit ); 201 a->addTo( edit );
202 a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"), 202 a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"),
203 QString::null, 0, this, "editPaste" ); 203 QString::null, 0, this, "editPaste" );
204 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 204 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
205 a->addTo( tbEdit ); 205 a->addTo( tbEdit );
206 a->addTo( edit ); 206 a->addTo( edit );
207 207
208 tbFont = new QToolBar( this ); 208 tbFont = new QToolBar( this );
209 tbFont->setLabel( "Font Actions" ); 209 tbFont->setLabel( "Font Actions" );
210 tbFont->setHorizontalStretchable(TRUE); 210 tbFont->setHorizontalStretchable(TRUE);
211 211
212 comboFont = new QComboBox( FALSE, tbFont ); 212 comboFont = new QComboBox( FALSE, tbFont );
213 FontDatabase db; 213 FontDatabase db;
214 QStringList f= db.families(); 214 QStringList f= db.families();
215 comboFont->insertStringList( db.families() ); 215 comboFont->insertStringList( db.families() );
216 connect( comboFont, SIGNAL( activated( const QString & ) ), 216 connect( comboFont, SIGNAL( activated(const QString&) ),
217 this, SLOT( textFamily( const QString & ) ) ); 217 this, SLOT( textFamily(const QString&) ) );
218 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); 219 comboFont->setMaximumWidth(90);
220 220
221 comboSize = new QComboBox( TRUE, tbFont ); 221 comboSize = new QComboBox( TRUE, tbFont );
222 QValueList<int> sizes = db.standardSizes(); 222 QValueList<int> sizes = db.standardSizes();
223 QValueList<int>::Iterator it = sizes.begin(); 223 QValueList<int>::Iterator it = sizes.begin();
224 for ( ; it != sizes.end(); ++it ) 224 for ( ; it != sizes.end(); ++it )
225 comboSize->insertItem( QString::number( *it ) ); 225 comboSize->insertItem( QString::number( *it ) );
226 connect( comboSize, SIGNAL( activated( const QString & ) ), 226 connect( comboSize, SIGNAL( activated(const QString&) ),
227 this, SLOT( textSize( const QString & ) ) ); 227 this, SLOT( textSize(const QString&) ) );
228 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); 228 comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
229 comboSize->setFixedWidth( 38 ); 229 comboSize->setFixedWidth( 38 );
230 230
231 tbStyle = new QToolBar( this ); 231 tbStyle = new QToolBar( this );
232 tbStyle->setLabel( "Style Actions" ); 232 tbStyle->setLabel( "Style Actions" );
233 233
234 actionTextBold = new QAction( tr( "Bold" ), 234 actionTextBold = new QAction( tr( "Bold" ),
235 Resource::loadPixmap("bold"), 235 Resource::loadPixmap("bold"),
236 QString::null, CTRL + Key_B, 236 QString::null, CTRL + Key_B,
237 this, "textBold" ); 237 this, "textBold" );
238 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); 238 connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
239 actionTextBold->addTo( tbStyle ); 239 actionTextBold->addTo( tbStyle );
240 actionTextBold->setToggleAction( TRUE ); 240 actionTextBold->setToggleAction( TRUE );
241 actionTextItalic = new QAction( tr( "Italic" ), 241 actionTextItalic = new QAction( tr( "Italic" ),
242 Resource::loadPixmap("italic"), 242 Resource::loadPixmap("italic"),
243 tr( "&Italic" ), CTRL + Key_I, 243 tr( "&Italic" ), CTRL + Key_I,
244 this, "textItalic" ); 244 this, "textItalic" );
245 connect( actionTextItalic, SIGNAL( activated() ), this, 245 connect( actionTextItalic, SIGNAL( activated() ), this,
246 SLOT( textItalic() ) ); 246 SLOT( textItalic() ) );
247 actionTextItalic->addTo( tbStyle ); 247 actionTextItalic->addTo( tbStyle );
248 actionTextItalic->setToggleAction( TRUE ); 248 actionTextItalic->setToggleAction( TRUE );
249 actionTextUnderline = new QAction( tr( "Underline" ), 249 actionTextUnderline = new QAction( tr( "Underline" ),
250 Resource::loadPixmap("underline"), 250 Resource::loadPixmap("underline"),
251 tr( "&Underline" ), CTRL + Key_U, 251 tr( "&Underline" ), CTRL + Key_U,
252 this, "textUnderline" ); 252 this, "textUnderline" );
253 connect( actionTextUnderline, SIGNAL( activated() ), 253 connect( actionTextUnderline, SIGNAL( activated() ),
254 this, SLOT( textUnderline() ) ); 254 this, SLOT( textUnderline() ) );
255 actionTextUnderline->addTo( tbStyle ); 255 actionTextUnderline->addTo( tbStyle );
256 actionTextUnderline->setToggleAction( TRUE ); 256 actionTextUnderline->setToggleAction( TRUE );
257 257
258 alignMenu = new ButtonMenu( tbStyle ); 258 alignMenu = new ButtonMenu( tbStyle );
259 alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft ); 259 alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft );
260 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter ); 260 alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter );
261 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight ); 261 alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight );
262 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify ); 262 alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify );
263 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); 263 connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) );
264} 264}
265 265
266Qt3::QTextEdit *MainWindow::currentEditor() const 266Qt3::QTextEdit *MainWindow::currentEditor() const
267{ 267{
268 return editor; 268 return editor;
269} 269}
270 270
271void MainWindow::doConnections( Qt3::QTextEdit *e ) 271void MainWindow::doConnections( Qt3::QTextEdit *e )
272{ 272{
273 connect( e, SIGNAL( currentFontChanged( const QFont & ) ), 273 connect( e, SIGNAL( currentFontChanged(const QFont&) ),
274 this, SLOT( fontChanged( const QFont & ) ) ); 274 this, SLOT( fontChanged(const QFont&) ) );
275 connect( e, SIGNAL( currentColorChanged( const QColor & ) ), 275 connect( e, SIGNAL( currentColorChanged(const QColor&) ),
276 this, SLOT( colorChanged( const QColor & ) ) ); 276 this, SLOT( colorChanged(const QColor&) ) );
277 connect( e, SIGNAL( currentAlignmentChanged( int ) ), 277 connect( e, SIGNAL( currentAlignmentChanged(int) ),
278 this, SLOT( alignmentChanged( int ) ) ); 278 this, SLOT( alignmentChanged(int) ) );
279} 279}
280 280
281void MainWindow::updateFontSizeCombo( const QFont &f ) 281void MainWindow::updateFontSizeCombo( const QFont &f )
282{ 282{
283 comboSize->clear(); 283 comboSize->clear();
284 FontDatabase fdb; 284 FontDatabase fdb;
285 QValueList<int> sizes = fdb.pointSizes( f.family() ); 285 QValueList<int> sizes = fdb.pointSizes( f.family() );
286 QValueList<int>::Iterator it = sizes.begin(); 286 QValueList<int>::Iterator it = sizes.begin();
287 for ( ; it != sizes.end(); ++it ) 287 for ( ; it != sizes.end(); ++it )
288 comboSize->insertItem( QString::number( *it ) ); 288 comboSize->insertItem( QString::number( *it ) );
289} 289}
290 290
291void MainWindow::editUndo() 291void MainWindow::editUndo()
292{ 292{
293 if ( !currentEditor() ) 293 if ( !currentEditor() )
294 return; 294 return;
295 currentEditor()->undo(); 295 currentEditor()->undo();
296} 296}
297 297
298void MainWindow::editRedo() 298void MainWindow::editRedo()
299{ 299{
300 if ( !currentEditor() ) 300 if ( !currentEditor() )
301 return; 301 return;
302 currentEditor()->redo(); 302 currentEditor()->redo();
303} 303}
304 304
305void MainWindow::editCut() 305void MainWindow::editCut()
306{ 306{
307 if ( !currentEditor() ) 307 if ( !currentEditor() )
308 return; 308 return;
309 currentEditor()->cut(); 309 currentEditor()->cut();
310} 310}
311 311
312void MainWindow::editCopy() 312void MainWindow::editCopy()
313{ 313{
314 if ( !currentEditor() ) 314 if ( !currentEditor() )
315 return; 315 return;
316 currentEditor()->copy(); 316 currentEditor()->copy();
317} 317}
318 318
319void MainWindow::editPaste() 319void MainWindow::editPaste()
320{ 320{
321 if ( !currentEditor() ) 321 if ( !currentEditor() )
322 return; 322 return;
323 currentEditor()->paste(); 323 currentEditor()->paste();
324} 324}
325 325
326void MainWindow::textBold() 326void MainWindow::textBold()
327{ 327{
328 if ( !currentEditor() ) 328 if ( !currentEditor() )
329 return; 329 return;
330 currentEditor()->setBold( actionTextBold->isOn() ); 330 currentEditor()->setBold( actionTextBold->isOn() );
331} 331}
332 332
333void MainWindow::textUnderline() 333void MainWindow::textUnderline()
334{ 334{
335 if ( !currentEditor() ) 335 if ( !currentEditor() )
336 return; 336 return;
337 currentEditor()->setUnderline( actionTextUnderline->isOn() ); 337 currentEditor()->setUnderline( actionTextUnderline->isOn() );
338} 338}
339 339
340void MainWindow::textItalic() 340void MainWindow::textItalic()
341{ 341{
342 if ( !currentEditor() ) 342 if ( !currentEditor() )
343 return; 343 return;
344 currentEditor()->setItalic( actionTextItalic->isOn() ); 344 currentEditor()->setItalic( actionTextItalic->isOn() );
345} 345}
346 346
347void MainWindow::textFamily( const QString &f ) 347void MainWindow::textFamily( const QString &f )
348{ 348{
349 if ( !currentEditor() ) 349 if ( !currentEditor() )
350 return; 350 return;
351 currentEditor()->setFamily( f ); 351 currentEditor()->setFamily( f );
352 currentEditor()->viewport()->setFocus(); 352 currentEditor()->viewport()->setFocus();
353} 353}
354 354
355void MainWindow::textSize( const QString &p ) 355void MainWindow::textSize( const QString &p )
356{ 356{
357 if ( !currentEditor() ) 357 if ( !currentEditor() )
358 return; 358 return;
359 currentEditor()->setPointSize( p.toInt() ); 359 currentEditor()->setPointSize( p.toInt() );
360 currentEditor()->viewport()->setFocus(); 360 currentEditor()->viewport()->setFocus();
361} 361}
362 362
363void MainWindow::textStyle( int i ) 363void MainWindow::textStyle( int i )
364{ 364{
365 if ( !currentEditor() ) 365 if ( !currentEditor() )
366 return; 366 return;
367 if ( i == 0 ) 367 if ( i == 0 )
368 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayBlock, 368 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayBlock,
369 Qt3::QStyleSheetItem::ListDisc ); 369 Qt3::QStyleSheetItem::ListDisc );
370 else if ( i == 1 ) 370 else if ( i == 1 )
371 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayListItem, 371 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayListItem,
372 Qt3::QStyleSheetItem::ListDisc ); 372 Qt3::QStyleSheetItem::ListDisc );
373 else if ( i == 2 ) 373 else if ( i == 2 )
374 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayListItem, 374 currentEditor()->setParagType( Qt3::QStyleSheetItem::DisplayListItem,