summaryrefslogtreecommitdiffstats
path: root/kcharselect
diff options
context:
space:
mode:
Diffstat (limited to 'kcharselect')
-rw-r--r--kcharselect/KCharSelect.desktop98
-rw-r--r--kcharselect/Makefile.am21
-rw-r--r--kcharselect/TODO6
-rw-r--r--kcharselect/hi16-app-kcharselect.pngbin0 -> 325 bytes
-rw-r--r--kcharselect/hi32-app-kcharselect.pngbin0 -> 1666 bytes
-rw-r--r--kcharselect/hi48-app-kcharselect.pngbin0 -> 1353 bytes
-rw-r--r--kcharselect/kcharselect.upd5
-rw-r--r--kcharselect/kcharselectdia.cc289
-rw-r--r--kcharselect/kcharselectdia.h71
-rw-r--r--kcharselect/kcharselectui.rc16
-rw-r--r--kcharselect/main.cc49
11 files changed, 555 insertions, 0 deletions
diff --git a/kcharselect/KCharSelect.desktop b/kcharselect/KCharSelect.desktop
new file mode 100644
index 0000000..f51d579
--- /dev/null
+++ b/kcharselect/KCharSelect.desktop
@@ -0,0 +1,98 @@
+[Desktop Entry]
+GenericName=Character Selector
+GenericName[af]=Karakter Kiesser
+GenericName[ar]=أداة اختيار الرموز
+GenericName[az]=Xarakter Seçici
+GenericName[bg]=Избор на знаци
+GenericName[br]=Dibaber arouezenn
+GenericName[bs]=Izbor znakova
+GenericName[ca]=Selector de caràcters
+GenericName[cs]=Vyběr znaků
+GenericName[cy]=Dewisydd Nod
+GenericName[da]=Tegnvælger
+GenericName[de]=Tabelle zur Zeichenauswahl
+GenericName[el]=Επιλογέας χαρακτήρων
+GenericName[eo]=Elektilo por signoj
+GenericName[es]=Selector de caracteres
+GenericName[et]=Sümbolite valija
+GenericName[eu]=Karaktere Hautatzailea
+GenericName[fa]=گزینندۀ نویسه
+GenericName[fi]=Valitse merkki leikepöydälle
+GenericName[fr]=Sélecteur de caractères
+GenericName[ga]=Roghnóir Carachtar
+GenericName[gl]=Selector de Caracteres
+GenericName[he]=בוחר תווים
+GenericName[hi]=अक्षर चयनक
+GenericName[hr]=Izbor znakova
+GenericName[hu]=Karakterválasztó
+GenericName[id]=Pemilih Karakter
+GenericName[is]=Stafaval
+GenericName[it]=Selettore di caratteri
+GenericName[ja]=文字の選択
+GenericName[ka]=სიმბოლოთა შემრჩეველი
+GenericName[kk]=Таңба тергіш
+GenericName[km]=កម្មវិធី​ជ្រើស​តួអក្សរ
+GenericName[ko]=글자 고르기
+GenericName[lt]=Simbolių parinkimas
+GenericName[lv]=Simbolu Selektors
+GenericName[mk]=Избирач на знаци
+GenericName[mt]=Agħżel Karattri
+GenericName[nb]=Tegnvelger
+GenericName[nds]=Tekenutwähler
+GenericName[ne]=क्यारेक्टर चयनकर्ता
+GenericName[nl]=Speciale tekens
+GenericName[nn]=Teiknveljar
+GenericName[pa]=ਅੱਖਰ ਚੋਣਕਾਰ
+GenericName[pl]=Wybór pojedynczego znaku
+GenericName[pt]=Selector de Caracteres
+GenericName[pt_BR]=Seletor de Caracteres
+GenericName[ro]=Selector de caractere
+GenericName[ru]=Выбор символов
+GenericName[sk]=Volič znakov
+GenericName[sl]=Izbiranje znakov
+GenericName[sr]=Бирач знакова
+GenericName[sr@Latn]=Birač znakova
+GenericName[sv]=Teckenväljare
+GenericName[ta]= எழுத்து தேர்ந்தெடுப்பான்
+GenericName[tg]=Интихобгари Аломатҳо
+GenericName[th]=เครื่องมือเลือกอักขระ
+GenericName[tr]=Karakter Seçici
+GenericName[uk]=Таблиця символів
+GenericName[uz]=Harf tanlagich
+GenericName[uz@cyrillic]=Ҳарф танлагич
+GenericName[ven]=Munangi wa muanewa
+GenericName[vi]=Trình chọn kí tự
+GenericName[wa]=Tchoezixheu di caracteres
+GenericName[xh]=Umkhethi womsebenzi
+GenericName[zh_CN]=字符选择器
+GenericName[zh_TW]=字元選擇器
+GenericName[zu]=Umkhethi Womsebenzi
+Exec=kcharselect -caption "%c" %i %m
+Icon=kcharselect
+Path=
+Type=Application
+Terminal=false
+DocPath=kcharselect/index.html
+Name=KCharSelect
+Name[af]=Kcharselect
+Name[cy]=KDewisNod
+Name[eo]=Signoelektilo
+Name[hi]=के-चर-सलेक्ट
+Name[ne]=केडीई क्यारेक्टर चयन
+Name[nl]=Speciale tekens
+Name[pa]=ਕਅੱਖਰਚੋਣਕਾਰ
+Name[pl]=Wybór znaków
+Name[pt_BR]=Seletor de caracteres
+Name[sr]=KChartSelect
+Name[sr@Latn]=KChartSelect
+Name[sv]=Kcharselect
+Name[ta]= கேஎழுத்துதேர்வு
+Name[tg]=KИнтихобгари Аломатҳо
+Name[th]=เลือกอักขระ
+Name[tr]=Karakter Seçici
+Name[ven]=U nanga muanewa wa K
+Name[xh]=Itshati yokukheta i K
+Name[zh_TW]=KDE 字元選擇
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Utility;X-KDE-More;
diff --git a/kcharselect/Makefile.am b/kcharselect/Makefile.am
new file mode 100644
index 0000000..622920e
--- /dev/null
+++ b/kcharselect/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES = $(all_includes)
+LDADD = $(LIB_KFILE)
+bin_PROGRAMS = kcharselect
+
+kcharselect_SOURCES = kcharselectdia.cc main.cc
+kcharselect_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kcharselect_METASOURCES = kcharselectdia.moc
+
+updatedir = $(kde_datadir)/kconf_update
+update_DATA = kcharselect.upd
+
+KDE_ICON = kcharselect
+
+xdg_apps_DATA = KCharSelect.desktop
+
+rcdir = $(kde_datadir)/kcharselect
+rc_DATA = kcharselectui.rc
+
+messages: rc.cpp
+ $(XGETTEXT) *.cc *.cpp -o $(podir)/kcharselect.pot
+
diff --git a/kcharselect/TODO b/kcharselect/TODO
new file mode 100644
index 0000000..261f1ab
--- /dev/null
+++ b/kcharselect/TODO
@@ -0,0 +1,6 @@
+o Mark which glyphs are subsitutes (requires QT support).
+o Gridview refresh bug -- sometimes trash appears the empty space when
+ resized.
+o Don't use the grid layout class - it's more trouble than it's worth.
+o Should remove the useless "What's this?" widget from title bar.
+o Use a horizontal layout for "Clear", "To Clipboard", and the line edit.
diff --git a/kcharselect/hi16-app-kcharselect.png b/kcharselect/hi16-app-kcharselect.png
new file mode 100644
index 0000000..8e0f8d6
--- /dev/null
+++ b/kcharselect/hi16-app-kcharselect.png
Binary files differ
diff --git a/kcharselect/hi32-app-kcharselect.png b/kcharselect/hi32-app-kcharselect.png
new file mode 100644
index 0000000..19611e5
--- /dev/null
+++ b/kcharselect/hi32-app-kcharselect.png
Binary files differ
diff --git a/kcharselect/hi48-app-kcharselect.png b/kcharselect/hi48-app-kcharselect.png
new file mode 100644
index 0000000..c806cdc
--- /dev/null
+++ b/kcharselect/hi48-app-kcharselect.png
Binary files differ
diff --git a/kcharselect/kcharselect.upd b/kcharselect/kcharselect.upd
new file mode 100644
index 0000000..a6a186b
--- /dev/null
+++ b/kcharselect/kcharselect.upd
@@ -0,0 +1,5 @@
+Id=1
+File=kcharselectrc
+Group=General
+Key=font,selectedFont
+RemoveKey=font
diff --git a/kcharselect/kcharselectdia.cc b/kcharselect/kcharselectdia.cc
new file mode 100644
index 0000000..43e13b0
--- /dev/null
+++ b/kcharselect/kcharselectdia.cc
@@ -0,0 +1,289 @@
+/******************************************************************/
+/* KCharSelectDia - (c) by Reginald Stadlbauer 1999 */
+/* Author: Reginald Stadlbauer */
+/* E-Mail: reggie@kde.org */
+/* RTL support by Bryce Nesbitt */
+/******************************************************************/
+
+#include "kcharselectdia.moc"
+
+#include <stdlib.h>
+
+#include <kdialog.h>
+#include <kapplication.h>
+#include <kaccel.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kaction.h>
+
+/******************************************************************/
+/* class KCharSelectDia */
+/******************************************************************/
+
+//==================================================================
+KCharSelectDia::KCharSelectDia(QWidget *parent,const char *name,
+ const QChar &_chr,const QString &_font,
+ int _tableNum, bool direction)
+ : KMainWindow(parent,name), vChr(_chr), vFont(_font)
+{
+ setCaption(QString::null); // Standard caption
+
+ QWidget *mainWidget = new QWidget(this);
+ setCentralWidget(mainWidget);
+
+ grid = new QGridLayout( mainWidget, 3, 4, KDialog::marginHint(), KDialog::spacingHint() );
+
+ // Add character selection widget from library kdeui
+ charSelect = new KCharSelect(mainWidget,"",vFont,vChr,_tableNum);
+ charSelect->resize(charSelect->sizeHint());
+ connect(charSelect,SIGNAL(highlighted(const QChar &)),
+ SLOT(charChanged(const QChar &)));
+ connect(charSelect,SIGNAL(activated(const QChar &)),
+ SLOT(add(const QChar &)));
+ connect(charSelect,SIGNAL(fontChanged(const QString &)),
+ SLOT(fontSelected(const QString &)));
+ grid->addMultiCellWidget(charSelect, 0, 0, 0, 3);
+
+ // Build line editor
+ lined = new QLineEdit(mainWidget);
+ lined->resize(lined->sizeHint());
+
+ QFont font = lined->font();
+ font.setFamily( vFont );
+ lined->setFont( font );
+
+ connect(lined,SIGNAL(textChanged(const QString &)),
+ SLOT(lineEditChanged()));
+ grid->addMultiCellWidget(lined, 1, 1, 0, 3);
+
+ // Build some buttons
+ bHelp = new KPushButton( KStdGuiItem::help(), mainWidget );
+ connect(bHelp,SIGNAL(clicked()),this,SLOT(help()));
+ bHelp->setFixedSize( bHelp->sizeHint() );
+ grid->addWidget( bHelp, 2, 0 );
+
+ QSpacerItem *space = new QSpacerItem( 20, 20, QSizePolicy::Expanding );
+ grid->addItem( space, 2, 1 );
+
+ bClear = new KPushButton( KStdGuiItem::clear(), mainWidget );
+ connect(bClear,SIGNAL(clicked()),this,SLOT(clear()));
+ bClear->setFixedSize( bClear->sizeHint() );
+ grid->addWidget( bClear, 2, 2 );
+
+ bClip = new KPushButton( KGuiItem( i18n( "&To Clipboard" ),
+ "editcopy" ), mainWidget );
+ bClip->setFixedSize( bClip->sizeHint() );
+ connect(bClip,SIGNAL(clicked()),this,SLOT(toClip()));
+ grid->addWidget( bClip, 2, 3 );
+
+ // Build menu
+ KStdAction::quit( this, SLOT(_exit()), actionCollection() );
+
+ new KAction(i18n("&To Clipboard"), "editcopy",
+ KStdAccel::shortcut(KStdAccel::Copy), this, SLOT(toClip()), actionCollection(), "copy_clip" );
+
+ (void)new KAction(i18n("To Clipboard &UTF-8"), 0, this,
+ SLOT(toClipUTF8()), actionCollection(), "copy_utf_8" );
+ (void)new KAction(i18n("To Clipboard &HTML"), 0, this,
+ SLOT(toClipHTML()), actionCollection(), "copy_html" );
+
+ new KAction(i18n("&From Clipboard"), "editpaste",
+ KStdAccel::shortcut(KStdAccel::Paste), this, SLOT(fromClip()), actionCollection(), "from_clip" );
+ (void)new KAction(i18n("From Clipboard UTF-8"), 0, this,
+ SLOT(fromClipUTF8()), actionCollection(), "from_clip_utf8" );
+
+ i18n("From Clipboard HTML"); // Intended for future use
+
+ KStdAction::clear(this, SLOT(clear()), actionCollection(), "clear");
+ (void)new KAction(i18n("&Flip"), 0, this,
+ SLOT(flipText()), actionCollection(), "flip" );
+ (void)new KAction(i18n("&Alignment"), 0, this,
+ SLOT(toggleEntryDirection()), actionCollection(), "alignment" );
+
+ charSelect->setFocus();
+
+ entryDirection = direction;
+ if( entryDirection )
+ lined->setAlignment( Qt::AlignRight );
+ else
+ lined->setAlignment( Qt::AlignLeft );
+
+ setupGUI(Keys|StatusBar|Save|Create);
+}
+
+//==================================================================
+void KCharSelectDia::charChanged(const QChar &_chr)
+{
+ vChr = _chr;
+}
+
+//==================================================================
+void KCharSelectDia::fontSelected(const QString &_font)
+{
+ charSelect->setFont(_font);
+
+ QFont font = lined->font();
+ font.setFamily( _font );
+ lined->setFont( font );
+
+ vFont = _font;
+}
+
+//==================================================================
+void KCharSelectDia::add(const QChar &_chr)
+{
+ QString str;
+ int cursorPos;
+
+ charChanged(_chr);
+
+ str = lined->text();
+ cursorPos = lined->cursorPosition();
+ str.insert( cursorPos, vChr );
+ lined->setText(str);
+ cursorPos++;
+ lined->setCursorPosition( cursorPos );
+}
+
+//==================================================================
+void KCharSelectDia::toClip()
+{
+ QClipboard *cb = QApplication::clipboard();
+ cb->setSelectionMode( true );
+ cb->setText(lined->text());
+ cb->setSelectionMode( false );
+ cb->setText(lined->text());
+}
+
+//==================================================================
+// UTF-8 is rapidly becoming the favored 8-bit encoding for
+// Unicode (iso10646-1).
+//
+void KCharSelectDia::toClipUTF8()
+{
+ QClipboard *cb = QApplication::clipboard();
+ QString str = lined->text();
+ cb->setText(str.utf8());
+}
+
+//==================================================================
+// Put valid HTML 4.0 into the clipboard. Valid ISO-8859-1 Latin 1
+// characters are left undisturbed. Everything else, including the
+// "c0 control characters" often used by Windows, are clipped
+// as a HTML entity.
+//
+void KCharSelectDia::toClipHTML()
+{
+ QClipboard *cb = QApplication::clipboard();
+ QString input;
+ QString html;
+ QString tempstring;
+ QChar tempchar;
+ uint i;
+
+ input = lined->text();
+ for(i=0; i< input.length(); i++ )
+ {
+ tempchar = input.at(i);
+ if( tempchar.latin1() && ((tempchar.unicode() < 128) || (tempchar.unicode() >= 128+32)) )
+ {
+ html.append(input.at(i));
+ }
+ else
+ {
+ html.append(tempstring.sprintf("&#x%x;", tempchar.unicode()));
+ }
+ }
+ cb->setText(html);
+}
+
+//==================================================================
+//
+void KCharSelectDia::fromClip()
+{
+ QClipboard *cb = QApplication::clipboard();
+ lined->setText( cb->text() );
+}
+
+//==================================================================
+// UTF-8 is rapidly becoming the favored 8-bit encoding for
+// Unicode (iso10646-1). This function is handy for decoding
+// UTF-8 found in legacy applications, consoles, filenames, webpages,
+// etc.
+//
+void KCharSelectDia::fromClipUTF8()
+{
+ QClipboard *cb = QApplication::clipboard();
+ QString str = cb->text();
+
+ lined->setText( str.fromUtf8( str.latin1() ) );
+}
+
+//==================================================================
+// Reverse the text held in the line edit buffer. This is crucial
+// for dealing with visual vs. logical representations of
+// right to left languages, and handy for working around all
+// manner of legacy character order issues.
+//
+void KCharSelectDia::flipText()
+{
+ QString input;
+ QString output;
+ uint i;
+
+ input = lined->text();
+ for(i=0; i< input.length(); i++ )
+ {
+ output.prepend( input.at(i) );
+ }
+ lined->setText(output);
+}
+
+//==================================================================
+void KCharSelectDia::toggleEntryDirection()
+{
+ entryDirection ^= 1;
+ if( entryDirection )
+ lined->setAlignment( Qt::AlignRight );
+ else
+ lined->setAlignment( Qt::AlignLeft );
+}
+
+//==================================================================
+void KCharSelectDia::lineEditChanged()
+{
+ if( entryDirection )
+ {
+ if(lined->cursorPosition())
+ lined->setCursorPosition( lined->cursorPosition() - 1 );
+ }
+}
+
+//==================================================================
+void KCharSelectDia::_exit()
+{
+ KConfig *config = kapp->config();
+
+ config->setGroup("General");
+ config->writeEntry("selectedFont",vFont);
+ config->writeEntry("char",static_cast<int>(vChr.unicode()));
+ config->writeEntry("table",charSelect->tableNum());
+ config->writeEntry("entryDirection",entryDirection);
+ config->sync();
+
+ delete this;
+ exit(0);
+}
+
+//==================================================================
+void KCharSelectDia::clear()
+{
+ lined->clear();
+}
+
+//==================================================================
+void KCharSelectDia::help()
+{
+ kapp->invokeHelp();
+}
+
diff --git a/kcharselect/kcharselectdia.h b/kcharselect/kcharselectdia.h
new file mode 100644
index 0000000..a3a0ea1
--- /dev/null
+++ b/kcharselect/kcharselectdia.h
@@ -0,0 +1,71 @@
+/******************************************************************/
+/* KCharSelectDia - (c) by Reginald Stadlbauer 1999 */
+/* Author: Reginald Stadlbauer */
+/* E-Mail: reggie@kde.org */
+/******************************************************************/
+
+#ifndef kcharselectdia_h
+#define kcharselectdia_h
+
+
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qclipboard.h>
+
+#include <kpushbutton.h>
+#include <kcharselect.h>
+#include <kmainwindow.h>
+
+static const char *version = "v1.1";
+
+/******************************************************************/
+/* class KCharSelectDia */
+/******************************************************************/
+
+class KCharSelectDia : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+ KCharSelectDia(QWidget *parent,const char *name,const QChar &_chr,const QString &_font,int _tableNum, bool direction);
+
+ static bool selectChar(QString &_font,QChar &_chr,int _tableNum);
+
+ int chr() { return vChr; }
+ QString font() { return vFont; }
+
+protected:
+ void closeEvent(QCloseEvent *) { _exit(); }
+
+ QGridLayout *grid;
+ KCharSelect *charSelect;
+ QLineEdit *lined;
+ KPushButton *bClip,*bClear;
+ KPushButton *bHelp;
+
+ QChar vChr;
+ QString vFont;
+ int pointSize;
+ bool entryDirection;
+
+protected slots:
+ void charChanged(const QChar &_chr);
+ void fontSelected(const QString &_font);
+ void add()
+ { add(vChr); }
+ void add(const QChar &_chr);
+ void toClip();
+ void toClipUTF8();
+ void toClipHTML();
+ void fromClip();
+ void fromClipUTF8();
+ void flipText();
+ void toggleEntryDirection();
+ void lineEditChanged();
+ void _exit();
+ void clear();
+ void help();
+
+};
+
+#endif
diff --git a/kcharselect/kcharselectui.rc b/kcharselect/kcharselectui.rc
new file mode 100644
index 0000000..7768293
--- /dev/null
+++ b/kcharselect/kcharselectui.rc
@@ -0,0 +1,16 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kcharselect" version="1">
+<MenuBar>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="copy_clip"/>
+ <Action name="copy_utf_8"/>
+ <Action name="copy_html"/>
+ <Action name="from_clip"/>
+ <Action name="from_clip_utf8"/>
+ <Separator/>
+ <Action name="clear"/>
+ <Action name="flip"/>
+ <Action name="alignment"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/kcharselect/main.cc b/kcharselect/main.cc
new file mode 100644
index 0000000..b3477cc
--- /dev/null
+++ b/kcharselect/main.cc
@@ -0,0 +1,49 @@
+/******************************************************************/
+/* KCharSelectDia - (c) by Reginald Stadlbauer 1999 */
+/* Author: Reginald Stadlbauer */
+/* E-Mail: reggie@kde.org */
+/******************************************************************/
+
+#include "kcharselectdia.h"
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kglobalsettings.h>
+
+static const char description[] =
+ I18N_NOOP("KDE character selection utility");
+
+/*================================================================*/
+int main(int argc, char **argv)
+{
+ KAboutData aboutData( "kcharselect", I18N_NOOP("KCharSelect"),
+ version, description, KAboutData::License_GPL,
+ "(c) 1999, Reginald Stadlbauer");
+ aboutData.addAuthor("Reginald Stadlbauer",0, "reggie@kde.org");
+ aboutData.addCredit( "Nadeem Hasan", I18N_NOOP( "GUI cleanup and fixes" ),
+ "nhasan@kde.org" );
+ aboutData.addCredit( "Ryan Cumming", I18N_NOOP( "GUI cleanup and fixes" ),
+ "bodnar42@phalynx.dhs.org" );
+ aboutData.addCredit("Benjamin C. Meyer",I18N_NOOP("XMLUI conversion"),"ben+kcharselect@meyerhome.net");
+ KCmdLineArgs::init( argc, argv, &aboutData );
+
+ KApplication app;
+
+ KConfig *config = kapp->config();
+
+ config->setGroup("General");
+ QString font(config->readEntry("selectedFont", KGlobalSettings::generalFont().family()));
+ QChar c = QChar(static_cast<unsigned short>(config->readNumEntry("char",33)));
+ int tn = config->readNumEntry("table",0);
+ bool direction = config->readNumEntry("entryDirection",0);
+
+ KCharSelectDia *dia = new KCharSelectDia(0L,"",c,font,tn,direction);
+
+ app.setMainWidget(dia);
+ dia->show();
+
+ return app.exec();
+}
+