• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • editor
kmcomposerglobalaction.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 
19 #include "kmcomposerglobalaction.h"
20 #include "kmcomposewin.h"
21 
22 #include <autocorrection/widgets/lineeditwithautocorrection.h>
23 
24 #include <KLineEdit>
25 
26 #include <editor/kmcomposereditor.h>
27 
28 KMComposerGlobalAction::KMComposerGlobalAction(KMComposeWin *composerWin, QObject *parent)
29  : QObject(parent),
30  mComposerWin(composerWin)
31 {
32 
33 }
34 
35 KMComposerGlobalAction::~KMComposerGlobalAction()
36 {
37 
38 }
39 
40 void KMComposerGlobalAction::slotUndo()
41 {
42  QWidget *fw = mComposerWin->focusWidget();
43  if ( !fw ) {
44  return;
45  }
46 
47  if (::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw )) {
48  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->undo();
49  }else if ( ::qobject_cast<KMComposerEditor*>( fw ) ) {
50  static_cast<KTextEdit*>( fw )->undo();
51  } else if (::qobject_cast<KLineEdit*>( fw )) {
52  static_cast<KLineEdit*>( fw )->undo();
53  }
54 }
55 
56 void KMComposerGlobalAction::slotRedo()
57 {
58  QWidget *fw = mComposerWin->focusWidget();
59  if ( !fw ) {
60  return;
61  }
62 
63  if (::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw )) {
64  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->redo();
65  } else if ( ::qobject_cast<KMComposerEditor*>( fw ) ) {
66  static_cast<KTextEdit*>( fw )->redo();
67  } else if (::qobject_cast<KLineEdit*>( fw )) {
68  static_cast<KLineEdit*>( fw )->redo();
69  }
70 }
71 
72 
73 void KMComposerGlobalAction::slotCut()
74 {
75  QWidget *fw = mComposerWin->focusWidget();
76  if ( !fw ) {
77  return;
78  }
79 
80  if ( ::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw ) ) {
81  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->cut();
82  } else if ( ::qobject_cast<KMComposerEditor*>( fw ) ) {
83  static_cast<KTextEdit*>(fw)->cut();
84  } else if ( ::qobject_cast<KLineEdit*>( fw ) ) {
85  static_cast<KLineEdit*>( fw )->cut();
86  }
87 }
88 
89 
90 void KMComposerGlobalAction::slotCopy()
91 {
92  QWidget *fw = mComposerWin->focusWidget();
93  if ( !fw ) {
94  return;
95  }
96 
97  if ( ::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw ) ) {
98  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->copy();
99  } else if ( ::qobject_cast<KMComposerEditor*>( fw ) ) {
100  static_cast<KTextEdit*>(fw)->copy();
101  } else if ( ::qobject_cast<KLineEdit*>( fw ) ) {
102  static_cast<KLineEdit*>( fw )->copy();
103  }
104 }
105 
106 
107 void KMComposerGlobalAction::slotPaste()
108 {
109  QWidget * const fw = mComposerWin->focusWidget();
110  if ( !fw ) {
111  return;
112  }
113  if ( ::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw ) ) {
114  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->paste();
115  } else if ( ::qobject_cast<KMComposerEditor*>( fw ) ) {
116  static_cast<KTextEdit*>(fw)->paste();
117  } else if ( ::qobject_cast<KLineEdit*>( fw ) ) {
118  static_cast<KLineEdit*>( fw )->paste();
119  }
120 }
121 
122 
123 void KMComposerGlobalAction::slotMarkAll()
124 {
125  QWidget *fw = mComposerWin->focusWidget();
126  if ( !fw ) {
127  return;
128  }
129 
130  if (::qobject_cast<PimCommon::LineEditWithAutoCorrection*>( fw )) {
131  static_cast<PimCommon::LineEditWithAutoCorrection*>( fw )->selectAll();
132  } else if ( ::qobject_cast<KLineEdit*>( fw ) ) {
133  static_cast<KLineEdit*>( fw )->selectAll();
134  } else if (::qobject_cast<KMComposerEditor*>( fw )) {
135  static_cast<KTextEdit*>( fw )->selectAll();
136  }
137 }
kmcomposerglobalaction.h
QWidget
KMComposerGlobalAction::slotUndo
void slotUndo()
Definition: kmcomposerglobalaction.cpp:40
kmcomposereditor.h
KMComposerGlobalAction::KMComposerGlobalAction
KMComposerGlobalAction(KMComposeWin *composerWin, QObject *parent=0)
Definition: kmcomposerglobalaction.cpp:28
KMComposerGlobalAction::slotMarkAll
void slotMarkAll()
Definition: kmcomposerglobalaction.cpp:123
KMComposeWin
Definition: kmcomposewin.h:109
KMComposerGlobalAction::slotCopy
void slotCopy()
Definition: kmcomposerglobalaction.cpp:90
QObject
KMComposerGlobalAction::~KMComposerGlobalAction
~KMComposerGlobalAction()
Definition: kmcomposerglobalaction.cpp:35
KLineEdit
kmcomposewin.h
KMComposerGlobalAction::slotPaste
void slotPaste()
Definition: kmcomposerglobalaction.cpp:107
KMComposerGlobalAction::slotCut
void slotCut()
Definition: kmcomposerglobalaction.cpp:73
KMComposerGlobalAction::slotRedo
void slotRedo()
Definition: kmcomposerglobalaction.cpp:56
KTextEdit
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



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