Initial TQt conversion

pull/1/head
Slávek Banko 11 years ago
parent 43e0b376e7
commit 0af498ec7d

@ -1033,7 +1033,7 @@ elif test "$kde_use_qt_emb" = "yes"; then
x_includes="" x_includes=""
x_libraries="" x_libraries=""
elif test "$kde_use_qt_mac" = "yes"; then elif test "$kde_use_qt_mac" = "yes"; then
dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to dnl We're using QT/Mac (I use QT_MAC so that ntqglobal.h doesn't *have* to
dnl be included to get the information) --Sam dnl be included to get the information) --Sam
CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
@ -1065,19 +1065,19 @@ AC_DEFUN([KDE_PRINT_QT_PROGRAM],
AC_REQUIRE([KDE_USE_QT]) AC_REQUIRE([KDE_USE_QT])
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#include "confdefs.h" #include "confdefs.h"
#include <qglobal.h> #include <ntqglobal.h>
#include <qapplication.h> #include <ntqapplication.h>
EOF EOF
if test "$kde_qtver" = "2"; then if test "$kde_qtver" = "2"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qevent.h> #include <ntqevent.h>
#include <qstring.h> #include <ntqstring.h>
#include <qstyle.h> #include <ntqstyle.h>
EOF EOF
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#if QT_VERSION < 210 #if TQT_VERSION < 210
#error 1 #error 1
#endif #endif
EOF EOF
@ -1086,8 +1086,8 @@ fi
if test "$kde_qtver" = "3"; then if test "$kde_qtver" = "3"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qcursor.h> #include <ntqcursor.h>
#include <qstylefactory.h> #include <ntqstylefactory.h>
#include <private/qucomextra_p.h> #include <private/qucomextra_p.h>
EOF EOF
fi fi
@ -1170,22 +1170,22 @@ fi
if test -z "$3"; then if test -z "$3"; then
if test $kde_qtver = 3; then if test $kde_qtver = 3; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 0x03@VER@00" kde_qt_verstring="TQT_VERSION >= 0x03@VER@00"
qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'` qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"` kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
else else
kde_qt_verstring="QT_VERSION >= 300" kde_qt_verstring="TQT_VERSION >= 300"
fi fi
fi fi
if test $kde_qtver = 2; then if test $kde_qtver = 2; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 222" kde_qt_verstring="TQT_VERSION >= 222"
else else
kde_qt_verstring="QT_VERSION >= 200" kde_qt_verstring="TQT_VERSION >= 200"
fi fi
fi fi
if test $kde_qtver = 1; then if test $kde_qtver = 1; then
kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" kde_qt_verstring="TQT_VERSION >= 142 && TQT_VERSION < 200"
fi fi
else else
kde_qt_verstring="$3" kde_qt_verstring="$3"
@ -1291,7 +1291,7 @@ AC_ARG_ENABLE(
USING_QT_MT="" USING_QT_MT=""
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we not get --disable-qt-mt then adjust some vars for the host. dnl If we not get --disable-tqt-mt then adjust some vars for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
KDE_MT_LDFLAGS= KDE_MT_LDFLAGS=
@ -1354,7 +1354,7 @@ dnl ------------------------------------------------------------
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl If we got --enable-tqt-mt then adjust the Qt library name for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
if test "x$kde_use_qt_mt" = "xyes"; then if test "x$kde_use_qt_mt" = "xyes"; then
@ -1425,9 +1425,9 @@ if test ! "$ac_qt_includes" = "NO"; then
fi fi
if test "$kde_qtver" != "1"; then if test "$kde_qtver" != "1"; then
kde_qt_header=qstyle.h kde_qt_header=ntqstyle.h
else else
kde_qt_header=qglobal.h kde_qt_header=ntqglobal.h
fi fi
AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
@ -1979,7 +1979,7 @@ AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
AC_TRY_LINK([ AC_TRY_LINK([
#include <qdom.h> #include <ntqdom.h>
], ],
[ [
QDomDocument doc; QDomDocument doc;
@ -2498,7 +2498,7 @@ LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
AC_TRY_LINK( AC_TRY_LINK(
[#include <qapplication.h>], [#include <ntqapplication.h>],
[ [
int argc; int argc;
char** argv; char** argv;
@ -4205,7 +4205,7 @@ CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
AC_TRY_RUN(dnl AC_TRY_RUN(dnl
[ [
#include <qimageio.h> #include <qimageio.h>
#include <qstring.h> #include <ntqstring.h>
int main() { int main() {
QString t = "hallo"; QString t = "hallo";
t.fill('t'); t.fill('t');
@ -4989,7 +4989,7 @@ if test "${with_qt_dir+set}" = set; then
kde_qtdir="$with_qt_dir" kde_qtdir="$with_qt_dir"
fi fi
AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) AC_FIND_FILE(ntqsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
AC_MSG_RESULT($QTDOCDIR) AC_MSG_RESULT($QTDOCDIR)
AC_SUBST(QTDOCDIR) AC_SUBST(QTDOCDIR)
@ -5010,7 +5010,7 @@ AC_SUBST(DOXYGEN_PROJECT_NAME)
AC_SUBST(DOXYGEN_PROJECT_NUMBER) AC_SUBST(DOXYGEN_PROJECT_NUMBER)
KDE_HAS_DOXYGEN=no KDE_HAS_DOXYGEN=no
if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/ntqsql.html; then
KDE_HAS_DOXYGEN=yes KDE_HAS_DOXYGEN=yes
fi fi
AC_SUBST(KDE_HAS_DOXYGEN) AC_SUBST(KDE_HAS_DOXYGEN)

46
aclocal.m4 vendored

@ -1045,7 +1045,7 @@ elif test "$kde_use_qt_emb" = "yes"; then
x_includes="" x_includes=""
x_libraries="" x_libraries=""
elif test "$kde_use_qt_mac" = "yes"; then elif test "$kde_use_qt_mac" = "yes"; then
dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to dnl We're using QT/Mac (I use QT_MAC so that ntqglobal.h doesn't *have* to
dnl be included to get the information) --Sam dnl be included to get the information) --Sam
CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
@ -1077,19 +1077,19 @@ AC_DEFUN([KDE_PRINT_QT_PROGRAM],
AC_REQUIRE([KDE_USE_QT]) AC_REQUIRE([KDE_USE_QT])
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#include "confdefs.h" #include "confdefs.h"
#include <qglobal.h> #include <ntqglobal.h>
#include <qapplication.h> #include <ntqapplication.h>
EOF EOF
if test "$kde_qtver" = "2"; then if test "$kde_qtver" = "2"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qevent.h> #include <ntqevent.h>
#include <qstring.h> #include <ntqstring.h>
#include <qstyle.h> #include <ntqstyle.h>
EOF EOF
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#if QT_VERSION < 210 #if TQT_VERSION < 210
#error 1 #error 1
#endif #endif
EOF EOF
@ -1098,8 +1098,8 @@ fi
if test "$kde_qtver" = "3"; then if test "$kde_qtver" = "3"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qcursor.h> #include <ntqcursor.h>
#include <qstylefactory.h> #include <ntqstylefactory.h>
#include <private/qucomextra_p.h> #include <private/qucomextra_p.h>
EOF EOF
fi fi
@ -1182,22 +1182,22 @@ fi
if test -z "$3"; then if test -z "$3"; then
if test $kde_qtver = 3; then if test $kde_qtver = 3; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 0x03@VER@00" kde_qt_verstring="TQT_VERSION >= 0x03@VER@00"
qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'` qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"` kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
else else
kde_qt_verstring="QT_VERSION >= 300" kde_qt_verstring="TQT_VERSION >= 300"
fi fi
fi fi
if test $kde_qtver = 2; then if test $kde_qtver = 2; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 222" kde_qt_verstring="TQT_VERSION >= 222"
else else
kde_qt_verstring="QT_VERSION >= 200" kde_qt_verstring="TQT_VERSION >= 200"
fi fi
fi fi
if test $kde_qtver = 1; then if test $kde_qtver = 1; then
kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" kde_qt_verstring="TQT_VERSION >= 142 && TQT_VERSION < 200"
fi fi
else else
kde_qt_verstring="$3" kde_qt_verstring="$3"
@ -1303,7 +1303,7 @@ AC_ARG_ENABLE(
USING_QT_MT="" USING_QT_MT=""
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we not get --disable-qt-mt then adjust some vars for the host. dnl If we not get --disable-tqt-mt then adjust some vars for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
KDE_MT_LDFLAGS= KDE_MT_LDFLAGS=
@ -1366,7 +1366,7 @@ dnl ------------------------------------------------------------
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl If we got --enable-tqt-mt then adjust the Qt library name for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
if test "x$kde_use_qt_mt" = "xyes"; then if test "x$kde_use_qt_mt" = "xyes"; then
@ -1437,9 +1437,9 @@ if test ! "$ac_qt_includes" = "NO"; then
fi fi
if test "$kde_qtver" != "1"; then if test "$kde_qtver" != "1"; then
kde_qt_header=qstyle.h kde_qt_header=ntqstyle.h
else else
kde_qt_header=qglobal.h kde_qt_header=ntqglobal.h
fi fi
AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
@ -1991,7 +1991,7 @@ AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
AC_TRY_LINK([ AC_TRY_LINK([
#include <qdom.h> #include <ntqdom.h>
], ],
[ [
QDomDocument doc; QDomDocument doc;
@ -2510,7 +2510,7 @@ LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
AC_TRY_LINK( AC_TRY_LINK(
[#include <qapplication.h>], [#include <ntqapplication.h>],
[ [
int argc; int argc;
char** argv; char** argv;
@ -4217,7 +4217,7 @@ CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
AC_TRY_RUN(dnl AC_TRY_RUN(dnl
[ [
#include <qimageio.h> #include <qimageio.h>
#include <qstring.h> #include <ntqstring.h>
int main() { int main() {
QString t = "hallo"; QString t = "hallo";
t.fill('t'); t.fill('t');
@ -5001,7 +5001,7 @@ if test "${with_qt_dir+set}" = set; then
kde_qtdir="$with_qt_dir" kde_qtdir="$with_qt_dir"
fi fi
AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) AC_FIND_FILE(ntqsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
AC_MSG_RESULT($QTDOCDIR) AC_MSG_RESULT($QTDOCDIR)
AC_SUBST(QTDOCDIR) AC_SUBST(QTDOCDIR)
@ -5022,7 +5022,7 @@ AC_SUBST(DOXYGEN_PROJECT_NAME)
AC_SUBST(DOXYGEN_PROJECT_NUMBER) AC_SUBST(DOXYGEN_PROJECT_NUMBER)
KDE_HAS_DOXYGEN=no KDE_HAS_DOXYGEN=no
if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/ntqsql.html; then
KDE_HAS_DOXYGEN=yes KDE_HAS_DOXYGEN=yes
fi fi
AC_SUBST(KDE_HAS_DOXYGEN) AC_SUBST(KDE_HAS_DOXYGEN)

@ -16,11 +16,11 @@
***************************************************************************/ ***************************************************************************/
#include "boldlistboxitem.h" #include "boldlistboxitem.h"
#include <qpainter.h> #include <ntqpainter.h>
BoldListBoxItem::BoldListBoxItem(QListBox *listbox, const QPixmap &pix, BoldListBoxItem::BoldListBoxItem(TQListBox *listbox, const TQPixmap &pix,
const QString &text, bool bold) const TQString &text, bool bold)
: QListBoxPixmap(listbox, pix, text), m_bold(bold) : TQListBoxPixmap(listbox, pix, text), m_bold(bold)
{ {
} }
@ -28,12 +28,12 @@ BoldListBoxItem::~BoldListBoxItem()
{ {
} }
void BoldListBoxItem::paint(QPainter *painter) void BoldListBoxItem::paint(TQPainter *painter)
{ {
if (m_bold) { if (m_bold) {
QFont font = painter->font(); TQFont font = painter->font();
font.setBold(true); font.setBold(true);
painter->setFont(font); painter->setFont(font);
} }
QListBoxPixmap::paint(painter); TQListBoxPixmap::paint(painter);
} }

@ -18,19 +18,19 @@
#ifndef BOLDLISTBOXITEM_H #ifndef BOLDLISTBOXITEM_H
#define BOLDLISTBOXITEM_H #define BOLDLISTBOXITEM_H
#include <qlistbox.h> #include <ntqlistbox.h>
/**Listbox item that can optionally display its text in bold /**Listbox item that can optionally display its text in bold
*@author Leonid Zeitlin *@author Leonid Zeitlin
*/ */
class BoldListBoxItem : public QListBoxPixmap { class BoldListBoxItem : public TQListBoxPixmap {
private: private:
bool m_bold; bool m_bold;
protected: protected:
virtual void paint (QPainter *painter); virtual void paint (TQPainter *painter);
public: public:
BoldListBoxItem(QListBox *listbox, const QPixmap &pix, const QString &text, BoldListBoxItem(TQListBox *listbox, const TQPixmap &pix, const TQString &text,
bool bold = false); bool bold = false);
~BoldListBoxItem(); ~BoldListBoxItem();
bool bold() { return m_bold; } bool bold() { return m_bold; }

@ -16,10 +16,10 @@
***************************************************************************/ ***************************************************************************/
#include "boldmenuitem.h" #include "boldmenuitem.h"
#include <qfont.h> #include <ntqfont.h>
#include <qpainter.h> #include <ntqpainter.h>
#include <qpalette.h> #include <ntqpalette.h>
#include <qstyle.h> #include <ntqstyle.h>
#include <kdebug.h> #include <kdebug.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <kdeversion.h> #include <kdeversion.h>
@ -30,7 +30,7 @@
#endif #endif
BoldMenuItem::BoldMenuItem(const QString &text, const QColor &active_text_color, BoldMenuItem::BoldMenuItem(const TQString &text, const TQColor &active_text_color,
bool bold) bool bold)
: m_text(text), m_active_text_color(active_text_color), m_bold(bold) : m_text(text), m_active_text_color(active_text_color), m_bold(bold)
{ {
@ -39,10 +39,10 @@ BoldMenuItem::BoldMenuItem(const QString &text, const QColor &active_text_color,
BoldMenuItem::~BoldMenuItem(){ BoldMenuItem::~BoldMenuItem(){
} }
void BoldMenuItem::paint(QPainter* painter, const QColorGroup& /*cg*/, void BoldMenuItem::paint(TQPainter* painter, const TQColorGroup& /*cg*/,
bool act, bool /*enabled*/, int x, int y, int w, int h) bool act, bool /*enabled*/, int x, int y, int w, int h)
{ {
QFont font = painter->font(); TQFont font = painter->font();
if (font.bold() != m_bold) { if (font.bold() != m_bold) {
font.setBold(m_bold); font.setBold(m_bold);
painter->setFont(font); painter->setFont(font);
@ -54,15 +54,15 @@ void BoldMenuItem::paint(QPainter* painter, const QColorGroup& /*cg*/,
painter->drawText(x, y, w, h, AlignLeft | AlignVCenter | ShowPrefix | DontClip, painter->drawText(x, y, w, h, AlignLeft | AlignVCenter | ShowPrefix | DontClip,
m_text); m_text);
//KApplication::style().drawItem(painter, QRect(x, y, w, h), AlignLeft | AlignVCenter | ShowPrefix | DontClip, //KApplication::style().drawItem(painter, TQRect(x, y, w, h), AlignLeft | AlignVCenter | ShowPrefix | DontClip,
// cg, enabled, 0, m_text); // cg, enabled, 0, m_text);
} }
void BoldMenuItem::setFont(const QFont& font) void BoldMenuItem::setFont(const TQFont& font)
{ {
m_size = QFontMetrics(font).size(AlignLeft | AlignVCenter | ShowPrefix | DontClip, m_size = TQFontMetrics(font).size(AlignLeft | AlignVCenter | ShowPrefix | DontClip,
m_text); m_text);
QCustomMenuItem::setFont(font); TQCustomMenuItem::setFont(font);
} }

@ -18,35 +18,35 @@
#ifndef BOLDMENUITEM_H #ifndef BOLDMENUITEM_H
#define BOLDMENUITEM_H #define BOLDMENUITEM_H
#include <qmenudata.h> #include <ntqmenudata.h>
/**A custom menu item that can display its text in bold /**A custom menu item that can display its text in bold
*@author Leonid Zeitlin *@author Leonid Zeitlin
* 02.09.2001: somehow I cannot make it work. The item looks ok when not * 02.09.2001: somehow I cannot make it work. The item looks ok when not
* selected, but appears empty when selected. I have a suspicion that this * selected, but appears empty when selected. I have a suspicion that this
* is a problem with some KDE styles (B3 in particular), the style doesn't * is a problem with some KDE styles (B3 in particular), the style doesn't
* paint custom menu items correctly. With some other styles, such as Qt built-in * paint custom menu items correctly. With some other styles, such as TQt built-in
* Windows style, everything works correctly. I suspend the work on this for the * Windows style, everything works correctly. I suspend the work on this for the
* time being... * time being...
*/ */
class BoldMenuItem : public QCustomMenuItem { class BoldMenuItem : public TQCustomMenuItem {
private: private:
QString m_text; TQString m_text;
QColor m_active_text_color; TQColor m_active_text_color;
bool m_bold; bool m_bold;
QSize m_size; TQSize m_size;
public: public:
BoldMenuItem(const QString &text, const QColor &active_text_color, bool bold = false); BoldMenuItem(const TQString &text, const TQColor &active_text_color, bool bold = false);
~BoldMenuItem(); ~BoldMenuItem();
QString& text() { return m_text; }; TQString& text() { return m_text; };
void setText(const QString& value) { m_text = value; }; void setText(const TQString& value) { m_text = value; };
bool bold() { return m_bold; }; bool bold() { return m_bold; };
void setBold(bool value) { m_bold = value; }; void setBold(bool value) { m_bold = value; };
virtual void paint(QPainter* painter, const QColorGroup& /*cg*/, virtual void paint(TQPainter* painter, const TQColorGroup& /*cg*/,
bool act, bool /*enabled*/, int x, int y, int w, int h); bool act, bool /*enabled*/, int x, int y, int w, int h);
virtual void setFont(const QFont& font); virtual void setFont(const TQFont& font);
virtual QSize sizeHint() { return m_size; }; virtual TQSize sizeHint() { return m_size; };
}; };
#endif #endif

@ -30,9 +30,9 @@
#include <kdebug.h> #include <kdebug.h>
#include <kglobalaccel.h> #include <kglobalaccel.h>
#include <qnamespace.h> #include <ntqnamespace.h>
#include <qpainter.h> #include <ntqpainter.h>
#include <qimage.h> #include <ntqimage.h>
#include "kbconfig.h" #include "kbconfig.h"
#include "xkeyboard.h" #include "xkeyboard.h"
@ -79,20 +79,20 @@ void KBConfig::load(KConfig *config){
m_use_shortcuts = config->readBoolEntry(USE_SHORTCUTS_ENTRY, false); m_use_shortcuts = config->readBoolEntry(USE_SHORTCUTS_ENTRY, false);
XKeyboard *xkb = XKeyboard::self(); XKeyboard *xkb = XKeyboard::self();
QStringList list; TQStringList list;
xkb->getGroupNames(list); xkb->getGroupNames(list);
unsigned int i = 0; unsigned int i = 0;
m_groups.clear(); m_groups.clear();
m_groups.resize(xkb->getNumKbdGroups()); m_groups.resize(xkb->getNumKbdGroups());
QString name; TQString name;
for (QStringList::Iterator iter = list.begin(); iter != list.end(); iter++, i++) { for (TQStringList::Iterator iter = list.begin(); iter != list.end(); iter++, i++) {
name = *iter; name = *iter;
if (name == QString::null) name = i18n("<Unnamed>"); if (name == TQString::null) name = i18n("<Unnamed>");
m_groups.insert(i, new KBGroup(name)); m_groups.insert(i, new KBGroup(name));
} }
QValueVector<QPixmap> pixlist; TQValueVector<TQPixmap> pixlist;
QStringList iconpaths; TQStringList iconpaths;
drawIcons(m_icon_style, &pixlist, &iconpaths); drawIcons(m_icon_style, &pixlist, &iconpaths);
for (i = 0; i < m_groups.count(); i++) { for (i = 0; i < m_groups.count(); i++) {
m_groups[i]->setPixmap(pixlist[i]); m_groups[i]->setPixmap(pixlist[i]);
@ -102,9 +102,9 @@ void KBConfig::load(KConfig *config){
if (m_keys) delete m_keys; if (m_keys) delete m_keys;
m_keys = new KGlobalAccel(NULL); m_keys = new KGlobalAccel(NULL);
for (int i = 0; i < groupCount(); i++) { for (int i = 0; i < groupCount(); i++) {
m_keys->insert(QString::fromLatin1("SetGroup %1").arg(i), m_keys->insert(TQString::fromLatin1("SetGroup %1").arg(i),
i18n("Activate %1 keyboard layout").arg(m_groups[i]->getName()), i18n("Activate %1 keyboard layout").arg(m_groups[i]->getName()),
QString::null, Qt::ALT+Qt::CTRL+Qt::Key_1 + i, KKey::QtWIN+Qt::CTRL+Qt::Key_1 + i, TQString::null, TQt::ALT+TQt::CTRL+TQt::Key_1 + i, KKey::QtWIN+TQt::CTRL+TQt::Key_1 + i,
kapp, SLOT(slotGroupSelected(int))); kapp, SLOT(slotGroupSelected(int)));
} }
m_keys->readSettings(config); m_keys->readSettings(config);
@ -124,11 +124,11 @@ void KBConfig::save(KConfig *config)
m_keys->writeSettings(config); m_keys->writeSettings(config);
} }
void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, void KBConfig::drawIcons(IconStyle icon_style, TQValueVector<TQPixmap> *icons,
QStringList *iconpaths) TQStringList *iconpaths)
{ {
QString path, countryCode, langCode; TQString path, countryCode, langCode;
QStringList layouts; TQStringList layouts;
KGlobal::dirs()->addResourceDir("appdata", "."); KGlobal::dirs()->addResourceDir("appdata", ".");
KConfig map("group_names", true, true, "appdata"); KConfig map("group_names", true, true, "appdata");
@ -147,9 +147,9 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons,
map.setGroup("Languages"); map.setGroup("Languages");
langCode = map.readEntry(m_groups[i]->getName()); langCode = map.readEntry(m_groups[i]->getName());
if (langCode.isEmpty()) langCode = countryCode; if (langCode.isEmpty()) langCode = countryCode;
QPixmap &pix = (*icons)[i]; TQPixmap &pix = (*icons)[i];
pix.resize(0, 0); pix.resize(0, 0);
path = QString::null; path = TQString::null;
if (icon_style == ICON_FLAG /*&& !countryCode.isEmpty()*/) if (icon_style == ICON_FLAG /*&& !countryCode.isEmpty()*/)
drawFlagPixmap(pix, path, countryCode, i, config); drawFlagPixmap(pix, path, countryCode, i, config);
else if (icon_style == ICON_CODE_AND_FLAG /*&& !countryCode.isEmpty()*/) else if (icon_style == ICON_CODE_AND_FLAG /*&& !countryCode.isEmpty()*/)
@ -165,8 +165,8 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons,
/*void KBConfig::guessGroupPixmaps(){ /*void KBConfig::guessGroupPixmaps(){
KGlobal::dirs()->addResourceDir("appdata", "."); KGlobal::dirs()->addResourceDir("appdata", ".");
KConfig map("group_names", true, true, "appdata"); KConfig map("group_names", true, true, "appdata");
QString path, countryCode, langCode; TQString path, countryCode, langCode;
QPixmap pix; TQPixmap pix;
for (unsigned int i = 0; i < m_groups.count(); i++) { for (unsigned int i = 0; i < m_groups.count(); i++) {
if (m_groups[i]->getPixmap().isNull()) { if (m_groups[i]->getPixmap().isNull()) {
@ -187,7 +187,7 @@ void KBConfig::drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons,
} }
}*/ }*/
bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code, bool KBConfig::getGroupImage(TQImage &img, TQString &path, const TQString &code,
int group, KConfig *config) int group, KConfig *config)
{ {
bool ret = true; bool ret = true;
@ -197,12 +197,12 @@ bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code,
if (path.isEmpty() || !img.load(path)) { if (path.isEmpty() || !img.load(path)) {
if (code.isEmpty()) ret = false; if (code.isEmpty()) ret = false;
else { else {
path = locate("locale", QString("l10n/%1/flag.png").arg(code)); path = locate("locale", TQString("l10n/%1/flag.png").arg(code));
if (!path.isEmpty()) ret = img.load(path); if (!path.isEmpty()) ret = img.load(path);
else { else {
// I am told in Red Hat 9 standard KDE flag pixmaps are missing. // I am told in Red Hat 9 standard KDE flag pixmaps are missing.
// Workaround: we have to simulate them by rescaling GKB's pixmaps // Workaround: we have to simulate them by rescaling GKB's pixmaps
path = QString("/usr/share/pixmaps/gkb/%1.png").arg(code); path = TQString("/usr/share/pixmaps/gkb/%1.png").arg(code);
ret = img.load(path) && !img.isNull(); ret = img.load(path) && !img.isNull();
need_to_scale = true; need_to_scale = true;
} }
@ -216,62 +216,62 @@ bool KBConfig::getGroupImage(QImage &img, QString &path, const QString &code,
return ret; return ret;
} }
void KBConfig::drawFlagPixmap(QPixmap &pix, QString &path, const QString &code, void KBConfig::drawFlagPixmap(TQPixmap &pix, TQString &path, const TQString &code,
int group, KConfig *config) int group, KConfig *config)
{ {
QImage img; TQImage img;
if (getGroupImage(img, path, code, group, config)) if (getGroupImage(img, path, code, group, config))
pix.convertFromImage(img); pix.convertFromImage(img);
} }
void KBConfig::drawCodePixmap(QPixmap &pix, const QString &code) void KBConfig::drawCodePixmap(TQPixmap &pix, const TQString &code)
{ {
pix.resize(19, 16); pix.resize(19, 16);
QPainter painter(&pix); TQPainter painter(&pix);
QFont font("helvetica", 9, QFont::Bold); TQFont font("helvetica", 9, TQFont::Bold);
font.setPixelSize(10); font.setPixelSize(10);
painter.setFont(font); painter.setFont(font);
painter.setPen(KGlobalSettings::highlightedTextColor()); painter.setPen(KGlobalSettings::highlightedTextColor());
pix.fill(KGlobalSettings::highlightColor()); pix.fill(KGlobalSettings::highlightColor());
painter.drawText(1, 0, pix.width(), pix.height(), painter.drawText(1, 0, pix.width(), pix.height(),
Qt::AlignHCenter | Qt::AlignVCenter, code.upper()); TQt::AlignHCenter | TQt::AlignVCenter, code.upper());
/*QSize size = painter.fontMetrics().size(0, code.upper()); /*TQSize size = painter.fontMetrics().size(0, code.upper());
kdDebug() << size.width() << " x " << size.height() << endl;*/ kdDebug() << size.width() << " x " << size.height() << endl;*/
} }
void KBConfig::drawCodeAndFlagPixmap(QPixmap &pix, QString &path, void KBConfig::drawCodeAndFlagPixmap(TQPixmap &pix, TQString &path,
const QString &countryCode, const QString &langCode, int group, KConfig *config) const TQString &countryCode, const TQString &langCode, int group, KConfig *config)
{ {
QImage img; TQImage img;
if (!getGroupImage(img, path, countryCode, group, config)) return; // could not find flag if (!getGroupImage(img, path, countryCode, group, config)) return; // could not find flag
if (img.depth() <= 8) img = img.convertDepth(32); if (img.depth() <= 8) img = img.convertDepth(32);
// the following code is taken from kdebase/kxkb/pixmap.cpp // the following code is taken from kdebase/kxkb/pixmap.cpp
for (int y = 0; y < img.height(); y++) for (int y = 0; y < img.height(); y++)
for(int x = 0; x < img.width(); x++) { for(int x = 0; x < img.width(); x++) {
QRgb rgb = img.pixel(x, y); TQRgb rgb = img.pixel(x, y);
img.setPixel(x, y, qRgb(qRed(rgb)*3/4, qGreen(rgb)*3/4, qBlue(rgb)*3/4)); img.setPixel(x, y, tqRgb(tqRed(rgb)*3/4, tqGreen(rgb)*3/4, tqBlue(rgb)*3/4));
} }
pix.convertFromImage(img); pix.convertFromImage(img);
QPainter painter(&pix); TQPainter painter(&pix);
painter.setPen(Qt::black); painter.setPen(TQt::black);
painter.setFont(QFont("helvetica", 10, QFont::Bold)); painter.setFont(TQFont("helvetica", 10, TQFont::Bold));
painter.drawText(1, 1, pix.width(), pix.height()-2, Qt::AlignCenter, langCode); painter.drawText(1, 1, pix.width(), pix.height()-2, TQt::AlignCenter, langCode);
painter.setPen(Qt::white); painter.setPen(TQt::white);
painter.drawText(0, 0, pix.width(), pix.height()-2, Qt::AlignCenter, langCode); painter.drawText(0, 0, pix.width(), pix.height()-2, TQt::AlignCenter, langCode);
} }
void KBConfig::drawDefaultPixmap(QPixmap &pix, int group) void KBConfig::drawDefaultPixmap(TQPixmap &pix, int group)
{ {
pix.resize(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT); pix.resize(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT);
QPainter painter(&pix); TQPainter painter(&pix);
pix.fill(); pix.fill();
painter.drawText(0, 0, pix.width(), pix.height(), painter.drawText(0, 0, pix.width(), pix.height(),
Qt::AlignHCenter | Qt::AlignVCenter, QString::number(group+1)); TQt::AlignHCenter | TQt::AlignVCenter, TQString::number(group+1));
} }
void KBConfig::checkKeysEnabled() void KBConfig::checkKeysEnabled()
@ -283,14 +283,14 @@ void KBConfig::checkKeysEnabled()
/** No descriptions */ /** No descriptions */
/*void KBConfig::drawDefaultPixmaps(){ /*void KBConfig::drawDefaultPixmaps(){
QPixmap pix(16, 16); TQPixmap pix(16, 16);
QPainter painter(&pix); TQPainter painter(&pix);
for (unsigned int i = 0; i < m_groups.count(); i++) { for (unsigned int i = 0; i < m_groups.count(); i++) {
if (m_groups[i]->getPixmap().isNull()) { if (m_groups[i]->getPixmap().isNull()) {
pix.fill(); pix.fill();
painter.drawText(0, 0, pix.width(), pix.height(), painter.drawText(0, 0, pix.width(), pix.height(),
Qt::AlignHCenter | Qt::AlignVCenter, QString::number(i+1)); TQt::AlignHCenter | TQt::AlignVCenter, TQString::number(i+1));
m_groups[i]->setPixmap(pix); m_groups[i]->setPixmap(pix);
} }
} }
@ -298,8 +298,8 @@ void KBConfig::checkKeysEnabled()
/** No descriptions */ /** No descriptions */
/*void KBConfig::loadConfiguredPixmaps(KConfig *config){ /*void KBConfig::loadConfiguredPixmaps(KConfig *config){
QString path; TQString path;
QPixmap pix; TQPixmap pix;
config->setGroup(ICONS_SECTION); config->setGroup(ICONS_SECTION);
for (unsigned int i = 0; i < m_groups.count(); i++) { for (unsigned int i = 0; i < m_groups.count(); i++) {
path = config->readEntry(entryForGroup(i)); path = config->readEntry(entryForGroup(i));
@ -315,18 +315,18 @@ void KBConfig::checkKeysEnabled()
/*! /*!
\fn KBConfig::getXkbLayouts(const QStringList &layouts) \fn KBConfig::getXkbLayouts(const TQStringList &layouts)
*/ */
void KBConfig::getXkbLayouts(QStringList &layouts) void KBConfig::getXkbLayouts(TQStringList &layouts)
{ {
#if HAVE_X11_EXTENSIONS_XKBRULES_H && HAVE_LIBXKBFILE #if HAVE_X11_EXTENSIONS_XKBRULES_H && HAVE_LIBXKBFILE
XkbRF_VarDefsRec vardefs; XkbRF_VarDefsRec vardefs;
int i; int i;
usleep(10000); usleep(10000);
if (XkbRF_GetNamesProp(qt_xdisplay(), NULL, &vardefs)) { if (XkbRF_GetNamesProp(tqt_xdisplay(), NULL, &vardefs)) {
layouts = QStringList::split(',', vardefs.layout, true); layouts = TQStringList::split(',', vardefs.layout, true);
for (QStringList::Iterator it = layouts.begin(); it != layouts.end(); ++it) { for (TQStringList::Iterator it = layouts.begin(); it != layouts.end(); ++it) {
i = 0; i = 0;
while ((*it)[i] >= 'a' && (*it)[i] <= 'z') i++; while ((*it)[i] >= 'a' && (*it)[i] <= 'z') i++;
*it = (*it).left(i); *it = (*it).left(i);

@ -20,8 +20,8 @@
#include "kbgroup.h" #include "kbgroup.h"
#include <qptrvector.h> #include <ntqptrvector.h>
#include <qvaluevector.h> #include <ntqvaluevector.h>
#include <kconfig.h> #include <kconfig.h>
#define ICONS_SECTION "Icons" #define ICONS_SECTION "Icons"
@ -32,7 +32,7 @@
class KGlobalAccel; class KGlobalAccel;
typedef QPtrVector<KBGroup> KBGroupVector; typedef TQPtrVector<KBGroup> KBGroupVector;
/**The class that stores configuration information of KBSwitch /**The class that stores configuration information of KBSwitch
*@author Leonid Zeitlin *@author Leonid Zeitlin
@ -79,11 +79,11 @@ public:
void save(KConfig *config); void save(KConfig *config);
/** No descriptions */ /** No descriptions */
/*void notifyChanged();*/ /*void notifyChanged();*/
/*static QString entryForGroup(int i) { /*static TQString entryForGroup(int i) {
return QString("Group%1").arg(i+1); return TQString("Group%1").arg(i+1);
}*/ }*/
void drawIcons(IconStyle icon_style, QValueVector<QPixmap> *icons, void drawIcons(IconStyle icon_style, TQValueVector<TQPixmap> *icons,
QStringList *iconpaths); TQStringList *iconpaths);
void checkKeysEnabled(); void checkKeysEnabled();
int getNextGroup(int groupno) { int getNextGroup(int groupno) {
return groupno >= groupCount() - 1 ? 0 : groupno + 1; return groupno >= groupCount() - 1 ? 0 : groupno + 1;
@ -95,16 +95,16 @@ private: // Private methods
//void drawDefaultPixmaps(); //void drawDefaultPixmaps();
/** No descriptions */ /** No descriptions */
//void loadConfiguredPixmaps(KConfig *config); //void loadConfiguredPixmaps(KConfig *config);
void drawFlagPixmap(QPixmap &pix, QString &path, const QString &code, void drawFlagPixmap(TQPixmap &pix, TQString &path, const TQString &code,
int group, KConfig *config); int group, KConfig *config);
void drawCodePixmap(QPixmap &pix, const QString &code); void drawCodePixmap(TQPixmap &pix, const TQString &code);
void drawCodeAndFlagPixmap(QPixmap &pix, QString &path, void drawCodeAndFlagPixmap(TQPixmap &pix, TQString &path,
const QString &countryCode, const QString &langCode, int group, const TQString &countryCode, const TQString &langCode, int group,
KConfig *config); KConfig *config);
void drawDefaultPixmap(QPixmap &pix, int group); void drawDefaultPixmap(TQPixmap &pix, int group);
bool getGroupImage(QImage &img, QString &path, const QString &code, int group, bool getGroupImage(TQImage &img, TQString &path, const TQString &code, int group,
KConfig *config); KConfig *config);
void getXkbLayouts(QStringList &layouts); void getXkbLayouts(TQStringList &layouts);
}; };
#endif #endif

@ -19,17 +19,17 @@
#include "kbpickicondlg.h" #include "kbpickicondlg.h"
#include "boldlistboxitem.h" #include "boldlistboxitem.h"
#include <qlayout.h> #include <ntqlayout.h>
#include <qlabel.h> #include <ntqlabel.h>
#include <qcheckbox.h> #include <ntqcheckbox.h>
#include <qwhatsthis.h> #include <ntqwhatsthis.h>
#include <qvbox.h> #include <ntqvbox.h>
#include <qstyle.h> #include <ntqstyle.h>
#include <qgroupbox.h> #include <ntqgroupbox.h>
#include <qheader.h> #include <ntqheader.h>
#include <qobjectlist.h> #include <ntqobjectlist.h>
#include <qpushbutton.h> #include <ntqpushbutton.h>
#include <qcombobox.h> #include <ntqcombobox.h>
#include <kdeversion.h> #include <kdeversion.h>
#include <klistbox.h> #include <klistbox.h>
@ -50,12 +50,12 @@
*/ */
class SmallerKeyChooser : public KKeyChooser { class SmallerKeyChooser : public KKeyChooser {
private: private:
QSize m_size_hint; TQSize m_size_hint;
void calcSizeHint(); void calcSizeHint();
public: public:
SmallerKeyChooser(KGlobalAccel *accel, QWidget *parent) : SmallerKeyChooser(KGlobalAccel *accel, TQWidget *parent) :
KKeyChooser(accel, parent) { calcSizeHint(); } KKeyChooser(accel, parent) { calcSizeHint(); }
virtual QSize sizeHint() const { return m_size_hint; } virtual TQSize sizeHint() const { return m_size_hint; }
}; };
void SmallerKeyChooser::calcSizeHint() void SmallerKeyChooser::calcSizeHint()
@ -63,28 +63,28 @@ void SmallerKeyChooser::calcSizeHint()
m_size_hint = KKeyChooser::sizeHint(); m_size_hint = KKeyChooser::sizeHint();
KListView *lv = NULL; KListView *lv = NULL;
QGroupBox *gb = NULL; TQGroupBox *gb = NULL;
const QObjectList *objects = children(); const TQObjectList *objects = children();
QObjectListIt iter(*objects); TQObjectListIt iter(*objects);
QObject *obj; TQObject *obj;
while ( (obj = iter.current()) ) { while ( (obj = iter.current()) ) {
++iter; ++iter;
if (obj->inherits("KListView")) if (obj->inherits("KListView"))
lv = dynamic_cast<KListView*>(obj); lv = dynamic_cast<KListView*>(obj);
else if (obj->inherits("QGroupBox")) else if (obj->inherits("TQGroupBox"))
gb = dynamic_cast<QGroupBox*>(obj); gb = dynamic_cast<TQGroupBox*>(obj);
} }
if (!lv || !gb) return; // oops, should not happen if (!lv || !gb) return; // oops, should not happen
QListViewItem *item = lv->firstChild(); TQListViewItem *item = lv->firstChild();
if (!item) return; if (!item) return;
int height = item->height() * (1 + item->childCount()) + lv->header()->height() + int height = item->height() * (1 + item->childCount()) + lv->header()->height() +
style().pixelMetric(QStyle::PM_ScrollBarExtent) + gb->sizeHint().height() + style().pixelMetric(TQStyle::PM_ScrollBarExtent) + gb->sizeHint().height() +
layout()->spacing() * 2; layout()->spacing() * 2;
int width = lv->columnWidth(0) + lv->columnWidth(1); int width = lv->columnWidth(0) + lv->columnWidth(1);
m_size_hint = QSize(width, height); m_size_hint = TQSize(width, height);
} }
static inline bool iconTypeShowsFlag(KBConfig::IconStyle icon_style) static inline bool iconTypeShowsFlag(KBConfig::IconStyle icon_style)
@ -92,14 +92,14 @@ static inline bool iconTypeShowsFlag(KBConfig::IconStyle icon_style)
return icon_style == KBConfig::ICON_FLAG || icon_style == KBConfig::ICON_CODE_AND_FLAG; return icon_style == KBConfig::ICON_FLAG || icon_style == KBConfig::ICON_CODE_AND_FLAG;
} }
KBConfigDlg::KBConfigDlg(KBConfig *kbconf, QWidget *parent, const char *name ) KBConfigDlg::KBConfigDlg(KBConfig *kbconf, TQWidget *parent, const char *name )
: KDialogBase(Tabbed, i18n("Configure")/*caption*/, Ok | Apply | Cancel | Help, : KDialogBase(Tabbed, i18n("Configure")/*caption*/, Ok | Apply | Cancel | Help,
Ok, parent, name, true /*modal*/) Ok, parent, name, true /*modal*/)
{ {
m_kbconf = kbconf; m_kbconf = kbconf;
m_default_groupno = m_kbconf->default_groupno(); m_default_groupno = m_kbconf->default_groupno();
setHelp(QString("configure-kkbswitch")); setHelp(TQString("configure-kkbswitch"));
setButtonBoxOrientation(Horizontal); setButtonBoxOrientation(Horizontal);
setupGeneralPage(); setupGeneralPage();
setupShortcutsPage(); setupShortcutsPage();
@ -113,64 +113,64 @@ KBConfigDlg::~KBConfigDlg(){
void KBConfigDlg::setupGeneralPage() void KBConfigDlg::setupGeneralPage()
{ {
QFrame *page = addPage(i18n("&General")); //makeMainWidget(); TQFrame *page = addPage(i18n("&General")); //makeMainWidget();
QVBoxLayout *vlayout = new QVBoxLayout(page); TQVBoxLayout *vlayout = new TQVBoxLayout(page);
vlayout->setSpacing(2); vlayout->setSpacing(2);
QLabel *lbl = new QLabel(i18n("Available &keyboard layouts:"), page); TQLabel *lbl = new TQLabel(i18n("Available &keyboard layouts:"), page);
vlayout->addWidget(lbl); vlayout->addWidget(lbl);
QHBoxLayout *groupsLayout = new QHBoxLayout(vlayout); TQHBoxLayout *groupsLayout = new TQHBoxLayout(vlayout);
groupsLayout->setSpacing(2); groupsLayout->setSpacing(2);
lbGroups = new KListBox(page); lbGroups = new KListBox(page);
QObject::connect(lbGroups, SIGNAL(selectionChanged()), this, SLOT(slotLayoutSelected())); TQObject::connect(lbGroups, SIGNAL(selectionChanged()), this, SLOT(slotLayoutSelected()));
QObject::connect(lbGroups, SIGNAL(doubleClicked(QListBoxItem *)), this, TQObject::connect(lbGroups, SIGNAL(doubleClicked(TQListBoxItem *)), this,
SLOT(slotListBoxExecuted(QListBoxItem *))); SLOT(slotListBoxExecuted(TQListBoxItem *)));
groupsLayout->addWidget(lbGroups); groupsLayout->addWidget(lbGroups);
lbl->setBuddy(lbGroups); lbl->setBuddy(lbGroups);
QWhatsThis::add(lbGroups, i18n("This list box shows keyboard layouts available in your system.\n" TQWhatsThis::add(lbGroups, i18n("This list box shows keyboard layouts available in your system.\n"
"Select a layout and click \"Change Icon...\" button to change the icon for a layout.\n" "Select a layout and click \"Change Icon...\" button to change the icon for a layout.\n"
"If you have configured a non-default icon, you can reset the icon to default with \"Use Default Icon\" button.\n" "If you have configured a non-default icon, you can reset the icon to default with \"Use Default Icon\" button.\n"
"The layout shown is bold is the default layout. Use \"Set as default\" button " "The layout shown is bold is the default layout. Use \"Set as default\" button "
"to set the default layout.")); "to set the default layout."));
QVBoxLayout *btnLayout = new QVBoxLayout(groupsLayout); TQVBoxLayout *btnLayout = new TQVBoxLayout(groupsLayout);
btnLayout->setSpacing(2); btnLayout->setSpacing(2);
btnChangeIcon = new QPushButton(i18n("Cha&nge Icon..."), page); btnChangeIcon = new TQPushButton(i18n("Cha&nge Icon..."), page);
QObject::connect(btnChangeIcon, SIGNAL(clicked()), this, SLOT(slotPickIcon())); TQObject::connect(btnChangeIcon, SIGNAL(clicked()), this, SLOT(slotPickIcon()));
btnLayout->addWidget(btnChangeIcon, 0, Qt::AlignTop); btnLayout->addWidget(btnChangeIcon, 0, TQt::AlignTop);
QWhatsThis::add(btnChangeIcon, i18n("Click this button to change the icon for the " TQWhatsThis::add(btnChangeIcon, i18n("Click this button to change the icon for the "
"layout selected in the list box to the left.")); "layout selected in the list box to the left."));
btnSetDefaultIcon = new QPushButton(i18n("Use &Default Icon"), page); btnSetDefaultIcon = new TQPushButton(i18n("Use &Default Icon"), page);
QObject::connect(btnSetDefaultIcon, SIGNAL(clicked()), this, SLOT(slotSetDefaultIcon())); TQObject::connect(btnSetDefaultIcon, SIGNAL(clicked()), this, SLOT(slotSetDefaultIcon()));
btnLayout->addWidget(btnSetDefaultIcon, 0, Qt::AlignTop); btnLayout->addWidget(btnSetDefaultIcon, 0, TQt::AlignTop);
QWhatsThis::add(btnSetDefaultIcon, i18n("Click this button to use default icon for the " TQWhatsThis::add(btnSetDefaultIcon, i18n("Click this button to use default icon for the "
"layout selected in the list box to the left.")); "layout selected in the list box to the left."));
btnSetDefaultGroup = new QPushButton(i18n("&Set as Default"), page); btnSetDefaultGroup = new TQPushButton(i18n("&Set as Default"), page);
QObject::connect(btnSetDefaultGroup, SIGNAL(clicked()), this, SLOT(slotSetDefaultGroup())); TQObject::connect(btnSetDefaultGroup, SIGNAL(clicked()), this, SLOT(slotSetDefaultGroup()));
btnLayout->addWidget(btnSetDefaultGroup, 0, Qt::AlignTop); btnLayout->addWidget(btnSetDefaultGroup, 0, TQt::AlignTop);
QWhatsThis::add(btnSetDefaultGroup, i18n("Click this button to set the layout selected " TQWhatsThis::add(btnSetDefaultGroup, i18n("Click this button to set the layout selected "
"in the list box to the left as the default")); "in the list box to the left as the default"));
btnLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, btnLayout->addItem(new TQSpacerItem(1, 1, TQSizePolicy::Minimum,
QSizePolicy::MinimumExpanding)); TQSizePolicy::MinimumExpanding));
lbl = new QLabel(i18n("Layout &icon style:"), page); lbl = new TQLabel(i18n("Layout &icon style:"), page);
vlayout->addWidget(lbl); vlayout->addWidget(lbl);
cbxIconType = new QComboBox(page); cbxIconType = new TQComboBox(page);
cbxIconType->setEditable(false); cbxIconType->setEditable(false);
cbxIconType->insertItem(i18n("Country flag")); cbxIconType->insertItem(i18n("Country flag"));
cbxIconType->insertItem(i18n("Language code")); cbxIconType->insertItem(i18n("Language code"));
cbxIconType->insertItem(i18n("Flag and code")); cbxIconType->insertItem(i18n("Flag and code"));
QObject::connect(cbxIconType, SIGNAL(activated(int)), this, SLOT(slotIconTypeSelected(int))); TQObject::connect(cbxIconType, SIGNAL(activated(int)), this, SLOT(slotIconTypeSelected(int)));
vlayout->addWidget(cbxIconType); vlayout->addWidget(cbxIconType);
lbl->setBuddy(cbxIconType); lbl->setBuddy(cbxIconType);
QWhatsThis::add(cbxIconType, i18n("<p>Select the style of icons representing the " TQWhatsThis::add(cbxIconType, i18n("<p>Select the style of icons representing the "
"current keyboard layout.\n" "current keyboard layout.\n"
"You can choose from the following styles:" "You can choose from the following styles:"
"<ul><li><b>Country flag</b> - displays the corresponding country flag" "<ul><li><b>Country flag</b> - displays the corresponding country flag"
@ -178,17 +178,17 @@ void KBConfigDlg::setupGeneralPage()
"<li><b>Flag and code</b> - displays the language code superimposed over the country flag." "<li><b>Flag and code</b> - displays the language code superimposed over the country flag."
"</ul></p>")); "</ul></p>"));
lbl = new QLabel(i18n("&Layout applies to:"), page); lbl = new TQLabel(i18n("&Layout applies to:"), page);
vlayout->addWidget(lbl); vlayout->addWidget(lbl);
cbxGroupScope = new QComboBox(page); cbxGroupScope = new TQComboBox(page);
cbxGroupScope->setEditable(false); cbxGroupScope->setEditable(false);
cbxGroupScope->insertItem(i18n("All windows")); cbxGroupScope->insertItem(i18n("All windows"));
cbxGroupScope->insertItem(i18n("Windows of one application")); cbxGroupScope->insertItem(i18n("Windows of one application"));
cbxGroupScope->insertItem(i18n("One window")); cbxGroupScope->insertItem(i18n("One window"));
vlayout->addWidget(cbxGroupScope); vlayout->addWidget(cbxGroupScope);
lbl->setBuddy(cbxGroupScope); lbl->setBuddy(cbxGroupScope);
QWhatsThis::add(cbxGroupScope, i18n("<p>Select what windows the currently selected " TQWhatsThis::add(cbxGroupScope, i18n("<p>Select what windows the currently selected "
"keyboard layout applies to:\n" "keyboard layout applies to:\n"
"<ul><li><b>All windows</b> - one layout applies to all windows on your desktop\n" "<ul><li><b>All windows</b> - one layout applies to all windows on your desktop\n"
"<li><b>Windows of one application</b> - layout applies to one application; each " "<li><b>Windows of one application</b> - layout applies to one application; each "
@ -196,30 +196,30 @@ void KBConfigDlg::setupGeneralPage()
"<li><b>One window</b> - layout applies to one window only; each window can have its own layout. " "<li><b>One window</b> - layout applies to one window only; each window can have its own layout. "
"When you switch between windows, layout follows the active window.</ul></p>")); "When you switch between windows, layout follows the active window.</ul></p>"));
chkToggleMode = new QCheckBox(i18n("Use \"&Toggle Mode\""), page); chkToggleMode = new TQCheckBox(i18n("Use \"&Toggle Mode\""), page);
vlayout->addWidget(chkToggleMode); vlayout->addWidget(chkToggleMode);
QWhatsThis::add(chkToggleMode, i18n("Toggle mode is useful when you have more than two keyboard " TQWhatsThis::add(chkToggleMode, i18n("Toggle mode is useful when you have more than two keyboard "
"layouts defined. When toggle mode is on your normal layout switch key toggles between two most frequently used layouts. " "layouts defined. When toggle mode is on your normal layout switch key toggles between two most frequently used layouts. "
"To activate other layouts use KKBSwitch's tray popup menu")); "To activate other layouts use KKBSwitch's tray popup menu"));
/*chkPerwindowGroup = new QCheckBox(i18n("Use &per-window layout"), page); /*chkPerwindowGroup = new TQCheckBox(i18n("Use &per-window layout"), page);
vlayout->addWidget(chkPerwindowGroup); vlayout->addWidget(chkPerwindowGroup);
QWhatsThis::add(chkPerwindowGroup, i18n("When this checkbox is checked, " TQWhatsThis::add(chkPerwindowGroup, i18n("When this checkbox is checked, "
"each window has its own current keyboard layout. When it's unchecked, " "each window has its own current keyboard layout. When it's unchecked, "
"the current layout affects all windows"));*/ "the current layout affects all windows"));*/
chkAutostart = new QCheckBox(i18n("A&utostart"), page); chkAutostart = new TQCheckBox(i18n("A&utostart"), page);
vlayout->addWidget(chkAutostart); vlayout->addWidget(chkAutostart);
QWhatsThis::add(chkAutostart, i18n("When this checkbox is checked, KKBSwitch " TQWhatsThis::add(chkAutostart, i18n("When this checkbox is checked, KKBSwitch "
"will start automatically when you log in")); "will start automatically when you log in"));
} }
void KBConfigDlg::setupShortcutsPage() void KBConfigDlg::setupShortcutsPage()
{ {
QVBox *box = addVBoxPage(i18n("Sho&rtcuts")); TQVBox *box = addVBoxPage(i18n("Sho&rtcuts"));
chkUseShortcuts = new QCheckBox(i18n("Use shortcuts to &activate keyboard layouts"), box); chkUseShortcuts = new TQCheckBox(i18n("Use shortcuts to &activate keyboard layouts"), box);
connect(chkUseShortcuts, SIGNAL(toggled(bool)), this, SLOT(slotUseShortcutsToggled(bool))); connect(chkUseShortcuts, SIGNAL(toggled(bool)), this, SLOT(slotUseShortcutsToggled(bool)));
QWhatsThis::add(chkUseShortcuts, i18n("Check this checkbox to be able to quickly " TQWhatsThis::add(chkUseShortcuts, i18n("Check this checkbox to be able to quickly "
"activate any keyboard layout with keyboard shorcuts. Once this checkbox " "activate any keyboard layout with keyboard shorcuts. Once this checkbox "
"is checked, you can adjust the shortcuts at the key chooser pane below. " "is checked, you can adjust the shortcuts at the key chooser pane below. "
"Especially useful if you have three or four keyboard layouts configured")); "Especially useful if you have three or four keyboard layouts configured"));
@ -256,11 +256,11 @@ void KBConfigDlg::showConfig(){
/** Fire up "Pick Icon" dialog */ /** Fire up "Pick Icon" dialog */
void KBConfigDlg::slotPickIcon(){ void KBConfigDlg::slotPickIcon(){
int index = lbGroups->currentItem(); int index = lbGroups->currentItem();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
KBPickIconDlg dlg(m_iconpaths[index], *(lbGroups->pixmap(index)), this); KBPickIconDlg dlg(m_iconpaths[index], *(lbGroups->pixmap(index)), this);
QApplication::restoreOverrideCursor(); TQApplication::restoreOverrideCursor();
if (dlg.exec()) { if (dlg.exec()) {
QString path = dlg.getIconPath(); TQString path = dlg.getIconPath();
KBGroup *group = m_kbconf->getGroup(index); KBGroup *group = m_kbconf->getGroup(index);
if (!path.isEmpty() && path != group->getIconPath()) { if (!path.isEmpty() && path != group->getIconPath()) {
kapp->config()->writeEntry(group->getName()/*KBConfig::entryForGroup(index)*/, path); kapp->config()->writeEntry(group->getName()/*KBConfig::entryForGroup(index)*/, path);
@ -277,7 +277,7 @@ void KBConfigDlg::slotSetDefaultGroup()
BoldListBoxItem *item = dynamic_cast<BoldListBoxItem*>(lbGroups->item(m_default_groupno)); BoldListBoxItem *item = dynamic_cast<BoldListBoxItem*>(lbGroups->item(m_default_groupno));
item->setBold(false); item->setBold(false);
m_default_groupno = new_default_group; m_default_groupno = new_default_group;
// NB: don't use selectedItem(); it's not present in Qt 3.0, and // NB: don't use selectedItem(); it's not present in TQt 3.0, and
// we want to maintain compatibility with it // we want to maintain compatibility with it
int curitem = lbGroups->currentItem(); int curitem = lbGroups->currentItem();
if (curitem > -1) { // should not be -1, but just in case if (curitem > -1) { // should not be -1, but just in case
@ -298,15 +298,15 @@ void KBConfigDlg::slotLayoutSelected(){
} }
/** No descriptions */ /** No descriptions */
void KBConfigDlg::slotListBoxExecuted(QListBoxItem *){ void KBConfigDlg::slotListBoxExecuted(TQListBoxItem *){
if (iconTypeShowsFlag(KBConfig::IconStyle(cbxIconType->currentItem()))) if (iconTypeShowsFlag(KBConfig::IconStyle(cbxIconType->currentItem())))
slotPickIcon(); slotPickIcon();
} }
/** No descriptions */ /** No descriptions */
void KBConfigDlg::saveConfig(){ void KBConfigDlg::saveConfig(){
QString path; TQString path;
const QPixmap *pix; const TQPixmap *pix;
KConfig *conf = kapp->config(); KConfig *conf = kapp->config();
conf->setGroup(ICONS_SECTION); conf->setGroup(ICONS_SECTION);
for (int i = 0; i < m_kbconf->groupCount(); i++) { for (int i = 0; i < m_kbconf->groupCount(); i++) {
@ -353,10 +353,10 @@ void KBConfigDlg::slotIconTypeSelected(int index)
void KBConfigDlg::redrawIcons(KBConfig::IconStyle icon_style) void KBConfigDlg::redrawIcons(KBConfig::IconStyle icon_style)
{ {
QValueVector<QPixmap> pixlist; TQValueVector<TQPixmap> pixlist;
m_kbconf->drawIcons(icon_style, &pixlist, &m_iconpaths); m_kbconf->drawIcons(icon_style, &pixlist, &m_iconpaths);
int curIndex = lbGroups->currentItem(); int curIndex = lbGroups->currentItem();
// NB: don't use count(), use size(); count() is not present in Qt 3.0, and // NB: don't use count(), use size(); count() is not present in TQt 3.0, and
// we want to maintain compatibility with it // we want to maintain compatibility with it
for (unsigned int i = 0; i < pixlist.size(); i++) { for (unsigned int i = 0; i < pixlist.size(); i++) {
BoldListBoxItem *curItem = dynamic_cast<BoldListBoxItem*>(lbGroups->item(i)); BoldListBoxItem *curItem = dynamic_cast<BoldListBoxItem*>(lbGroups->item(i));

@ -21,11 +21,11 @@
#include <kdialogbase.h> #include <kdialogbase.h>
#include "kbconfig.h" #include "kbconfig.h"
class QWidget; class TQWidget;
class QCheckBox; class TQCheckBox;
class QPushButton; class TQPushButton;
class QComboBox; class TQComboBox;
class QStringList; class TQStringList;
class KKeyChooser; class KKeyChooser;
@ -36,23 +36,23 @@ class KKeyChooser;
class KBConfigDlg : public KDialogBase { class KBConfigDlg : public KDialogBase {
Q_OBJECT Q_OBJECT
public: public:
KBConfigDlg(KBConfig *kbconf, QWidget *parent=0, const char *name=0); KBConfigDlg(KBConfig *kbconf, TQWidget *parent=0, const char *name=0);
~KBConfigDlg(); ~KBConfigDlg();
private: // Private attributes private: // Private attributes
/** */ /** */
KListBox *lbGroups; KListBox *lbGroups;
/** */ /** */
QCheckBox *chkToggleMode; TQCheckBox *chkToggleMode;
//QCheckBox *chkPerwindowGroup; //TQCheckBox *chkPerwindowGroup;
QCheckBox *chkAutostart; TQCheckBox *chkAutostart;
QPushButton *btnChangeIcon; TQPushButton *btnChangeIcon;
QPushButton *btnSetDefaultIcon; TQPushButton *btnSetDefaultIcon;
QPushButton *btnSetDefaultGroup; TQPushButton *btnSetDefaultGroup;
QComboBox *cbxIconType; TQComboBox *cbxIconType;
QComboBox *cbxGroupScope; TQComboBox *cbxGroupScope;
KKeyChooser *keyChooser; KKeyChooser *keyChooser;
QCheckBox *chkUseShortcuts; TQCheckBox *chkUseShortcuts;
QStringList m_iconpaths; TQStringList m_iconpaths;
int m_default_groupno; int m_default_groupno;
KBConfig *m_kbconf; KBConfig *m_kbconf;
/** Display the current KBSwitch configuration in the dialog */ /** Display the current KBSwitch configuration in the dialog */
@ -69,7 +69,7 @@ private slots: // Private slots
/** No descriptions */ /** No descriptions */
void slotLayoutSelected(); void slotLayoutSelected();
/** No descriptions */ /** No descriptions */
void slotListBoxExecuted(QListBoxItem *item); void slotListBoxExecuted(TQListBoxItem *item);
void slotIconTypeSelected(int index); void slotIconTypeSelected(int index);
void slotUseShortcutsToggled(bool on); void slotUseShortcutsToggled(bool on);
void slotSetDefaultIcon(); void slotSetDefaultIcon();

@ -18,7 +18,7 @@
#include "kbgroup.h" #include "kbgroup.h"
#include <kdebug.h> #include <kdebug.h>
KBGroup::KBGroup(const QString& name){ KBGroup::KBGroup(const TQString& name){
m_name = name; m_name = name;
} }

@ -18,8 +18,8 @@
#ifndef KBGROUP_H #ifndef KBGROUP_H
#define KBGROUP_H #define KBGROUP_H
#include <qpixmap.h> #include <ntqpixmap.h>
#include <qstring.h> #include <ntqstring.h>
/**A helper class the holds keyboard group's name and pixmap /**A helper class the holds keyboard group's name and pixmap
*@author Leonid Zeitlin *@author Leonid Zeitlin
@ -27,22 +27,22 @@
class KBGroup { class KBGroup {
public: public:
KBGroup(const QString& name); KBGroup(const TQString& name);
~KBGroup(); ~KBGroup();
/** */ /** */
const QPixmap& getPixmap() { return m_pixmap; } const TQPixmap& getPixmap() { return m_pixmap; }
/** No descriptions */ /** No descriptions */
const QString& getName() { return m_name; } const TQString& getName() { return m_name; }
/** No descriptions */ /** No descriptions */
void setPixmap(const QPixmap& pixmap) { m_pixmap = pixmap; } void setPixmap(const TQPixmap& pixmap) { m_pixmap = pixmap; }
const QString& getIconPath() { return m_iconpath; } const TQString& getIconPath() { return m_iconpath; }
void setIconPath(const QString &iconpath) { m_iconpath = iconpath; } void setIconPath(const TQString &iconpath) { m_iconpath = iconpath; }
private: // Private attributes private: // Private attributes
/** */ /** */
QString m_name; TQString m_name;
/** */ /** */
QPixmap m_pixmap; TQPixmap m_pixmap;
QString m_iconpath; TQString m_iconpath;
}; };
#endif #endif

@ -17,11 +17,11 @@
#include "kbpickicondlg.h" #include "kbpickicondlg.h"
#include <qvbox.h> #include <ntqvbox.h>
#include <qdir.h> #include <ntqdir.h>
#include <qwhatsthis.h> #include <ntqwhatsthis.h>
#include <qpushbutton.h> #include <ntqpushbutton.h>
#include <qimage.h> #include <ntqimage.h>
#include <kdeversion.h> #include <kdeversion.h>
#include <klocale.h> #include <klocale.h>
@ -37,21 +37,21 @@
#include "kbconfig.h" #include "kbconfig.h"
#include "pathlistboxitem.h" #include "pathlistboxitem.h"
KBPickIconDlg::KBPickIconDlg(const QString &currentPath, const QPixmap &currentPixmap, KBPickIconDlg::KBPickIconDlg(const TQString &currentPath, const TQPixmap &currentPixmap,
QWidget *parent, const char *name ) TQWidget *parent, const char *name )
: KDialogBase(parent, name, true /*modal*/, i18n("Pick an icon") /*caption*/, Ok | Cancel) { : KDialogBase(parent, name, true /*modal*/, i18n("Pick an icon") /*caption*/, Ok | Cancel) {
QVBox *page = makeVBoxMainWidget(); TQVBox *page = makeVBoxMainWidget();
lbIcons = new KListBox(page); lbIcons = new KListBox(page);
QObject::connect(lbIcons, SIGNAL(doubleClicked(QListBoxItem*)), TQObject::connect(lbIcons, SIGNAL(doubleClicked(TQListBoxItem*)),
this, SLOT(slotOk())); this, SLOT(slotOk()));
QObject::connect(lbIcons, SIGNAL(returnPressed(QListBoxItem*)), TQObject::connect(lbIcons, SIGNAL(returnPressed(TQListBoxItem*)),
this, SLOT(slotOk())); this, SLOT(slotOk()));
QWhatsThis::add(lbIcons, i18n("Select one of the icons")); TQWhatsThis::add(lbIcons, i18n("Select one of the icons"));
QPushButton *btnBrowse = new QPushButton(i18n("&Browse..."), page); TQPushButton *btnBrowse = new TQPushButton(i18n("&Browse..."), page);
QObject::connect(btnBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseForIcon())); TQObject::connect(btnBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseForIcon()));
QWhatsThis::add(btnBrowse, i18n("Browse for an image file to use as an icon")); TQWhatsThis::add(btnBrowse, i18n("Browse for an image file to use as an icon"));
loadCountryFlags(); loadCountryFlags();
@ -69,15 +69,15 @@ KBPickIconDlg::~KBPickIconDlg(){
} }
/** Get the path name of the selected icon. Returns empty string if no icon selected */ /** Get the path name of the selected icon. Returns empty string if no icon selected */
QString KBPickIconDlg::getIconPath(){ TQString KBPickIconDlg::getIconPath(){
QListBoxItem *item = lbIcons->selectedItem(); TQListBoxItem *item = lbIcons->selectedItem();
if (item) if (item)
return dynamic_cast<PathListBoxItem*>(item)->path; return dynamic_cast<PathListBoxItem*>(item)->path;
else return QString::null; // should not happen else return TQString::null; // should not happen
} }
/** No descriptions */ /** No descriptions */
const QPixmap* KBPickIconDlg::getIcon(){ const TQPixmap* KBPickIconDlg::getIcon(){
if (lbIcons->currentItem() != -1) if (lbIcons->currentItem() != -1)
return lbIcons->pixmap(lbIcons->currentItem()); return lbIcons->pixmap(lbIcons->currentItem());
else return NULL; else return NULL;
@ -86,13 +86,13 @@ const QPixmap* KBPickIconDlg::getIcon(){
/** Browse for an arbitrary icon file */ /** Browse for an arbitrary icon file */
void KBPickIconDlg::slotBrowseForIcon() void KBPickIconDlg::slotBrowseForIcon()
{ {
QString iconPath = KFileDialog::getOpenFileName(QString::null, TQString iconPath = KFileDialog::getOpenFileName(TQString::null,
i18n("*.png *.jpg *.gif *.xpm|Icon files (*.png, *.jpg, *.gif, *.xpm)\n*.*|All files (*.*)")); i18n("*.png *.jpg *.gif *.xpm|Icon files (*.png, *.jpg, *.gif, *.xpm)\n*.*|All files (*.*)"));
if (iconPath.isEmpty()) return; if (iconPath.isEmpty()) return;
QImage img; TQImage img;
if (img.load(iconPath)) { if (img.load(iconPath)) {
double aspectRatio = img.width() / img.height(); double aspectRatio = img.width() / img.height();
QString message = QString::null; TQString message = TQString::null;
bool too_big, too_wide, too_narrow; bool too_big, too_wide, too_narrow;
too_narrow = aspectRatio < FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT - 0.1; too_narrow = aspectRatio < FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT - 0.1;
too_wide = aspectRatio > FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT + 0.1; too_wide = aspectRatio > FLAG_ICON_WIDTH / FLAG_ICON_HEIGHT + 0.1;
@ -102,7 +102,7 @@ void KBPickIconDlg::slotBrowseForIcon()
"Preferred size for the layout icons is %3 by %4.\n") "Preferred size for the layout icons is %3 by %4.\n")
.arg(img.width()).arg(img.height()).arg(FLAG_ICON_WIDTH).arg(FLAG_ICON_HEIGHT); .arg(img.width()).arg(img.height()).arg(FLAG_ICON_WIDTH).arg(FLAG_ICON_HEIGHT);
if (too_big) { if (too_big) {
QString msg_tail = ""; TQString msg_tail = "";
if (too_wide) msg_tail = i18n(" and also too wide"); if (too_wide) msg_tail = i18n(" and also too wide");
else if (too_narrow) msg_tail += i18n(" and also too narrow"); else if (too_narrow) msg_tail += i18n(" and also too narrow");
message += i18n("This image is too big%1.").arg(msg_tail); message += i18n("This image is too big%1.").arg(msg_tail);
@ -116,9 +116,9 @@ void KBPickIconDlg::slotBrowseForIcon()
} }
if (img.width() > FLAG_ICON_WIDTH + 3 || img.height() > FLAG_ICON_HEIGHT + 3) if (img.width() > FLAG_ICON_WIDTH + 3 || img.height() > FLAG_ICON_HEIGHT + 3)
img = img.smoothScale(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT); img = img.smoothScale(FLAG_ICON_WIDTH, FLAG_ICON_HEIGHT);
QPixmap pix; TQPixmap pix;
pix.convertFromImage(img); pix.convertFromImage(img);
PathListBoxItem *item = new PathListBoxItem(lbIcons, pix, QFileInfo(iconPath).fileName(), PathListBoxItem *item = new PathListBoxItem(lbIcons, pix, TQFileInfo(iconPath).fileName(),
iconPath); iconPath);
lbIcons->setSelected(item, true); lbIcons->setSelected(item, true);
lbIcons->centerCurrentItem(); lbIcons->centerCurrentItem();
@ -129,16 +129,16 @@ void KBPickIconDlg::slotBrowseForIcon()
void KBPickIconDlg::loadCountryFlags() void KBPickIconDlg::loadCountryFlags()
{ {
QPixmap pix; TQPixmap pix;
QDir dir; TQDir dir;
QStringList locales; TQStringList locales;
QString path; TQString path;
QStringList dirs = KGlobal::dirs()->findDirs("locale", "l10n"); TQStringList dirs = KGlobal::dirs()->findDirs("locale", "l10n");
for (QStringList::Iterator dirIter = dirs.begin(); dirIter != dirs.end(); dirIter++) { for (TQStringList::Iterator dirIter = dirs.begin(); dirIter != dirs.end(); dirIter++) {
dir.setPath(*dirIter); dir.setPath(*dirIter);
locales = dir.entryList(QDir::Dirs, QDir::Name); locales = dir.entryList(TQDir::Dirs, TQDir::Name);
for (QStringList::Iterator iter = locales.begin(); iter != locales.end(); iter++) { for (TQStringList::Iterator iter = locales.begin(); iter != locales.end(); iter++) {
path = dir.path() + "/" + *iter + "/flag.png"; path = dir.path() + "/" + *iter + "/flag.png";
if (*iter != "." && *iter != ".." && pix.load(path)) { if (*iter != "." && *iter != ".." && pix.load(path)) {
KConfig config(dir.path() + "/" + *iter + "/entry.desktop", true, false, KConfig config(dir.path() + "/" + *iter + "/entry.desktop", true, false,
@ -152,16 +152,16 @@ void KBPickIconDlg::loadCountryFlags()
void KBPickIconDlg::loadGkbCountryFlags() void KBPickIconDlg::loadGkbCountryFlags()
{ {
QDir dir; TQDir dir;
QString path, code, name; TQString path, code, name;
QPixmap pix; TQPixmap pix;
QImage img; TQImage img;
dir.setPath("/usr/share/pixmaps/gkb"); dir.setPath("/usr/share/pixmaps/gkb");
const QFileInfoList *icons = dir.entryInfoList(QDir::Files, QDir::Name); const TQFileInfoList *icons = dir.entryInfoList(TQDir::Files, TQDir::Name);
if (icons) { if (icons) {
QFileInfoListIterator iter(*icons); TQFileInfoListIterator iter(*icons);
QFileInfo *info; TQFileInfo *info;
for (; (info = iter.current()); ++iter) { for (; (info = iter.current()); ++iter) {
path = info->filePath(); path = info->filePath();
code = info->baseName(); code = info->baseName();
@ -178,8 +178,8 @@ void KBPickIconDlg::loadGkbCountryFlags()
} }
} }
void KBPickIconDlg::showCurrentPath(const QString &currentPath, void KBPickIconDlg::showCurrentPath(const TQString &currentPath,
const QPixmap &currentPixmap) const TQPixmap &currentPixmap)
{ {
PathListBoxItem *item = NULL; PathListBoxItem *item = NULL;
bool itemFound = false; bool itemFound = false;
@ -193,11 +193,11 @@ void KBPickIconDlg::showCurrentPath(const QString &currentPath,
// why this strange manipulation of HScrollBarMode? // why this strange manipulation of HScrollBarMode?
// Strangely, without it, if the selected item is the last in the listbox, it ends up // Strangely, without it, if the selected item is the last in the listbox, it ends up
// being obscured by the horizontal scrollbar // being obscured by the horizontal scrollbar
lbIcons->setHScrollBarMode(QScrollView::AlwaysOn); lbIcons->setHScrollBarMode(TQScrollView::AlwaysOn);
if (!itemFound) item = new PathListBoxItem(lbIcons, currentPixmap, if (!itemFound) item = new PathListBoxItem(lbIcons, currentPixmap,
QFileInfo(currentPath).fileName(), currentPath); TQFileInfo(currentPath).fileName(), currentPath);
lbIcons->updateScrollBars(); lbIcons->updateScrollBars();
lbIcons->setSelected(item, true); lbIcons->setSelected(item, true);
lbIcons->ensureCurrentVisible(); lbIcons->ensureCurrentVisible();
lbIcons->setHScrollBarMode(QScrollView::Auto); lbIcons->setHScrollBarMode(TQScrollView::Auto);
} }

@ -20,9 +20,9 @@
#include <kdialogbase.h> #include <kdialogbase.h>
class QWidget; class TQWidget;
class QStringList; class TQStringList;
class QPixmap; class TQPixmap;
class KListBox; class KListBox;
/**A dialog to pick an icon for a keyboard layout /**A dialog to pick an icon for a keyboard layout
@ -32,30 +32,30 @@ class KListBox;
class KBPickIconDlg : public KDialogBase { class KBPickIconDlg : public KDialogBase {
Q_OBJECT Q_OBJECT
public: public:
KBPickIconDlg(const QString &currentPath, const QPixmap &currentPixmap, KBPickIconDlg(const TQString &currentPath, const TQPixmap &currentPixmap,
QWidget *parent=0, const char *name=0); TQWidget *parent=0, const char *name=0);
~KBPickIconDlg(); ~KBPickIconDlg();
/** Get the path name of the selected icon. Returns empty string if no icon selected */ /** Get the path name of the selected icon. Returns empty string if no icon selected */
QString getIconPath(); TQString getIconPath();
/** No descriptions */ /** No descriptions */
const QPixmap* getIcon(); const TQPixmap* getIcon();
private: // Private attributes private: // Private attributes
/** */ /** */
//QStringList m_pathnames; //TQStringList m_pathnames;
//QString m_iconpath; //TQString m_iconpath;
//KIconView *m_iconview; //KIconView *m_iconview;
KListBox *lbIcons; KListBox *lbIcons;
//QLabel *lblIcon; //TQLabel *lblIcon;
//QRadioButton *rbFlags; //TQRadioButton *rbFlags;
//QRadioButton *rbBrowse; //TQRadioButton *rbBrowse;
void loadCountryFlags(); void loadCountryFlags();
void loadGkbCountryFlags(); void loadGkbCountryFlags();
void showCurrentPath(const QString &currentPath, const QPixmap &currentPixmap); void showCurrentPath(const TQString &currentPath, const TQPixmap &currentPixmap);
private slots: // Private slots private slots: // Private slots
/** Browse for an arbitrary icon file */ /** Browse for an arbitrary icon file */
void slotBrowseForIcon(); void slotBrowseForIcon();
/** Respond to user selecting a flag in the icon view */ /** Respond to user selecting a flag in the icon view */
//void slotFlagSelected(QIconViewItem *item); //void slotFlagSelected(TQIconViewItem *item);
}; };
#endif #endif

@ -45,20 +45,20 @@ KBSwitchApp::KBSwitchApp()
#endif #endif
m_intf = new KBSwitchIntf(this, &m_kbconf); m_intf = new KBSwitchIntf(this, &m_kbconf);
QObject::connect(m_intf, SIGNAL(nextGroupSelected()), this, SLOT(slotSelectNextGroup())); TQObject::connect(m_intf, SIGNAL(nextGroupSelected()), this, SLOT(slotSelectNextGroup()));
QObject::connect(m_intf, SIGNAL(groupSelected(int)), this, SLOT(slotGroupSelected(int))); TQObject::connect(m_intf, SIGNAL(groupSelected(int)), this, SLOT(slotGroupSelected(int)));
QObject::connect(&m_xkb, SIGNAL(layoutChanged()), this, SLOT(reconfigure())); TQObject::connect(&m_xkb, SIGNAL(layoutChanged()), this, SLOT(reconfigure()));
QObject::connect(&m_xkb, SIGNAL(groupChanged(int)), this, SLOT(slotXkbGroupChanged(int))); TQObject::connect(&m_xkb, SIGNAL(groupChanged(int)), this, SLOT(slotXkbGroupChanged(int)));
m_force_group_setting = false; m_force_group_setting = false;
int start_group = m_kbconf.default_groupno(); int start_group = m_kbconf.default_groupno();
m_trayicon = new KBSwitchTrayIcon(&m_kbconf); m_trayicon = new KBSwitchTrayIcon(&m_kbconf);
QObject::connect(m_trayicon, SIGNAL(groupSelected(int)), this, TQObject::connect(m_trayicon, SIGNAL(groupSelected(int)), this,
SLOT(slotGroupSelected(int))); SLOT(slotGroupSelected(int)));
QObject::connect(m_trayicon, SIGNAL(clicked()), this, SLOT(slotSelectNextGroup())); TQObject::connect(m_trayicon, SIGNAL(clicked()), this, SLOT(slotSelectNextGroup()));
QObject::connect(m_trayicon, SIGNAL(preferencesSelected()), this, TQObject::connect(m_trayicon, SIGNAL(preferencesSelected()), this,
SLOT(slotPreferences())); SLOT(slotPreferences()));
if (start_group != m_xkb.getGroupNo()) { if (start_group != m_xkb.getGroupNo()) {
@ -144,10 +144,10 @@ void KBSwitchApp::slotSelectNextGroup()
/** No descriptions */ /** No descriptions */
void KBSwitchApp::slotPreferences(){ void KBSwitchApp::slotPreferences(){
KBConfigDlg dlg(&m_kbconf); KBConfigDlg dlg(&m_kbconf);
QObject::connect(&dlg, SIGNAL(okClicked()), m_trayicon, SLOT(slotUpdateIcons())); TQObject::connect(&dlg, SIGNAL(okClicked()), m_trayicon, SLOT(slotUpdateIcons()));
QObject::connect(&dlg, SIGNAL(applyClicked()), m_trayicon, SLOT(slotUpdateIcons())); TQObject::connect(&dlg, SIGNAL(applyClicked()), m_trayicon, SLOT(slotUpdateIcons()));
QObject::connect(&dlg, SIGNAL(okClicked()), this, SLOT(slotPrefChanged())); TQObject::connect(&dlg, SIGNAL(okClicked()), this, SLOT(slotPrefChanged()));
QObject::connect(&dlg, SIGNAL(applyClicked()), this, SLOT(slotPrefChanged())); TQObject::connect(&dlg, SIGNAL(applyClicked()), this, SLOT(slotPrefChanged()));
dlg.exec(); dlg.exec();
} }
@ -179,7 +179,7 @@ void KBSwitchApp::slotXkbGroupChanged(int groupno){
#ifdef HAVE_LIBXKLAVIER #ifdef HAVE_LIBXKLAVIER
updateIcon(groupno); updateIcon(groupno);
/* XWindowAttributes attrs; /* XWindowAttributes attrs;
XGetWindowAttributes(qt_xdisplay(), qt_xrootwin(), &attrs); XGetWindowAttributes(tqt_xdisplay(), tqt_xrootwin(), &attrs);
kdDebug() << "root event mask is " << attrs.your_event_mask << endl; kdDebug() << "root event mask is " << attrs.your_event_mask << endl;
kdDebug() << "SubstructureNotifyMask is " << kdDebug() << "SubstructureNotifyMask is " <<
((attrs.your_event_mask & SubstructureNotifyMask) ? "ON" : "OFF") << endl;*/ ((attrs.your_event_mask & SubstructureNotifyMask) ? "ON" : "OFF") << endl;*/

@ -29,7 +29,7 @@
#include <kuniqueapp.h> #include <kuniqueapp.h>
#endif #endif
//#include <qmap.h> //#include <ntqmap.h>
#include "kbgroup.h" #include "kbgroup.h"
#include "kbswitchtrayicon.h" #include "kbswitchtrayicon.h"
@ -45,7 +45,7 @@ typedef struct _KBWinInfo {
int next_groupno; int next_groupno;
} KBWinInfo; } KBWinInfo;
typedef QMap<WId, KBWinInfo> KBWindowMap;*/ typedef TQMap<WId, KBWinInfo> KBWindowMap;*/
/** /**
*@author Leonid Zeitlin *@author Leonid Zeitlin

@ -18,8 +18,8 @@
#include "kbswitchintf.h" #include "kbswitchintf.h"
//#include <kapp.h> //#include <kapp.h>
KBSwitchIntf::KBSwitchIntf(QObject *parent, KBConfig *conf) KBSwitchIntf::KBSwitchIntf(TQObject *parent, KBConfig *conf)
: QObject(parent, "KBSwitchIntf"), DCOPObject("KBSwitchIntf") : TQObject(parent, "KBSwitchIntf"), DCOPObject("KBSwitchIntf")
{ {
m_kbconf = conf; m_kbconf = conf;
} }
@ -42,9 +42,9 @@ ASYNC KBSwitchIntf::selectGroup(int groupno)
emit groupSelected(groupno); emit groupSelected(groupno);
} }
QStringList KBSwitchIntf::getGroupNames() TQStringList KBSwitchIntf::getGroupNames()
{ {
QStringList result; TQStringList result;
for (int i = 0; i < m_kbconf->groupCount(); i++) for (int i = 0; i < m_kbconf->groupCount(); i++)
result.append(m_kbconf->getGroup(i)->getName()); result.append(m_kbconf->getGroup(i)->getName());
return result; return result;

@ -19,8 +19,8 @@
#define KBSWITCHINTF_H #define KBSWITCHINTF_H
#include <dcopobject.h> #include <dcopobject.h>
#include <qobject.h> #include <ntqobject.h>
#include <qstringlist.h> #include <ntqstringlist.h>
#include "kbconfig.h" #include "kbconfig.h"
@ -33,14 +33,14 @@
separated the signals and k_dcop sections with the public section everything worked. separated the signals and k_dcop sections with the public section everything worked.
Apparently, the k_dcop "keyword" confuses moc, which is only natural given that Apparently, the k_dcop "keyword" confuses moc, which is only natural given that
moc doesn't know about dcopidl! */ moc doesn't know about dcopidl! */
class KBSwitchIntf : public QObject, public DCOPObject { class KBSwitchIntf : public TQObject, public DCOPObject {
K_DCOP K_DCOP
Q_OBJECT Q_OBJECT
signals: signals:
void nextGroupSelected(); void nextGroupSelected();
void groupSelected(int groupno); void groupSelected(int groupno);
public: public:
KBSwitchIntf(QObject *parent, KBConfig *conf); KBSwitchIntf(TQObject *parent, KBConfig *conf);
~KBSwitchIntf(); ~KBSwitchIntf();
private: private:
KBConfig *m_kbconf; KBConfig *m_kbconf;
@ -48,7 +48,7 @@ k_dcop:
int getNumKbdGroups(); int getNumKbdGroups();
ASYNC selectNextGroup(); ASYNC selectNextGroup();
ASYNC selectGroup(int groupno); ASYNC selectGroup(int groupno);
QStringList getGroupNames(); TQStringList getGroupNames();
}; };
#endif #endif

@ -15,7 +15,7 @@ static const char* const KBSwitchIntf_ftable[5][3] = {
{ "int", "getNumKbdGroups()", "getNumKbdGroups()" }, { "int", "getNumKbdGroups()", "getNumKbdGroups()" },
{ "ASYNC", "selectNextGroup()", "selectNextGroup()" }, { "ASYNC", "selectNextGroup()", "selectNextGroup()" },
{ "ASYNC", "selectGroup(int)", "selectGroup(int groupno)" }, { "ASYNC", "selectGroup(int)", "selectGroup(int groupno)" },
{ "QStringList", "getGroupNames()", "getGroupNames()" }, { "TQStringList", "getGroupNames()", "getGroupNames()" },
{ 0, 0, 0 } { 0, 0, 0 }
}; };
static const int KBSwitchIntf_ftable_hiddens[4] = { static const int KBSwitchIntf_ftable_hiddens[4] = {
@ -25,24 +25,24 @@ static const int KBSwitchIntf_ftable_hiddens[4] = {
0, 0,
}; };
bool KBSwitchIntf::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) bool KBSwitchIntf::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
{ {
if ( fun == KBSwitchIntf_ftable[0][1] ) { // int getNumKbdGroups() if ( fun == KBSwitchIntf_ftable[0][1] ) { // int getNumKbdGroups()
replyType = KBSwitchIntf_ftable[0][0]; replyType = KBSwitchIntf_ftable[0][0];
QDataStream _replyStream( replyData, IO_WriteOnly ); TQDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << getNumKbdGroups( ); _replyStream << getNumKbdGroups( );
} else if ( fun == KBSwitchIntf_ftable[1][1] ) { // void selectNextGroup() } else if ( fun == KBSwitchIntf_ftable[1][1] ) { // void selectNextGroup()
replyType = KBSwitchIntf_ftable[1][0]; replyType = KBSwitchIntf_ftable[1][0];
selectNextGroup( ); selectNextGroup( );
} else if ( fun == KBSwitchIntf_ftable[2][1] ) { // void selectGroup(int) } else if ( fun == KBSwitchIntf_ftable[2][1] ) { // void selectGroup(int)
int arg0; int arg0;
QDataStream arg( data, IO_ReadOnly ); TQDataStream arg( data, IO_ReadOnly );
arg >> arg0; arg >> arg0;
replyType = KBSwitchIntf_ftable[2][0]; replyType = KBSwitchIntf_ftable[2][0];
selectGroup(arg0 ); selectGroup(arg0 );
} else if ( fun == KBSwitchIntf_ftable[3][1] ) { // QStringList getGroupNames() } else if ( fun == KBSwitchIntf_ftable[3][1] ) { // TQStringList getGroupNames()
replyType = KBSwitchIntf_ftable[3][0]; replyType = KBSwitchIntf_ftable[3][0];
QDataStream _replyStream( replyData, IO_WriteOnly ); TQDataStream _replyStream( replyData, IO_WriteOnly );
_replyStream << getGroupNames( ); _replyStream << getGroupNames( );
} else { } else {
return DCOPObject::process( fun, data, replyType, replyData ); return DCOPObject::process( fun, data, replyType, replyData );
@ -63,7 +63,7 @@ QCStringList KBSwitchIntf::functions()
for ( int i = 0; KBSwitchIntf_ftable[i][2]; i++ ) { for ( int i = 0; KBSwitchIntf_ftable[i][2]; i++ ) {
if (KBSwitchIntf_ftable_hiddens[i]) if (KBSwitchIntf_ftable_hiddens[i])
continue; continue;
QCString func = KBSwitchIntf_ftable[i][0]; TQCString func = KBSwitchIntf_ftable[i][0];
func += ' '; func += ' ';
func += KBSwitchIntf_ftable[i][2]; func += KBSwitchIntf_ftable[i][2];
funcs << func; funcs << func;

@ -42,20 +42,20 @@
#include <kiconloader.h> #include <kiconloader.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdeversion.h> #include <kdeversion.h>
#include <qtooltip.h> #include <ntqtooltip.h>
#include <qstyle.h> #include <ntqstyle.h>
#include <qpainter.h> #include <ntqpainter.h>
#ifdef USE_BOLD_MENUITEM #ifdef USE_BOLD_MENUITEM
static QColor getActiveTextColor(KPopupMenu *menu) static TQColor getActiveTextColor(KPopupMenu *menu)
{ {
int id = menu->insertItem("test text"); int id = menu->insertItem("test text");
QMenuItem *item = menu->findItem(id); TQMenuItem *item = menu->findItem(id);
QStyleOption styleopt = QStyleOption(item); TQStyleOption styleopt = TQStyleOption(item);
QPainter painter(menu); TQPainter painter(menu);
QColorGroup &cg = menu->colorGroup(); TQColorGroup &cg = menu->colorGroup();
KApplication::style().drawControl(QStyle::CE_PopupMenuItem, &painter, menu, KApplication::style().drawControl(TQStyle::CE_PopupMenuItem, &painter, menu,
menu->contentsRect(), cg, QStyle::Style_Enabled | QStyle::Style_Active, menu->contentsRect(), cg, TQStyle::Style_Enabled | TQStyle::Style_Active,
styleopt); styleopt);
menu->removeItem(id); menu->removeItem(id);
return painter.pen().color(); return painter.pen().color();
@ -63,7 +63,7 @@ static QColor getActiveTextColor(KPopupMenu *menu)
#endif #endif
KBSwitchTrayIcon::KBSwitchTrayIcon(KBConfig *conf){ KBSwitchTrayIcon::KBSwitchTrayIcon(KBConfig *conf){
QPixmap pix; TQPixmap pix;
#if KDE_VERSION_MAJOR >= 3 #if KDE_VERSION_MAJOR >= 3
KActionCollection *actions = new KActionCollection(this); KActionCollection *actions = new KActionCollection(this);
#define ACTION_PARENT actions #define ACTION_PARENT actions
@ -72,10 +72,10 @@ KBSwitchTrayIcon::KBSwitchTrayIcon(KBConfig *conf){
#endif #endif
m_kbconf = conf; m_kbconf = conf;
//QObject::connect(conf, SIGNAL(changed()), this, SLOT(updateMenuIcons())); //TQObject::connect(conf, SIGNAL(changed()), this, SLOT(updateMenuIcons()));
KPopupMenu * menu = contextMenu(); KPopupMenu * menu = contextMenu();
addLayoutItems(menu, false); addLayoutItems(menu, false);
QObject::connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuActivated(int))); TQObject::connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuActivated(int)));
menu->insertSeparator(); menu->insertSeparator();
KAction *pref = KStdAction::preferences(this, SIGNAL(preferencesSelected()), ACTION_PARENT); KAction *pref = KStdAction::preferences(this, SIGNAL(preferencesSelected()), ACTION_PARENT);
@ -85,11 +85,11 @@ KBSwitchTrayIcon::KBSwitchTrayIcon(KBConfig *conf){
KAction *about = KStdAction::aboutApp(this, SLOT(slotAbout()), ACTION_PARENT); KAction *about = KStdAction::aboutApp(this, SLOT(slotAbout()), ACTION_PARENT);
about->plug(menu); about->plug(menu);
/*QString path = locate("icon", "hicolor/16x16/apps/locale.png"); /*TQString path = locate("icon", "hicolor/16x16/apps/locale.png");
if (!path.isEmpty()) pix.load(path);*/ if (!path.isEmpty()) pix.load(path);*/
pix = kapp->iconLoader()->loadIcon("locale", KIcon::Small); pix = kapp->iconLoader()->loadIcon("locale", KIcon::Small);
menu->changeTitle(menu->idAt(0), pix, i18n("Keyboard Switch")); menu->changeTitle(menu->idAt(0), pix, i18n("Keyboard Switch"));
setAlignment(Qt::AlignHCenter | Qt::AlignCenter); setAlignment(TQt::AlignHCenter | TQt::AlignCenter);
} }
KBSwitchTrayIcon::~KBSwitchTrayIcon(){ KBSwitchTrayIcon::~KBSwitchTrayIcon(){
@ -118,7 +118,7 @@ void KBSwitchTrayIcon::setToggleGroups(int group1, int group2){
for (i = 0; i < m_kbconf->groupCount(); i++) { for (i = 0; i < m_kbconf->groupCount(); i++) {
toggling = (i == group1 || i == group2); toggling = (i == group1 || i == group2);
#ifdef USE_BOLD_MENUITEM #ifdef USE_BOLD_MENUITEM
QMenuItem *item = menu->findItem(i); TQMenuItem *item = menu->findItem(i);
BoldMenuItem *bolditem = dynamic_cast<BoldMenuItem*>(item->custom()); BoldMenuItem *bolditem = dynamic_cast<BoldMenuItem*>(item->custom());
bolditem->setBold(toggling); bolditem->setBold(toggling);
#else #else
@ -130,7 +130,7 @@ void KBSwitchTrayIcon::setToggleGroups(int group1, int group2){
} }
/** No descriptions */ /** No descriptions */
void KBSwitchTrayIcon::mouseReleaseEvent(QMouseEvent *event){ void KBSwitchTrayIcon::mouseReleaseEvent(TQMouseEvent *event){
if (event->button() == LeftButton) { if (event->button() == LeftButton) {
emit clicked(); emit clicked();
} }
@ -155,7 +155,7 @@ void KBSwitchTrayIcon::addLayoutItems(KPopupMenu *menu, bool clearOld) {
KBGroup *group; KBGroup *group;
int index; int index;
#ifdef USE_BOLD_MENUITEM #ifdef USE_BOLD_MENUITEM
QColor active_text_color = getActiveTextColor(menu); TQColor active_text_color = getActiveTextColor(menu);
#endif #endif
if (clearOld) if (clearOld)
@ -181,11 +181,11 @@ void KBSwitchTrayIcon::reconfigure(){
/** Update the tray icon display for the given group */ /** Update the tray icon display for the given group */
void KBSwitchTrayIcon::updateTrayIcon(int groupno){ void KBSwitchTrayIcon::updateTrayIcon(int groupno){
const QPixmap& pix = m_kbconf->getGroup(groupno)->getPixmap(); const TQPixmap& pix = m_kbconf->getGroup(groupno)->getPixmap();
setPixmap(pix); setPixmap(pix);
setActiveGroup(groupno); setActiveGroup(groupno);
QToolTip::remove(this); TQToolTip::remove(this);
QToolTip::add(this, m_kbconf->getGroup(groupno)->getName()); TQToolTip::add(this, m_kbconf->getGroup(groupno)->getName());
} }
/** Update menu and tray icons after configuration has changed */ /** Update menu and tray icons after configuration has changed */

@ -54,7 +54,7 @@ private: // Private attributes
KBConfig *m_kbconf; KBConfig *m_kbconf;
protected: // Protected methods protected: // Protected methods
/** No descriptions */ /** No descriptions */
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(TQMouseEvent *event);
public slots: // Public slots public slots: // Public slots
/** No descriptions */ /** No descriptions */
void slotAbout(); void slotAbout();

@ -17,8 +17,8 @@
#include "pathlistboxitem.h" #include "pathlistboxitem.h"
PathListBoxItem::PathListBoxItem(QListBox *listbox, const QPixmap &pix, PathListBoxItem::PathListBoxItem(TQListBox *listbox, const TQPixmap &pix,
const QString &text, const QString &a_path) : QListBoxPixmap(listbox, pix, text), const TQString &text, const TQString &a_path) : TQListBoxPixmap(listbox, pix, text),
path(a_path) path(a_path)
{ {
} }

@ -18,18 +18,18 @@
#ifndef PATHLISTBOXITEM_H #ifndef PATHLISTBOXITEM_H
#define PATHLISTBOXITEM_H #define PATHLISTBOXITEM_H
#include <qlistbox.h> #include <ntqlistbox.h>
#include <qstring.h> #include <ntqstring.h>
/** /**
*@author Leonid Zeitlin *@author Leonid Zeitlin
*/ */
class PathListBoxItem : public QListBoxPixmap { class PathListBoxItem : public TQListBoxPixmap {
public: public:
QString path; TQString path;
PathListBoxItem(QListBox *listbox, const QPixmap &pix, const QString &text, PathListBoxItem(TQListBox *listbox, const TQPixmap &pix, const TQString &text,
const QString &a_path); const TQString &a_path);
~PathListBoxItem(); ~PathListBoxItem();
}; };

@ -23,7 +23,7 @@
#include <kwinmodule.h> #include <kwinmodule.h>
#include <kdebug.h> #include <kdebug.h>
SingleWindowWatcher::SingleWindowWatcher(KBConfig *kbconf, QObject *parent, const char *name) SingleWindowWatcher::SingleWindowWatcher(KBConfig *kbconf, TQObject *parent, const char *name)
: WindowWatcher(kbconf, parent, name) : WindowWatcher(kbconf, parent, name)
{ {
reset(); reset();

@ -21,7 +21,7 @@
#define SINGLEWINDOWWATCHER_H #define SINGLEWINDOWWATCHER_H
#include "windowwatcher.h" #include "windowwatcher.h"
#include <qmap.h> #include <ntqmap.h>
/** /**
Watches for changes of active window and keep a group per each window Watches for changes of active window and keep a group per each window
@ -35,7 +35,7 @@ private:
int groupno; int groupno;
int next_groupno; int next_groupno;
}; };
typedef QMap<WId, KBWinInfo> KBWindowMap; typedef TQMap<WId, KBWinInfo> KBWindowMap;
KBWindowMap m_window_map; KBWindowMap m_window_map;
KBWindowMap::iterator m_active_window; KBWindowMap::iterator m_active_window;
void addWindowToMap(WId window_id); void addWindowToMap(WId window_id);
@ -44,7 +44,7 @@ protected:
virtual void windowRemoved(WId id); virtual void windowRemoved(WId id);
virtual void activeWindowChanged(WId id); virtual void activeWindowChanged(WId id);
public: public:
SingleWindowWatcher(KBConfig *kbconf, QObject *parent = 0, const char *name = 0); SingleWindowWatcher(KBConfig *kbconf, TQObject *parent = 0, const char *name = 0);
~SingleWindowWatcher(); ~SingleWindowWatcher();
virtual void changeGroup(int groupno, int next_groupno); virtual void changeGroup(int groupno, int next_groupno);
virtual void reset(); virtual void reset();

@ -25,7 +25,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
WindowClassWatcher::WindowClassWatcher(KBConfig *kbconf, QObject *parent, const char *name) WindowClassWatcher::WindowClassWatcher(KBConfig *kbconf, TQObject *parent, const char *name)
: WindowWatcher(kbconf, parent, name) : WindowWatcher(kbconf, parent, name)
{ {
reset(); reset();
@ -35,12 +35,12 @@ WindowClassWatcher::~WindowClassWatcher()
{ {
} }
QString WindowClassWatcher::getWindowClass(WId id) TQString WindowClassWatcher::getWindowClass(WId id)
{ {
XClassHint hint; XClassHint hint;
QString ret = QString::null; TQString ret = TQString::null;
if (XGetClassHint(qt_xdisplay(), id, &hint)) { if (XGetClassHint(tqt_xdisplay(), id, &hint)) {
ret = hint.res_class; ret = hint.res_class;
XFree(hint.res_name); XFree(hint.res_name);
XFree(hint.res_class); XFree(hint.res_class);
@ -50,7 +50,7 @@ QString WindowClassWatcher::getWindowClass(WId id)
void WindowClassWatcher::windowAdded(WId id) void WindowClassWatcher::windowAdded(WId id)
{ {
QString wclass = getWindowClass(id); TQString wclass = getWindowClass(id);
KBClassInfo &info = m_class_group_map[wclass]; KBClassInfo &info = m_class_group_map[wclass];
if (info.refcount == 0) { if (info.refcount == 0) {
// new class // new class
@ -93,9 +93,9 @@ void WindowClassWatcher::reset()
m_class_group_map.clear(); m_class_group_map.clear();
// fill the map with existing windows // fill the map with existing windows
const QValueList<WId> windows = m_kwin_module->windows(); const TQValueList<WId> windows = m_kwin_module->windows();
const QValueList<WId>::ConstIterator end = windows.end(); const TQValueList<WId>::ConstIterator end = windows.end();
for (QValueList<WId>::ConstIterator it = windows.begin(); it != end; ++it) for (TQValueList<WId>::ConstIterator it = windows.begin(); it != end; ++it)
windowAdded(*it); windowAdded(*it);
WId active_window = m_kwin_module->activeWindow(); WId active_window = m_kwin_module->activeWindow();

@ -21,9 +21,9 @@
#define WINDOWCLASSWATCHER_H #define WINDOWCLASSWATCHER_H
#include "windowwatcher.h" #include "windowwatcher.h"
#include <qmap.h> #include <ntqmap.h>
class QString; class TQString;
/** /**
This class watcher for active window changes and keeps a group per window class This class watcher for active window changes and keeps a group per window class
@ -33,7 +33,7 @@ This class watcher for active window changes and keeps a group per window class
class WindowClassWatcher : public WindowWatcher { class WindowClassWatcher : public WindowWatcher {
Q_OBJECT Q_OBJECT
private: private:
typedef QMap<WId, QString> WinClassMap; typedef TQMap<WId, TQString> WinClassMap;
WinClassMap m_win_class_map; WinClassMap m_win_class_map;
struct KBClassInfo { struct KBClassInfo {
int groupno; int groupno;
@ -41,16 +41,16 @@ private:
int refcount; int refcount;
KBClassInfo() : refcount(0) {} KBClassInfo() : refcount(0) {}
}; };
typedef QMap<QString, KBClassInfo> ClassGroupMap; typedef TQMap<TQString, KBClassInfo> ClassGroupMap;
ClassGroupMap m_class_group_map; ClassGroupMap m_class_group_map;
ClassGroupMap::Iterator m_active_class; ClassGroupMap::Iterator m_active_class;
QString getWindowClass(WId id); TQString getWindowClass(WId id);
protected: protected:
virtual void windowAdded(WId id); virtual void windowAdded(WId id);
virtual void windowRemoved(WId id); virtual void windowRemoved(WId id);
virtual void activeWindowChanged(WId id); virtual void activeWindowChanged(WId id);
public: public:
WindowClassWatcher(KBConfig *kbconf, QObject *parent = 0, const char *name = 0); WindowClassWatcher(KBConfig *kbconf, TQObject *parent = 0, const char *name = 0);
~WindowClassWatcher(); ~WindowClassWatcher();
virtual void changeGroup(int groupno, int next_groupno); virtual void changeGroup(int groupno, int next_groupno);
virtual void reset(); virtual void reset();

@ -21,8 +21,8 @@
#include <kwinmodule.h> #include <kwinmodule.h>
WindowWatcher::WindowWatcher(KBConfig *kbconf, QObject *parent, const char *name) WindowWatcher::WindowWatcher(KBConfig *kbconf, TQObject *parent, const char *name)
: QObject(parent, name) : TQObject(parent, name)
{ {
m_kbconf = kbconf; m_kbconf = kbconf;
m_kwin_module = new KWinModule(this); m_kwin_module = new KWinModule(this);

@ -22,7 +22,7 @@
#ifndef WINDOWWATCHER_H #ifndef WINDOWWATCHER_H
#define WINDOWWATCHER_H #define WINDOWWATCHER_H
#include <qobject.h> #include <ntqobject.h>
class KBConfig; class KBConfig;
class KWinModule; class KWinModule;
@ -32,7 +32,7 @@ class KWinModule;
This class watches for active window changes and notifies KKBSwitch This class watches for active window changes and notifies KKBSwitch
that the keyboard group needs to be canged that the keyboard group needs to be canged
*/ */
class WindowWatcher : public QObject { class WindowWatcher : public TQObject {
Q_OBJECT Q_OBJECT
protected: protected:
KBConfig *m_kbconf; KBConfig *m_kbconf;
@ -42,7 +42,7 @@ protected slots:
virtual void windowRemoved(WId id) = 0; virtual void windowRemoved(WId id) = 0;
virtual void activeWindowChanged(WId id) = 0; virtual void activeWindowChanged(WId id) = 0;
public: public:
WindowWatcher(KBConfig *kbconf, QObject *parent = 0, const char *name = 0); WindowWatcher(KBConfig *kbconf, TQObject *parent = 0, const char *name = 0);
~WindowWatcher(); ~WindowWatcher();
virtual void changeGroup(int groupno, int next_groupno) = 0; virtual void changeGroup(int groupno, int next_groupno) = 0;
virtual void reset() = 0; virtual void reset() = 0;

@ -17,8 +17,8 @@
#include "xkeyboard.h" #include "xkeyboard.h"
#include <qwindowdefs.h> #include <ntqwindowdefs.h>
#include <qstringlist.h> #include <ntqstringlist.h>
#include <kdebug.h> #include <kdebug.h>
#include <klocale.h> #include <klocale.h>
@ -27,7 +27,7 @@ XKeyboard *XKeyboard::m_self = 0;
XKeyboard::XKeyboard() XKeyboard::XKeyboard()
{ {
Display *display = qt_xdisplay(); Display *display = tqt_xdisplay();
#ifdef HAVE_LIBXKLAVIER #ifdef HAVE_LIBXKLAVIER
// XklSetDebugLevel(0); // XklSetDebugLevel(0);
XklSetLogAppender(XklLogAppender); XklSetLogAppender(XklLogAppender);
@ -102,7 +102,7 @@ void XKeyboard::setGroupNo(int groupno){
#ifdef HAVE_LIBXKLAVIER #ifdef HAVE_LIBXKLAVIER
XklLockGroup(groupno); XklLockGroup(groupno);
#else #else
XkbLockGroup(qt_xdisplay(), XkbUseCoreKbd, groupno); XkbLockGroup(tqt_xdisplay(), XkbUseCoreKbd, groupno);
#endif #endif
} }
@ -115,7 +115,7 @@ extern "C" {
#endif #endif
/** Get the names of the currently configured keyboard groups */ /** Get the names of the currently configured keyboard groups */
void XKeyboard::getGroupNames(QStringList &list){ void XKeyboard::getGroupNames(TQStringList &list){
#ifdef HAVE_LIBXKLAVIER #ifdef HAVE_LIBXKLAVIER
const char** groupnames = XklGetGroupNames(); const char** groupnames = XklGetGroupNames();
int numgroups = XklGetNumGroups(); int numgroups = XklGetNumGroups();
@ -123,7 +123,7 @@ void XKeyboard::getGroupNames(QStringList &list){
list.append(groupnames[i]); list.append(groupnames[i]);
#else #else
XkbDescRec xkb; XkbDescRec xkb;
Display *display = qt_xdisplay(); Display *display = tqt_xdisplay();
char *names[XkbNumKbdGroups]; char *names[XkbNumKbdGroups];
memset(&xkb, 0, sizeof(xkb)); memset(&xkb, 0, sizeof(xkb));
@ -142,7 +142,7 @@ void XKeyboard::getGroupNames(QStringList &list){
list.append(names[i]); list.append(names[i]);
XFree(names[i]); XFree(names[i]);
} }
else list.append(QString::null); else list.append(TQString::null);
} }
XkbFreeNames(&xkb, XkbGroupNamesMask, 1); XkbFreeNames(&xkb, XkbGroupNamesMask, 1);
#endif #endif
@ -159,7 +159,7 @@ int XKeyboard::getGroupNo(){
return XklGetCurrentState()->group; return XklGetCurrentState()->group;
#else #else
XkbStateRec rec; XkbStateRec rec;
XkbGetState(qt_xdisplay(), XkbUseCoreKbd, &rec); XkbGetState(tqt_xdisplay(), XkbUseCoreKbd, &rec);
return (int) rec.group; return (int) rec.group;
#endif #endif
} }
@ -191,7 +191,7 @@ void XKeyboard::retrieveNumKbdGroups(){
it returns BadImplementation status code, and you have to specify it returns BadImplementation status code, and you have to specify
xkb.device_spec = XkbUseCoreKbd. */ xkb.device_spec = XkbUseCoreKbd. */
xkb.device_spec = XkbUseCoreKbd; xkb.device_spec = XkbUseCoreKbd;
XkbGetControls(qt_xdisplay(), XkbGroupsWrapMask, &xkb); XkbGetControls(tqt_xdisplay(), XkbGroupsWrapMask, &xkb);
m_numgroups = xkb.ctrls->num_groups; m_numgroups = xkb.ctrls->num_groups;
XkbFreeControls(&xkb, XkbGroupsWrapMask, 1); XkbFreeControls(&xkb, XkbGroupsWrapMask, 1);
} }

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include <qobject.h> #include <ntqobject.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
@ -29,13 +29,13 @@
#include <libxklavier/xklavier.h> #include <libxklavier/xklavier.h>
#endif #endif
class QStringList; class TQStringList;
/**This class incapsulates XKeyboard Extension interface /**This class incapsulates XKeyboard Extension interface
*@author Leonid Zeitlin *@author Leonid Zeitlin
*/ */
class XKeyboard : public QObject { class XKeyboard : public TQObject {
Q_OBJECT Q_OBJECT
private: private:
#ifndef HAVE_LIBXKLAVIER #ifndef HAVE_LIBXKLAVIER
@ -51,7 +51,7 @@ public:
/** Set the current keyboard group to the given groupno */ /** Set the current keyboard group to the given groupno */
void setGroupNo(int groupno); void setGroupNo(int groupno);
/** Get the names of the currently configured keyboard groups */ /** Get the names of the currently configured keyboard groups */
void getGroupNames(QStringList &list); void getGroupNames(TQStringList &list);
static XKeyboard* self(); static XKeyboard* self();
/** return the current keyboard group index */ /** return the current keyboard group index */
int getGroupNo(); int getGroupNo();

Loading…
Cancel
Save