• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KPIMTextedit Library

  • kpimtextedit
inserthtmldialog.cpp
1/*
2 Copyright (c) 2012 Montel Laurent <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19*/
20
21#include "inserthtmldialog.h"
22#include "htmlhighlighter.h"
23
24#include <KLocalizedString>
25#include <KTextEdit>
26
27#include <QVBoxLayout>
28#include <QLabel>
29
30namespace KPIMTextEdit {
31
32class InsertHtmlDialogPrivate
33{
34 public:
35 InsertHtmlDialogPrivate( InsertHtmlDialog *qq )
36 : q( qq )
37 {
38 q->setCaption( i18n( "Insert HTML" ) );
39 q->setButtons( KDialog::Ok|KDialog::Cancel );
40 q->setButtonText( KDialog::Ok, i18n( "Insert" ) );
41 QWidget *page = new QWidget( q );
42 q->setMainWidget( page );
43 QVBoxLayout *lay = new QVBoxLayout( page );
44 QLabel *label = new QLabel( i18n( "Insert HTML tags and texts:" ) );
45 lay->addWidget( label );
46 editor = new KTextEdit;
47 new HtmlHighlighter( editor->document() );
48 editor->setAcceptRichText( false );
49 editor->setFocus();
50 lay->addWidget( editor );
51 label = new QLabel( i18n( "Example: <i> Hello word </i>" ) );
52 QFont font = label->font();
53 font.setBold( true );
54 label->setFont( font );
55 label->setTextFormat( Qt::PlainText );
56 lay->addWidget( label );
57 q->connect( editor, SIGNAL(textChanged()),
58 q, SLOT(_k_slotTextChanged()) );
59 q->enableButtonOk( false );
60 q->resize( 640, 480 );
61 }
62
63 void _k_slotTextChanged();
64
65 KTextEdit *editor;
66 InsertHtmlDialog *q;
67};
68
69void InsertHtmlDialogPrivate::_k_slotTextChanged()
70{
71 q->enableButtonOk( !editor->toPlainText().isEmpty() );
72}
73
74InsertHtmlDialog::InsertHtmlDialog( QWidget *parent )
75 : KDialog( parent ), d( new InsertHtmlDialogPrivate( this ) )
76{
77}
78
79InsertHtmlDialog::~InsertHtmlDialog()
80{
81 delete d;
82}
83
84QString InsertHtmlDialog::html() const
85{
86 return d->editor->toPlainText();
87}
88
89}
90
91#include "moc_inserthtmldialog.cpp"
KPIMTextEdit
Copyright (C) 2006 Laurent Montel montel@kde.org Copyright (C) 2008 Thomas McGuire mcguire@kde....
Definition: emailquotehighlighter.cpp:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPIMTextedit Library

Skip menu "KPIMTextedit Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal