compile
[kdegraphics.git] / okular / ui / annotationwidgets.cpp
blob39553ba547b1839558ca3a46fff1b8cd79bf1fc1
1 /***************************************************************************
2 * Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #include "annotationwidgets.h"
12 // qt/kde includes
13 #include <qcheckbox.h>
14 #include <qgroupbox.h>
15 #include <qlabel.h>
16 #include <qlayout.h>
17 #include <qspinbox.h>
18 #include <qvariant.h>
19 #include <kcolorbutton.h>
20 #include <kcombobox.h>
21 #include <kfontrequester.h>
22 #include <kicon.h>
23 #include <kiconloader.h>
24 #include <klocale.h>
25 #include <kdebug.h>
27 #include "core/document.h"
28 #include "guiutils.h"
30 #define FILEATTACH_ICONSIZE 48
32 PixmapPreviewSelector::PixmapPreviewSelector( QWidget * parent )
33 : QWidget( parent )
35 QHBoxLayout * mainlay = new QHBoxLayout( this );
36 mainlay->setMargin( 0 );
37 m_comboItems = new KComboBox( this );
38 mainlay->addWidget( m_comboItems );
39 m_iconLabel = new QLabel( this );
40 mainlay->addWidget( m_iconLabel );
41 m_iconLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
42 m_iconLabel->setAlignment( Qt::AlignCenter );
43 m_iconLabel->setFrameStyle( QFrame::StyledPanel );
44 setPreviewSize( 32 );
46 connect( m_comboItems, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( iconComboChanged( const QString& ) ) );
47 connect( m_comboItems, SIGNAL( editTextChanged( const QString& ) ), this, SLOT( iconComboChanged( const QString& ) ) );
50 PixmapPreviewSelector::~PixmapPreviewSelector()
54 void PixmapPreviewSelector::setIcon( const QString& icon )
56 int id = m_comboItems->findData( QVariant( icon ), Qt::UserRole, Qt::MatchFixedString );
57 if ( id == -1 )
58 id = m_comboItems->findText( icon, Qt::MatchFixedString );
59 if ( id > -1 )
61 m_comboItems->setCurrentIndex( id );
63 else if ( m_comboItems->isEditable() )
65 m_comboItems->addItem( icon, QVariant( icon ) );
66 m_comboItems->setCurrentIndex( m_comboItems->findText( icon, Qt::MatchFixedString ) );
70 QString PixmapPreviewSelector::icon() const
72 return m_icon;
75 void PixmapPreviewSelector::addItem( const QString& item, const QString& id )
77 m_comboItems->addItem( item, QVariant( id ) );
78 setIcon( m_icon );
81 void PixmapPreviewSelector::setPreviewSize( int size )
83 m_previewSize = size;
84 m_iconLabel->setFixedSize( m_previewSize + 8, m_previewSize + 8 );
85 iconComboChanged( m_icon );
88 int PixmapPreviewSelector::previewSize() const
90 return m_previewSize;
93 void PixmapPreviewSelector::setEditable( bool editable )
95 m_comboItems->setEditable( editable );
98 void PixmapPreviewSelector::iconComboChanged( const QString& icon )
100 int id = m_comboItems->findText( icon, Qt::MatchFixedString );
101 if ( id >= 0 )
103 m_icon = m_comboItems->itemData( id ).toString();
105 else
107 m_icon = icon;
110 QPixmap pixmap = GuiUtils::loadStamp( m_icon, QSize(), m_previewSize );
111 const QRect cr = m_iconLabel->contentsRect();
112 if ( pixmap.width() > cr.width() || pixmap.height() > cr.height() )
113 pixmap = pixmap.scaled( cr.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation );
114 m_iconLabel->setPixmap( pixmap );
116 emit iconChanged( m_icon );
120 AnnotationWidget * AnnotationWidgetFactory::widgetFor( Okular::Annotation * ann )
122 switch ( ann->subType() )
124 case Okular::Annotation::AStamp:
125 return new StampAnnotationWidget( ann );
126 break;
127 case Okular::Annotation::AText:
128 return new TextAnnotationWidget( ann );
129 break;
130 case Okular::Annotation::ALine:
131 return new LineAnnotationWidget( ann );
132 break;
133 case Okular::Annotation::AHighlight:
134 return new HighlightAnnotationWidget( ann );
135 break;
136 case Okular::Annotation::AGeom:
137 return new GeomAnnotationWidget( ann );
138 break;
139 case Okular::Annotation::AFileAttachment:
140 return new FileAttachmentAnnotationWidget( ann );
141 break;
142 case Okular::Annotation::ACaret:
143 return new CaretAnnotationWidget( ann );
144 break;
145 // shut up gcc
146 default:
149 // cases not covered yet
150 return 0;
154 AnnotationWidget::AnnotationWidget( Okular::Annotation * ann )
155 : QObject(), m_ann( ann ), m_styleWidget( 0 ), m_extraWidget( 0 )
159 AnnotationWidget::~AnnotationWidget()
163 Okular::Annotation::SubType AnnotationWidget::annotationType() const
165 return m_ann->subType();
168 QWidget * AnnotationWidget::styleWidget()
170 if ( m_styleWidget )
171 return m_styleWidget;
173 m_styleWidget = createStyleWidget();
174 return m_styleWidget;
177 QWidget * AnnotationWidget::extraWidget()
179 if ( m_extraWidget )
180 return m_extraWidget;
182 m_extraWidget = createExtraWidget();
183 return m_extraWidget;
186 QWidget * AnnotationWidget::createExtraWidget()
188 return 0;
192 TextAnnotationWidget::TextAnnotationWidget( Okular::Annotation * ann )
193 : AnnotationWidget( ann ), m_pixmapSelector( 0 )
195 m_textAnn = static_cast< Okular::TextAnnotation * >( ann );
198 QWidget * TextAnnotationWidget::createStyleWidget()
200 QWidget * widget = new QWidget();
201 QVBoxLayout * lay = new QVBoxLayout( widget );
202 lay->setMargin( 0 );
204 if ( m_textAnn->textType() == Okular::TextAnnotation::Linked )
206 QGroupBox * gb = new QGroupBox( widget );
207 lay->addWidget( gb );
208 gb->setTitle( i18n( "Icon" ) );
209 QHBoxLayout * gblay = new QHBoxLayout( gb );
210 m_pixmapSelector = new PixmapPreviewSelector( gb );
211 gblay->addWidget( m_pixmapSelector );
213 m_pixmapSelector->addItem( i18n( "Comment" ), "Comment" );
214 m_pixmapSelector->addItem( i18n( "Help" ), "Help" );
215 m_pixmapSelector->addItem( i18n( "Insert" ), "Insert" );
216 m_pixmapSelector->addItem( i18n( "Key" ), "Key" );
217 m_pixmapSelector->addItem( i18n( "New Paragraph" ), "NewParagraph" );
218 m_pixmapSelector->addItem( i18n( "Note" ), "Note" );
219 m_pixmapSelector->addItem( i18n( "Paragraph" ), "Paragraph" );
220 m_pixmapSelector->setIcon( m_textAnn->textIcon() );
222 connect( m_pixmapSelector, SIGNAL( iconChanged( const QString& ) ), this, SIGNAL( dataChanged() ) );
225 QHBoxLayout * fontlay = new QHBoxLayout();
226 QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget );
227 fontlay->addWidget( tmplabel );
228 m_fontReq = new KFontRequester( widget );
229 fontlay->addWidget( m_fontReq );
230 lay->addLayout( fontlay );
232 m_fontReq->setFont( m_textAnn->textFont() );
234 connect( m_fontReq, SIGNAL( fontSelected( const QFont& ) ), this, SIGNAL( dataChanged() ) );
236 return widget;
239 void TextAnnotationWidget::applyChanges()
241 if ( m_textAnn->textType() == Okular::TextAnnotation::Linked )
243 m_textAnn->setTextIcon( m_pixmapSelector->icon() );
245 m_textAnn->setTextFont( m_fontReq->font() );
249 StampAnnotationWidget::StampAnnotationWidget( Okular::Annotation * ann )
250 : AnnotationWidget( ann ), m_pixmapSelector( 0 )
252 m_stampAnn = static_cast< Okular::StampAnnotation * >( ann );
255 QWidget * StampAnnotationWidget::createStyleWidget()
257 QWidget * widget = new QWidget();
258 QVBoxLayout * lay = new QVBoxLayout( widget );
259 lay->setMargin( 0 );
260 QGroupBox * gb = new QGroupBox( widget );
261 lay->addWidget( gb );
262 gb->setTitle( i18n( "Stamp Symbol" ) );
263 QHBoxLayout * gblay = new QHBoxLayout( gb );
264 m_pixmapSelector = new PixmapPreviewSelector( gb );
265 gblay->addWidget( m_pixmapSelector );
266 m_pixmapSelector->setEditable( true );
268 m_pixmapSelector->addItem( i18n( "Okular" ), "okular" );
269 m_pixmapSelector->addItem( i18n( "Bookmark" ), "bookmarks" );
270 m_pixmapSelector->addItem( i18n( "KDE" ), "kde" );
271 m_pixmapSelector->addItem( i18n( "Information" ), "help-about" );
272 m_pixmapSelector->addItem( i18n( "Approved" ), "Approved" );
273 m_pixmapSelector->addItem( i18n( "As Is" ), "AsIs" );
274 m_pixmapSelector->addItem( i18n( "Confidential" ), "Confidential" );
275 m_pixmapSelector->addItem( i18n( "Departmental" ), "Departmental" );
276 m_pixmapSelector->addItem( i18n( "Draft" ), "Draft" );
277 m_pixmapSelector->addItem( i18n( "Experimental" ), "Experimental" );
278 m_pixmapSelector->addItem( i18n( "Expired" ), "Expired" );
279 m_pixmapSelector->addItem( i18n( "Final" ), "Final" );
280 m_pixmapSelector->addItem( i18n( "For Comment" ), "ForComment" );
281 m_pixmapSelector->addItem( i18n( "For Public Release" ), "ForPublicRelease" );
282 m_pixmapSelector->addItem( i18n( "Not Approved" ), "NotApproved" );
283 m_pixmapSelector->addItem( i18n( "Not For Public Release" ), "NotForPublicRelease" );
284 m_pixmapSelector->addItem( i18n( "Sold" ), "Sold" );
285 m_pixmapSelector->addItem( i18n( "Top Secret" ), "TopSecret" );
286 m_pixmapSelector->setIcon( m_stampAnn->stampIconName() );
287 m_pixmapSelector->setPreviewSize( 64 );
289 connect( m_pixmapSelector, SIGNAL( iconChanged( const QString& ) ), this, SIGNAL( dataChanged() ) );
291 return widget;
294 void StampAnnotationWidget::applyChanges()
296 m_stampAnn->setStampIconName( m_pixmapSelector->icon() );
301 LineAnnotationWidget::LineAnnotationWidget( Okular::Annotation * ann )
302 : AnnotationWidget( ann )
304 m_lineAnn = static_cast< Okular::LineAnnotation * >( ann );
305 if ( m_lineAnn->linePoints().count() == 2 )
306 m_lineType = 0; // line
307 else if ( m_lineAnn->lineClosed() )
308 m_lineType = 1; // polygon
309 else
310 m_lineType = 2; // polyline
313 QWidget * LineAnnotationWidget::createStyleWidget()
315 QWidget * widget = new QWidget();
316 QVBoxLayout * lay = new QVBoxLayout( widget );
317 lay->setMargin( 0 );
318 if ( m_lineType == 0 )
320 QGroupBox * gb = new QGroupBox( widget );
321 lay->addWidget( gb );
322 gb->setTitle( i18n( "Line Extensions" ) );
323 QGridLayout * gridlay = new QGridLayout( gb );
324 QLabel * tmplabel = new QLabel( i18n( "Leader Line Length:" ), gb );
325 gridlay->addWidget( tmplabel, 0, 0, Qt::AlignRight );
326 m_spinLL = new QDoubleSpinBox( gb );
327 gridlay->addWidget( m_spinLL, 0, 1 );
328 tmplabel->setBuddy( m_spinLL );
329 tmplabel = new QLabel( i18n( "Leader Line Extensions Length:" ), gb );
330 gridlay->addWidget( tmplabel, 1, 0, Qt::AlignRight );
331 m_spinLLE = new QDoubleSpinBox( gb );
332 gridlay->addWidget( m_spinLLE, 1, 1 );
333 tmplabel->setBuddy( m_spinLLE );
336 QGroupBox * gb2 = new QGroupBox( widget );
337 lay->addWidget( gb2 );
338 gb2->setTitle( i18n( "Style" ) );
339 QGridLayout * gridlay2 = new QGridLayout( gb2 );
340 QLabel * tmplabel2 = new QLabel( i18n( "&Size:" ), gb2 );
341 gridlay2->addWidget( tmplabel2, 0, 0, Qt::AlignRight );
342 m_spinSize = new QDoubleSpinBox( gb2 );
343 gridlay2->addWidget( m_spinSize, 0, 1 );
344 tmplabel2->setBuddy( m_spinSize );
346 if ( m_lineType == 0 )
348 m_spinLL->setRange( -500, 500 );
349 m_spinLL->setValue( m_lineAnn->lineLeadingForwardPoint() );
350 m_spinLLE->setRange( 0, 500 );
351 m_spinLLE->setValue( m_lineAnn->lineLeadingBackwardPoint() );
353 m_spinSize->setRange( 1, 100 );
354 m_spinSize->setValue( m_lineAnn->style().width() );
356 if ( m_lineType == 0 )
358 connect( m_spinLL, SIGNAL( valueChanged( double ) ), this, SIGNAL( dataChanged() ) );
359 connect( m_spinLLE, SIGNAL( valueChanged( double ) ), this, SIGNAL( dataChanged() ) );
361 connect( m_spinSize, SIGNAL( valueChanged( double ) ), this, SIGNAL( dataChanged() ) );
363 return widget;
366 void LineAnnotationWidget::applyChanges()
368 if ( m_lineType == 0 )
370 m_lineAnn->setLineLeadingForwardPoint( m_spinLL->value() );
371 m_lineAnn->setLineLeadingBackwardPoint( m_spinLLE->value() );
373 m_lineAnn->style().setWidth( m_spinSize->value() );
378 HighlightAnnotationWidget::HighlightAnnotationWidget( Okular::Annotation * ann )
379 : AnnotationWidget( ann )
381 m_hlAnn = static_cast< Okular::HighlightAnnotation * >( ann );
384 QWidget * HighlightAnnotationWidget::createStyleWidget()
386 QWidget * widget = new QWidget();
387 QVBoxLayout * lay = new QVBoxLayout( widget );
388 lay->setMargin( 0 );
389 QHBoxLayout * typelay = new QHBoxLayout();
390 lay->addLayout( typelay );
391 QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget );
392 typelay->addWidget( tmplabel, 0, Qt::AlignRight );
393 m_typeCombo = new KComboBox( widget );
394 tmplabel->setBuddy( m_typeCombo );
395 typelay->addWidget( m_typeCombo );
397 m_typeCombo->addItem( i18n( "Highlight" ) );
398 m_typeCombo->addItem( i18n( "Squiggly" ) );
399 m_typeCombo->addItem( i18n( "Underline" ) );
400 m_typeCombo->addItem( i18n( "Strike out" ) );
401 m_typeCombo->setCurrentIndex( m_hlAnn->highlightType() );
403 connect( m_typeCombo, SIGNAL( currentIndexChanged ( int ) ), this, SIGNAL( dataChanged() ) );
405 return widget;
408 void HighlightAnnotationWidget::applyChanges()
410 m_hlAnn->setHighlightType( (Okular::HighlightAnnotation::HighlightType)m_typeCombo->currentIndex() );
415 GeomAnnotationWidget::GeomAnnotationWidget( Okular::Annotation * ann )
416 : AnnotationWidget( ann )
418 m_geomAnn = static_cast< Okular::GeomAnnotation * >( ann );
421 QWidget * GeomAnnotationWidget::createStyleWidget()
423 QWidget * widget = new QWidget();
424 QGridLayout * lay = new QGridLayout( widget );
425 lay->setMargin( 0 );
426 QLabel * tmplabel = new QLabel( i18n( "Type:" ), widget );
427 lay->addWidget( tmplabel, 0, 0, Qt::AlignRight );
428 m_typeCombo = new KComboBox( widget );
429 tmplabel->setBuddy( m_typeCombo );
430 lay->addWidget( m_typeCombo, 0, 1 );
431 m_useColor = new QCheckBox( i18n( "Inner color:" ), widget );
432 lay->addWidget( m_useColor, 1, 0 );
433 m_innerColor = new KColorButton( widget );
434 lay->addWidget( m_innerColor, 1, 1 );
435 tmplabel = new QLabel( i18n( "&Size:" ), widget );
436 lay->addWidget( tmplabel, 2, 0, Qt::AlignRight );
437 m_spinSize = new QDoubleSpinBox( widget );
438 lay->addWidget( m_spinSize, 2, 1 );
439 tmplabel->setBuddy( m_spinSize );
441 m_typeCombo->addItem( i18n( "Rectangle" ) );
442 m_typeCombo->addItem( i18n( "Ellipse" ) );
443 m_typeCombo->setCurrentIndex( m_geomAnn->geometricalType() );
444 m_innerColor->setColor( m_geomAnn->geometricalInnerColor() );
445 if ( m_geomAnn->geometricalInnerColor().isValid() )
447 m_useColor->setChecked( true );
449 else
451 m_innerColor->setEnabled( false );
453 m_spinSize->setRange( 0, 100 );
454 m_spinSize->setValue( m_geomAnn->style().width() );
456 connect( m_typeCombo, SIGNAL( currentIndexChanged ( int ) ), this, SIGNAL( dataChanged() ) );
457 connect( m_innerColor, SIGNAL( changed( const QColor & ) ), this, SIGNAL( dataChanged() ) );
458 connect( m_useColor, SIGNAL( toggled( bool ) ), this, SIGNAL( dataChanged() ) );
459 connect( m_useColor, SIGNAL( toggled( bool ) ), m_innerColor, SLOT( setEnabled( bool ) ) );
460 connect( m_spinSize, SIGNAL( valueChanged( double ) ), this, SIGNAL( dataChanged() ) );
462 return widget;
465 void GeomAnnotationWidget::applyChanges()
467 m_geomAnn->setGeometricalType( (Okular::GeomAnnotation::GeomType)m_typeCombo->currentIndex() );
468 if ( !m_useColor->isChecked() )
470 m_geomAnn->setGeometricalInnerColor( QColor() );
472 else
474 m_geomAnn->setGeometricalInnerColor( m_innerColor->color() );
476 m_geomAnn->style().setWidth( m_spinSize->value() );
481 FileAttachmentAnnotationWidget::FileAttachmentAnnotationWidget( Okular::Annotation * ann )
482 : AnnotationWidget( ann ), m_pixmapSelector( 0 )
484 m_attachAnn = static_cast< Okular::FileAttachmentAnnotation * >( ann );
487 QWidget * FileAttachmentAnnotationWidget::createStyleWidget()
489 QWidget * widget = new QWidget();
490 QVBoxLayout * lay = new QVBoxLayout( widget );
491 lay->setMargin( 0 );
492 QGroupBox * gb = new QGroupBox( widget );
493 lay->addWidget( gb );
494 gb->setTitle( i18n( "File Attachment Symbol" ) );
495 QHBoxLayout * gblay = new QHBoxLayout( gb );
496 m_pixmapSelector = new PixmapPreviewSelector( gb );
497 gblay->addWidget( m_pixmapSelector );
498 m_pixmapSelector->setEditable( true );
500 m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Graph" ), "graph" );
501 m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Push Pin" ), "pushpin" );
502 m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Paperclip" ), "paperclip" );
503 m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Tag" ), "tag" );
504 m_pixmapSelector->setIcon( m_attachAnn->fileIconName() );
506 connect( m_pixmapSelector, SIGNAL( iconChanged( const QString& ) ), this, SIGNAL( dataChanged() ) );
508 return widget;
511 QWidget * FileAttachmentAnnotationWidget::createExtraWidget()
513 QWidget * widget = new QWidget();
514 widget->setWindowTitle( i18nc( "'File' as normal file, that can be opened, saved, etc..", "File" ) );
516 Okular::EmbeddedFile *ef = m_attachAnn->embeddedFile();
517 const int size = ef->size();
518 const QString sizeString = size <= 0 ? i18nc( "Not available size", "N/A" ) : KGlobal::locale()->formatByteSize( size );
519 const QString descString = ef->description().isEmpty() ? i18n( "No description available." ) : ef->description();
521 QGridLayout * lay = new QGridLayout( widget );
522 lay->setMargin( 0 );
523 QLabel * tmplabel = new QLabel( i18n( "Name: %1", ef->name() ), widget );
524 tmplabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
525 lay->addWidget( tmplabel, 0, 0 );
527 tmplabel = new QLabel( i18n( "Size: %1", sizeString ), widget );
528 tmplabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
529 lay->addWidget( tmplabel, 1, 0 );
531 tmplabel = new QLabel( i18n( "Description:" ), widget );
532 lay->addWidget( tmplabel, 2, 0 );
533 tmplabel = new QLabel( widget );
534 tmplabel->setTextFormat( Qt::PlainText );
535 tmplabel->setWordWrap( true );
536 tmplabel->setText( descString );
537 tmplabel->setTextInteractionFlags( Qt::TextSelectableByMouse );
538 lay->addWidget( tmplabel, 3, 0, 1, 2 );
540 KMimeType::Ptr mime = KMimeType::findByPath( ef->name(), 0, true );
541 if ( mime )
543 tmplabel = new QLabel( widget );
544 tmplabel->setPixmap( KIcon( mime->iconName() ).pixmap( FILEATTACH_ICONSIZE, FILEATTACH_ICONSIZE ) );
545 tmplabel->setFixedSize( FILEATTACH_ICONSIZE, FILEATTACH_ICONSIZE );
546 lay->addWidget( tmplabel, 0, 1, 3, 1, Qt::AlignTop );
549 lay->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 4, 0 );
551 return widget;
554 void FileAttachmentAnnotationWidget::applyChanges()
556 m_attachAnn->setFileIconName( m_pixmapSelector->icon() );
561 static QString caretSymbolToIcon( Okular::CaretAnnotation::CaretSymbol symbol )
563 switch ( symbol )
565 case Okular::CaretAnnotation::None:
566 return QString::fromLatin1( "caret-none" );
567 case Okular::CaretAnnotation::P:
568 return QString::fromLatin1( "caret-p" );
570 return QString();
573 static Okular::CaretAnnotation::CaretSymbol caretSymbolFromIcon( const QString &icon )
575 if ( icon == QLatin1String( "caret-none" ) )
576 return Okular::CaretAnnotation::None;
577 else if ( icon == QLatin1String( "caret-p" ) )
578 return Okular::CaretAnnotation::P;
579 return Okular::CaretAnnotation::None;
582 CaretAnnotationWidget::CaretAnnotationWidget( Okular::Annotation * ann )
583 : AnnotationWidget( ann ), m_pixmapSelector( 0 )
585 m_caretAnn = static_cast< Okular::CaretAnnotation * >( ann );
588 QWidget * CaretAnnotationWidget::createStyleWidget()
590 QWidget * widget = new QWidget();
591 QVBoxLayout * lay = new QVBoxLayout( widget );
592 lay->setMargin( 0 );
593 QGroupBox * gb = new QGroupBox( widget );
594 lay->addWidget( gb );
595 gb->setTitle( i18n( "Caret Symbol" ) );
596 QHBoxLayout * gblay = new QHBoxLayout( gb );
597 m_pixmapSelector = new PixmapPreviewSelector( gb );
598 gblay->addWidget( m_pixmapSelector );
600 m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "None" ), "caret-none" );
601 m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "P" ), "caret-p" );
602 m_pixmapSelector->setIcon( caretSymbolToIcon( m_caretAnn->caretSymbol() ) );
604 connect( m_pixmapSelector, SIGNAL( iconChanged( const QString& ) ), this, SIGNAL( dataChanged() ) );
606 return widget;
609 void CaretAnnotationWidget::applyChanges()
611 m_caretAnn->setCaretSymbol( caretSymbolFromIcon( m_pixmapSelector->icon() ) );
616 #include "annotationwidgets.moc"