21 #include <KActionCollection>
22 #include <KApplication>
29 #include <KStandardAction>
30 #include <KStandardShortcut>
31 #include <KToggleAction>
41 KSharedConfig::Ptr config = KGlobal::config();
42 KConfigGroup gr = config->group(
"General");
44 vFont = gr.readEntry(
"selectedFont", KGlobalSettings::generalFont());
45 vChr =
QChar(static_cast<unsigned short>(gr.readEntry(
"char", 33)));
46 _rtl = gr.readEntry(
"rtl",
false);
49 setCentralWidget(mainWidget);
56 charSelect =
new KCharSelect(mainWidget, actionCollection());
69 lined =
new KLineEdit(mainWidget);
71 lined->setClearButtonShown(
true);
79 bClip =
new KPushButton( KGuiItem( i18n(
"&To Clipboard" ),
82 connect(
bClip,SIGNAL(clicked()),
this,SLOT(
toClip()));
86 KStandardAction::quit(
this, SLOT(close()), actionCollection() );
88 KAction *action = actionCollection()->addAction(
QLatin1String(
"copy_clip" ) );
89 action->setText( i18n(
"&To Clipboard") );
91 connect(action, SIGNAL(triggered(
bool)), SLOT(
toClip()));
92 action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Copy));
94 action = actionCollection()->addAction(
QLatin1String(
"copy_utf_8" ) );
95 action->setText( i18n(
"To Clipboard &UTF-8") );
96 connect(action, SIGNAL(triggered(
bool) ), SLOT(
toClipUTF8()));
97 action = actionCollection()->addAction(
QLatin1String(
"copy_html" ) );
98 action->setText( i18n(
"To Clipboard &HTML") );
99 connect(action, SIGNAL(triggered(
bool) ), SLOT(
toClipHTML()));
101 action = actionCollection()->addAction(
QLatin1String(
"from_clip" ) );
102 action->setText( i18n(
"&From Clipboard") );
104 connect(action, SIGNAL(triggered(
bool)), SLOT(
fromClip()));
105 action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Paste));
106 action = actionCollection()->addAction(
QLatin1String(
"from_clip_utf8" ) );
107 action->setText( i18n(
"From Clipboard UTF-8") );
108 connect(action, SIGNAL(triggered(
bool) ), SLOT(
fromClipUTF8()));
110 i18n(
"From Clipboard HTML");
112 action = actionCollection()->addAction(
QLatin1String(
"flip" ) );
113 action->setText( i18n(
"&Flip Text") );
114 connect(action, SIGNAL(triggered(
bool) ), SLOT(
flipText()));
116 action =
new KToggleAction( i18n(
"&Reverse Direction"),
this );
117 action->setChecked(
_rtl);
118 actionCollection()->addAction(
QLatin1String(
"rtl" ), action );
119 connect(action, SIGNAL(toggled(
bool) ), SLOT(
setRtl(
bool)));
124 lined->setAlignment( Qt::AlignRight );
126 lined->setAlignment( Qt::AlignLeft );
128 setupGUI(ToolBar|Keys|Save|Create);
134 KSharedConfig::Ptr config = KGlobal::config();
135 KConfigGroup gr = config->group(
"General");
137 gr.writeEntry(
"selectedFont",
vFont);
138 gr.writeEntry(
"char", static_cast<int>(
vChr.
unicode()));
139 gr.writeEntry(
"rtl",
_rtl);
141 KXmlGuiWindow::closeEvent(event);
153 lined->setFont( _font );
164 const int pos =
lined->cursorPosition();
167 lined->setCursorPosition(pos + 1);
177 cb->
setText(str,QClipboard::Clipboard);
178 cb->
setText(str,QClipboard::Selection);
209 input =
lined->text();
212 const int inputLength = input.
length();
213 for(i=0; i< inputLength; ++i )
215 tempchar = input.
at(i);
262 input =
lined->text();
263 const int nbLength = input.
length();
264 for(i=0; i< nbLength; ++i )
268 lined->setText(output);
276 lined->setAlignment( Qt::AlignRight );
278 lined->setAlignment( Qt::AlignLeft );
286 if(
lined->cursorPosition())
287 lined->setCursorPosition(
lined->cursorPosition() - 1 );
291 #include "kcharselectdia.moc"
QString & append(QChar ch)
void charChanged(const QChar &_chr)
QString & prepend(QChar ch)
void setSpacing(int spacing)
QString fromUtf8(const char *str, int size)
QString & insert(int position, QChar ch)
void setMargin(int margin)
QString text(Mode mode) const
QByteArray toLatin1() const
void closeEvent(QCloseEvent *event)
QString & sprintf(const char *cformat,...)
const QChar at(int position) const
void setText(const QString &text, Mode mode)
void fontSelected(const QFont &_font)
QByteArray toUtf8() const