blob: 07c5cdff577c9bbcd42b95a2fddb232b43f531ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/***************************************************************************
ksayitviewimpl.cpp - description
-------------------
begin : Son Aug 10 2003
copyright : (C) 2003 by Robert Vogl
email : voglrobe@saphir
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <iostream>
using namespace std;
// QT includes
#include <tqradiobutton.h>
#include <tqtextstream.h>
#include <tqstring.h>
// KDE includes
#include <kdebug.h>
#include <klocale.h>
#include <ktextedit.h>
#include <kmessagebox.h>
// App specific includes
#include "ksayitviewimpl.h"
KSayItViewImpl::KSayItViewImpl(TQWidget *tqparent, const char *name ) : KSayItView(tqparent,name) {
// some presets
}
KSayItViewImpl::~KSayItViewImpl(){
}
TQString& KSayItViewImpl::getText(){
t = TextEdit->text();
return t;
}
void KSayItViewImpl::enableTextedit( bool enable )
{
// if enable==true, we are in Edit Mode => RTF-Mode off.
if ( enable ){
TextEdit->setTextFormat( TQt::PlainText);
} else {
TextEdit->setTextFormat( TQt::RichText);
}
TextEdit->setReadOnly( !enable );
}
void KSayItViewImpl::slotTextChanged()
{
int length = TextEdit->length();
if ( length > 2 ){
emit signalTextChanged(false);
} else {
emit signalTextChanged(true);
}
}
void KSayItViewImpl::slotCopyAvailable(bool available)
{
// enable/disable copy/cut-action in the menubar
if (available)
emit signalEnableCopyCut(true);
else
emit signalEnableCopyCut(false);
}
void KSayItViewImpl::slotCopy()
{
// copy selected text to the clipboard
TextEdit->copy();
}
void KSayItViewImpl::slotCut()
{
// copy selected text to the clipboard and delete it
TextEdit->cut();
}
void KSayItViewImpl::slotPaste()
{
// paste text from the clipboard to the texteditor
TextEdit->paste();
}
void KSayItViewImpl::textClear()
{
// deletes the entire text of the texteditor
TextEdit->clear();
}
void KSayItViewImpl::setText(const TQString &text)
{
// set text to text
TextEdit->setText( text );
}
#include "ksayitviewimpl.moc"
|