[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/korganizer
From: Mike Arthur <mike () mikearthur ! co ! uk>
Date: 2007-10-31 23:32:50
Message-ID: 1193873570.924246.14793.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 731539 by mikearthur:
Add alignment and strikethrough options to WYSIWYG editor.
M +55 -0 koeditorgeneral.cpp
M +9 -0 koeditorgeneral.h
--- trunk/KDE/kdepim/korganizer/koeditorgeneral.cpp #731538:731539
@@ -188,10 +188,31 @@
mDescriptionUnderlineButton->setIcon( KIcon( "format-text-underline" ) );
connect(mDescriptionUnderlineButton, SIGNAL(clicked()),
this, SLOT(toggleDescriptionUnderline()));
+ mDescriptionStrikethroughButton = new QPushButton( parent );
+ mDescriptionStrikethroughButton->setIcon( KIcon( "format-text-strikethrough" ) );
+ connect(mDescriptionStrikethroughButton, SIGNAL(clicked()),
+ this, SLOT(toggleDescriptionStrikethrough()));
+ mDescriptionLeftAlignButton = new QPushButton( parent );
+ mDescriptionLeftAlignButton->setIcon( KIcon( "format-justify-left" ) );
+ connect(mDescriptionLeftAlignButton, SIGNAL(clicked()),
+ this, SLOT(toggleDescriptionLeftAlign()));
+ mDescriptionCentreAlignButton = new QPushButton( parent );
+ mDescriptionCentreAlignButton->setIcon( KIcon( "format-justify-center" ) );
+ connect(mDescriptionCentreAlignButton, SIGNAL(clicked()),
+ this, SLOT(toggleDescriptionCentreAlign()));
+ mDescriptionRightAlignButton = new QPushButton( parent );
+ mDescriptionRightAlignButton->setIcon( KIcon( "format-justify-right" ) );
+ connect(mDescriptionRightAlignButton, SIGNAL(clicked()),
+ this, SLOT(toggleDescriptionRightAlign()));
htmlLayout->addWidget( mDescriptionBoldButton );
htmlLayout->addWidget( mDescriptionItalicButton );
htmlLayout->addWidget( mDescriptionUnderlineButton );
+ htmlLayout->addWidget( mDescriptionStrikethroughButton );
+ htmlLayout->addWidget( mDescriptionLeftAlignButton );
+ htmlLayout->addWidget( mDescriptionCentreAlignButton );
+ htmlLayout->addWidget( mDescriptionRightAlignButton );
htmlLayout->addStretch();
+
mDescriptionEdit = new KTextEdit( parent );
mDescriptionEdit->setWhatsThis(
i18n("Sets the description for this event, to-do or journal. This "
@@ -528,3 +549,37 @@
text.setFontUnderline( !cursor.charFormat().fontUnderline() );
cursor.mergeCharFormat( text );
}
+
+void KOEditorGeneral::toggleDescriptionStrikethrough() {
+ mRichDescription = true;
+ QTextCursor cursor( mDescriptionEdit->textCursor() );
+ if ( cursor.selectionStart() == cursor.selectionEnd() ) {
+ cursor.select( QTextCursor::WordUnderCursor );
+ }
+ QTextCharFormat text;
+ text.setFontStrikeOut( !cursor.charFormat().fontStrikeOut() );
+ cursor.mergeCharFormat( text );
+}
+
+void KOEditorGeneral::toggleDescriptionLeftAlign() {
+ setAlignment( Qt::AlignLeft );
+}
+
+void KOEditorGeneral::toggleDescriptionCentreAlign() {
+ setAlignment( Qt::AlignHCenter );
+}
+
+void KOEditorGeneral::toggleDescriptionRightAlign() {
+ setAlignment( Qt::AlignRight );
+}
+
+void KOEditorGeneral::setAlignment( Qt::Alignment alignment ) {
+ mRichDescription = true;
+ QTextCursor cursor( mDescriptionEdit->textCursor() );
+ cursor.select( QTextCursor::LineUnderCursor );
+ QTextBlockFormat text;
+ if ( alignment != cursor.blockFormat().alignment() ) {
+ text.setAlignment( alignment );
+ cursor.mergeBlockFormat( text );
+ }
+}
--- trunk/KDE/kdepim/korganizer/koeditorgeneral.h #731538:731539
@@ -106,6 +106,10 @@
void toggleDescriptionBold();
void toggleDescriptionItalic();
void toggleDescriptionUnderline();
+ void toggleDescriptionStrikethrough();
+ void toggleDescriptionLeftAlign();
+ void toggleDescriptionCentreAlign();
+ void toggleDescriptionRightAlign();
signals:
void openCategoryDialog();
@@ -113,6 +117,7 @@
protected:
Alarm *alarmFromSimplePage() const;
+ void setAlignment( Qt::Alignment alignment );
KLineEdit *mSummaryEdit;
KLineEdit *mLocationEdit;
@@ -131,6 +136,10 @@
QPushButton *mDescriptionBoldButton;
QPushButton *mDescriptionItalicButton;
QPushButton *mDescriptionUnderlineButton;
+ QPushButton *mDescriptionStrikethroughButton;
+ QPushButton *mDescriptionLeftAlignButton;
+ QPushButton *mDescriptionCentreAlignButton;
+ QPushButton *mDescriptionRightAlignButton;
bool mRichDescription;
enum AlarmStackPages { SimpleAlarmPage, AdvancedAlarmLabel };
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic