summaryrefslogtreecommitdiffstats
path: root/kdeui
diff options
context:
space:
mode:
Diffstat (limited to 'kdeui')
-rw-r--r--kdeui/Makefile.am2
-rw-r--r--kdeui/kaction.cpp11
-rw-r--r--kdeui/kactionclasses.cpp23
-rw-r--r--kdeui/kcombobox.cpp115
-rw-r--r--kdeui/kcombobox.h46
-rw-r--r--kdeui/kfontcombo.cpp29
-rw-r--r--kdeui/kjanuswidget.cpp121
-rw-r--r--kdeui/kjanuswidget.h9
-rw-r--r--kdeui/kpassdlg.cpp5
-rw-r--r--kdeui/ksconfig.cpp2
-rw-r--r--kdeui/ksyntaxhighlighter.cpp2
-rw-r--r--kdeui/ktip.cpp31
-rw-r--r--kdeui/qxembed.cpp24
-rw-r--r--kdeui/qxembed.h5
14 files changed, 402 insertions, 23 deletions
diff --git a/kdeui/Makefile.am b/kdeui/Makefile.am
index 4d60c273b..e5ef761be 100644
--- a/kdeui/Makefile.am
+++ b/kdeui/Makefile.am
@@ -20,7 +20,7 @@
SUBDIRS = . tests about kdetrayproxy
-INCLUDES= -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
+INCLUDES= -I/usr/include/freetype2/ -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
# For the future: examine if condensing the tons of *_LDFLAGS variables
# into $(all_libraries) isn't better
diff --git a/kdeui/kaction.cpp b/kdeui/kaction.cpp
index ffc957658..233fd1039 100644
--- a/kdeui/kaction.cpp
+++ b/kdeui/kaction.cpp
@@ -42,6 +42,17 @@
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <X11/Xdefs.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include <X11/Xft/Xft.h>
+
/**
* How it works.
* KActionCollection is an organizing container for KActions.
diff --git a/kdeui/kactionclasses.cpp b/kdeui/kactionclasses.cpp
index 1fa7223cb..113ef2ea0 100644
--- a/kdeui/kactionclasses.cpp
+++ b/kdeui/kactionclasses.cpp
@@ -27,6 +27,9 @@
#include "kactionclasses.h"
#include <assert.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <fontconfig/fontconfig.h>
#include <tqcursor.h>
#include <tqclipboard.h>
@@ -35,6 +38,7 @@
#include <tqwhatsthis.h>
#include <tqtimer.h>
#include <tqfile.h>
+#include <tqregexp.h>
#include <dcopclient.h>
#include <dcopref.h>
@@ -1498,7 +1502,24 @@ void KFontAction::setFont( const TQString &family )
return;
}
}
- kdDebug(129) << "Font not found " << family.lower() << endl;
+
+ // nothing matched yet, try a fontconfig reverse lookup and
+ // check again to solve an alias
+ FcPattern *pattern = NULL;
+ FcConfig *config = NULL;
+ TQString realFamily;
+ TQRegExp regExp("[-:]");
+ pattern = FcNameParse( (unsigned char*) family.ascii() );
+ FcDefaultSubstitute(pattern);
+ FcConfigSubstitute (config, pattern, FcMatchPattern);
+ pattern = FcFontMatch(NULL, pattern, NULL);
+ realFamily = (char*)FcNameUnparse(pattern);
+ realFamily.remove(realFamily.find(regExp), realFamily.length());
+
+ if ( !realFamily.isEmpty() && realFamily != family )
+ setFont( realFamily );
+ else
+ kdDebug(129) << "Font not found " << family.lower() << endl;
}
int KFontAction::plug( TQWidget *w, int index )
diff --git a/kdeui/kcombobox.cpp b/kdeui/kcombobox.cpp
index 31f14ed0f..c3cc4c402 100644
--- a/kdeui/kcombobox.cpp
+++ b/kdeui/kcombobox.cpp
@@ -29,6 +29,7 @@
#include <kcursor.h>
#include <kiconloader.h>
#include <kicontheme.h>
+#include <klistviewsearchline.h>
#include <klineedit.h>
#include <klocale.h>
#include <knotifyclient.h>
@@ -343,10 +344,22 @@ void KComboBox::lineEditDeleted()
// *********************************************************************
// *********************************************************************
+class KHistoryCombo::KHistoryComboPrivate
+{
+public:
+ KHistoryComboPrivate() : bHistoryEditorEnabled(false)
+ {
+ }
+ ~KHistoryComboPrivate()
+ {
+ }
+
+ bool bHistoryEditorEnabled;
+};
// we are always read-write
KHistoryCombo::KHistoryCombo( TQWidget *parent, const char *name )
- : KComboBox( true, parent, name ), d(0)
+ : KComboBox( true, parent, name ), d(new KHistoryComboPrivate)
{
init( true ); // using completion
}
@@ -354,7 +367,7 @@ KHistoryCombo::KHistoryCombo( TQWidget *parent, const char *name )
// we are always read-write
KHistoryCombo::KHistoryCombo( bool useCompletion,
TQWidget *parent, const char *name )
- : KComboBox( true, parent, name ), d(0)
+ : KComboBox( true, parent, name ), d(new KHistoryComboPrivate)
{
init( useCompletion );
}
@@ -441,6 +454,10 @@ void KHistoryCombo::addContextMenuItems( TQPopupMenu* menu )
if ( menu )
{
menu->insertSeparator();
+ if (d->bHistoryEditorEnabled) {
+ int idedit = menu->insertItem( SmallIconSet("edit"), i18n("&Edit History..."), this, TQT_SLOT( slotEdit()) );
+ menu->setItemEnabled(idedit, count());
+ }
int id = menu->insertItem( SmallIconSet("history_clear"), i18n("Clear &History"), this, TQT_SLOT( slotClear()));
if (!count())
menu->setItemEnabled(id, false);
@@ -677,10 +694,104 @@ void KHistoryCombo::slotClear()
emit cleared();
}
+void KHistoryCombo::slotEdit()
+{
+ KHistoryComboEditor dlg( historyItems(), this );
+ connect( &dlg, TQT_SIGNAL( removeFromHistory(const TQString&) ), TQT_SLOT( slotRemoveFromHistory(const TQString&)) );
+ dlg.exec();
+}
+
+void KHistoryCombo::slotRemoveFromHistory(const TQString &entry)
+{
+ removeFromHistory(entry);
+ emit removed(entry);
+}
+
+void KHistoryCombo::setHistoryEditorEnabled( bool enable )
+{
+ d->bHistoryEditorEnabled = enable;
+}
+
+bool KHistoryCombo::isHistoryEditorEnabled() const
+{
+ return d->bHistoryEditorEnabled;
+}
+
void KComboBox::virtual_hook( int id, void* data )
{ KCompletionBase::virtual_hook( id, data ); }
void KHistoryCombo::virtual_hook( int id, void* data )
{ KComboBox::virtual_hook( id, data ); }
+void KHistoryComboEditor::virtual_hook( int id, void* data )
+{ KDialogBase::virtual_hook( id, data ); }
+
+KHistoryComboEditor::KHistoryComboEditor( const TQStringList& entries, TQWidget *parent )
+: KDialogBase( parent, "khistorycomboeditor", true, i18n( "History Editor" ),
+ KDialogBase::Close | KDialogBase::User1, KDialogBase::User1, true,
+ KGuiItem( i18n( "&Delete Entry" ), "editdelete") ), d(0)
+{
+ TQVBox* box = new TQVBox( this );
+ box->setSpacing( KDialog::spacingHint() );
+ setMainWidget( box );
+
+ new TQLabel( i18n( "This dialog allows you to delete unwanted history items." ), box );
+
+ // Add searchline
+ TQHBox* searchbox = new TQHBox( box );
+ searchbox->setSpacing( KDialog::spacingHint() );
+
+ TQToolButton *clearSearch = new TQToolButton(searchbox);
+ clearSearch->setTextLabel(i18n("Clear Search"), true);
+ clearSearch->setIconSet(SmallIconSet(TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase"));
+ TQLabel* slbl = new TQLabel(i18n("&Search:"), searchbox);
+ KListViewSearchLine* listViewSearch = new KListViewSearchLine(searchbox);
+ slbl->setBuddy(listViewSearch);
+ connect(clearSearch, TQT_SIGNAL(pressed()), listViewSearch, TQT_SLOT(clear()));
+
+ // Add ListView
+ m_pListView = new KListView( box );
+ listViewSearch->setListView(m_pListView);
+ m_pListView->setAllColumnsShowFocus(true);
+ m_pListView->header()->hide();
+ m_pListView->addColumn("");
+ m_pListView->setRenameable( 0 );
+
+ box->setStretchFactor( m_pListView, 1 );
+
+ TQStringList newlist = entries;
+ for ( TQStringList::Iterator it = newlist.begin(); it != newlist.end(); ++it ) {
+ new TQListViewItem( m_pListView, *it );
+ }
+
+ m_pListView->setMinimumSize( m_pListView->sizeHint() );
+
+ connect( m_pListView, TQT_SIGNAL( selectionChanged( TQListViewItem * ) ),
+ this, TQT_SLOT( slotSelectionChanged( TQListViewItem * ) ) );
+
+ enableButton( KDialogBase::User1, false );
+
+ resize( sizeHint() );
+}
+
+KHistoryComboEditor::~KHistoryComboEditor()
+{
+}
+
+void KHistoryComboEditor::slotUser1() // Delete button
+{
+ TQListViewItem *item = m_pListView->selectedItem();
+
+ if ( item ) {
+ emit removeFromHistory( item->text(0) );
+ m_pListView->takeItem( item );
+ enableButton( KDialogBase::User1, false );
+ }
+}
+
+void KHistoryComboEditor::slotSelectionChanged( TQListViewItem * item )
+{
+ enableButton( KDialogBase::User1, item );
+}
+
#include "kcombobox.moc"
diff --git a/kdeui/kcombobox.h b/kdeui/kcombobox.h
index 4a9c30b14..d7d07e4b6 100644
--- a/kdeui/kcombobox.h
+++ b/kdeui/kcombobox.h
@@ -24,8 +24,15 @@
#include <tqlineedit.h>
#include <tqcombobox.h>
+#include <tqvbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqtoolbutton.h>
+#include <tqheader.h>
#include <kcompletion.h>
+#include <kdialogbase.h>
+#include <klistview.h>
class TQListBoxItem;
class TQPopupMenu;
@@ -669,6 +676,12 @@ public:
*/
void reset() { slotReset(); }
+ /**
+ * When enabling it you have to connect to "removed" signal and save changes
+ */
+ void setHistoryEditorEnabled( bool enable );
+ bool isHistoryEditorEnabled() const;
+
public slots:
/**
* Adds an item to the end of the history list and to the completion list.
@@ -702,6 +715,8 @@ signals:
*/
void cleared();
+ void removed( const TQString& item );
+
protected:
/**
* Handling key-events, the shortcuts to rotate the items.
@@ -741,10 +756,17 @@ private slots:
void slotClear();
/**
+ * Called from the popupmenu,
+ */
+ void slotEdit();
+
+ /**
* Appends our own context menu entry.
*/
void addContextMenuItems( TQPopupMenu* );
+ void slotRemoveFromHistory( const TQString & );
+
private:
void init( bool useCompletion );
void rotateUp();
@@ -774,6 +796,30 @@ private:
KHistoryComboPrivate* const d;
};
+class KDEUI_EXPORT KHistoryComboEditor : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ KHistoryComboEditor( const TQStringList& entries, TQWidget *parent = 0L );
+ ~KHistoryComboEditor();
+
+signals:
+ void removeFromHistory( const TQString& );
+
+protected slots:
+ virtual void slotUser1(); // User1 is "Delete Entry" button
+ void slotSelectionChanged( TQListViewItem * item );
+
+protected:
+ virtual void virtual_hook( int id, void* data );
+
+private:
+ KListView *m_pListView;
+
+ class KHistoryComboEditorPrivate;
+ KHistoryComboEditorPrivate* const d;
+};
#endif
diff --git a/kdeui/kfontcombo.cpp b/kdeui/kfontcombo.cpp
index 4752a0bd1..ea123c38a 100644
--- a/kdeui/kfontcombo.cpp
+++ b/kdeui/kfontcombo.cpp
@@ -20,6 +20,7 @@
#include <tqfontdatabase.h>
#include <tqlistbox.h>
#include <tqpainter.h>
+#include <tqregexp.h>
#include <kcharsets.h>
#include <kconfig.h>
@@ -29,6 +30,18 @@
#include "kfontcombo.h"
#include "kfontcombo.moc"
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <fontconfig/fontconfig.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include <X11/Xft/Xft.h>
+
+
struct KFontComboPrivate
{
KFontComboPrivate()
@@ -227,6 +240,22 @@ void KFontCombo::setCurrentFont(const TQString &family)
return;
}
}
+
+ // nothing matched yet, try a fontconfig reverse lookup and
+ // check again to solve an alias
+ FcPattern *pattern = NULL;
+ FcConfig *config = NULL;
+ TQString realFamily;
+ TQRegExp regExp("[-:]");
+ pattern = FcNameParse( (unsigned char*) family.ascii() );
+ FcDefaultSubstitute(pattern);
+ FcConfigSubstitute (config, pattern, FcMatchPattern);
+ pattern = FcFontMatch(NULL, pattern, NULL);
+ realFamily = (char*)FcNameUnparse(pattern);
+ realFamily.remove(realFamily.find(regExp), realFamily.length());
+
+ if ( !realFamily.isEmpty() && realFamily != family )
+ setCurrentFont( realFamily );
}
void KFontCombo::slotModified( int )
diff --git a/kdeui/kjanuswidget.cpp b/kdeui/kjanuswidget.cpp
index f8647fb26..7f34dc5c1 100644
--- a/kdeui/kjanuswidget.cpp
+++ b/kdeui/kjanuswidget.cpp
@@ -49,16 +49,19 @@ class KJanusWidget::IconListItem : public QListBoxItem
{
public:
IconListItem( TQListBox *listbox, const TQPixmap &pixmap,
- const TQString &text );
+ const TQString &text );
virtual int height( const TQListBox *lb ) const;
virtual int width( const TQListBox *lb ) const;
int expandMinimumWidth( int width );
+ void highlight( bool erase );
protected:
const TQPixmap &defaultPixmap();
void paint( TQPainter *painter );
-
+
private:
+ void paintContents( TQPainter *painter );
+
TQPixmap mPixmap;
int mMinimumWidth;
};
@@ -141,6 +144,8 @@ KJanusWidget::KJanusWidget( TQWidget *parent, const char *name, int face )
mIconList->verticalScrollBar()->installEventFilter( this );
connect( mIconList, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotShowPage()));
+ connect( mIconList, TQT_SIGNAL(onItem(TQListBoxItem *)), TQT_SLOT(slotOnItem(TQListBoxItem *)));
+
hbox->addSpacing( KDialog::marginHint() );
page = new TQFrame( this );
hbox->addWidget( page, 10 );
@@ -259,7 +264,7 @@ void KJanusWidget::slotReopen( TQListViewItem * item )
}
TQFrame *KJanusWidget::addPage( const TQString &itemName, const TQString &header,
- const TQPixmap &pixmap )
+ const TQPixmap &pixmap )
{
TQStringList items;
items << itemName;
@@ -269,8 +274,8 @@ TQFrame *KJanusWidget::addPage( const TQString &itemName, const TQString &header
TQVBox *KJanusWidget::addVBoxPage( const TQStringList &items,
- const TQString &header,
- const TQPixmap &pixmap )
+ const TQString &header,
+ const TQPixmap &pixmap )
{
if( !mValid )
{
@@ -721,6 +726,12 @@ void KJanusWidget::slotItemClicked(TQListViewItem *it)
it->setOpen(!it->isOpen());
}
+// hack because qt does not support Q_OBJECT in nested classes
+void KJanusWidget::slotOnItem(TQListBoxItem *qitem)
+{
+ mIconList->slotOnItem( qitem );
+}
+
void KJanusWidget::setFocus()
{
if( !mValid ) { return; }
@@ -929,11 +940,11 @@ bool KJanusWidget::eventFilter( TQObject *o, TQEvent *e )
KJanusWidget::IconListBox::IconListBox( TQWidget *parent, const char *name,
WFlags f )
:KListBox( parent, name, f ), mShowAll(false), mHeightValid(false),
- mWidthValid(false)
+ mWidthValid(false),
+ mOldItem(0)
{
}
-
void KJanusWidget::IconListBox::updateMinimumHeight()
{
if( mShowAll && !mHeightValid )
@@ -995,6 +1006,45 @@ void KJanusWidget::IconListBox::setShowAll( bool showAll )
}
+void KJanusWidget::IconListBox::leaveEvent( TQEvent *ev )
+{
+ KListBox::leaveEvent( ev );
+
+ if ( mOldItem && !mOldItem->isSelected() )
+ {
+ ((KJanusWidget::IconListItem *) mOldItem)->highlight( true );
+ mOldItem = 0;
+ }
+}
+
+// hack because qt does not support Q_OBJECT in nested classes
+void KJanusWidget::IconListBox::slotOnItem(TQListBoxItem *qitem)
+{
+ KListBox::slotOnItem( qitem );
+
+ if ( qitem == mOldItem )
+ {
+ return;
+ }
+
+ if ( mOldItem && !mOldItem->isSelected() )
+ {
+ ((KJanusWidget::IconListItem *) mOldItem)->highlight( true );
+ }
+
+ KJanusWidget::IconListItem *item = dynamic_cast< KJanusWidget::IconListItem * >( qitem );
+ if ( item && !item->isSelected() )
+ {
+ item->highlight( false );
+ mOldItem = item;
+ }
+ else
+ {
+ mOldItem = 0;
+ }
+}
+
+
KJanusWidget::IconListItem::IconListItem( TQListBox *listbox, const TQPixmap &pixmap,
const TQString &text )
@@ -1006,6 +1056,7 @@ KJanusWidget::IconListItem::IconListItem( TQListBox *listbox, const TQPixmap &pi
mPixmap = defaultPixmap();
}
setText( text );
+ setCustomHighlighting( true );
mMinimumWidth = 0;
}
@@ -1017,6 +1068,36 @@ int KJanusWidget::IconListItem::expandMinimumWidth( int width )
}
+void KJanusWidget::IconListItem::highlight( bool erase )
+{
+ TQRect r = listBox()->itemRect( this );
+ r.addCoords( 1, 1, -1, -1 );
+
+ TQPainter p( listBox()->viewport() );
+ p.setClipRegion( r );
+
+ const TQColorGroup &cg = listBox()->colorGroup();
+ if ( erase )
+ {
+ p.setPen( cg.base() );
+ p.setBrush( cg.base() );
+ p.drawRect( r );
+ }
+ else
+ {
+ p.setBrush( cg.highlight().light( 120 ) );
+ p.drawRect( r );
+
+ p.setPen( cg.highlight().dark( 140 ) );
+ p.drawRect( r );
+ }
+
+ p.setPen( cg.foreground() );
+ p.translate( r.x() - 1, r.y() - 1 );
+ paintContents( &p );
+}
+
+
const TQPixmap &KJanusWidget::IconListItem::defaultPixmap()
{
static TQPixmap *pix=0;
@@ -1044,15 +1125,34 @@ const TQPixmap &KJanusWidget::IconListItem::defaultPixmap()
void KJanusWidget::IconListItem::paint( TQPainter *painter )
{
+ TQRect itemPaintRegion( listBox()->itemRect( this ) );
+ TQRect r( 1, 1, itemPaintRegion.width() - 2, itemPaintRegion.height() - 2);
+
+ if ( isSelected() )
+ {
+ painter->eraseRect( r );
+
+ painter->save();
+ painter->setPen( listBox()->colorGroup().highlight().dark( 160 ) );
+ painter->drawRect( r );
+ painter->restore();
+ }
+
+ paintContents( painter );
+}
+
+
+void KJanusWidget::IconListItem::paintContents( TQPainter *painter )
+{
TQFontMetrics fm = painter->fontMetrics();
int ht = fm.boundingRect( 0, 0, 0, 0, Qt::AlignCenter, text() ).height();
int wp = mPixmap.width();
int hp = mPixmap.height();
+ painter->drawPixmap( (mMinimumWidth - wp) / 2, 5, mPixmap );
- painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap );
if( !text().isEmpty() )
{
- painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() );
+ painter->drawText( 1, hp + 7, mMinimumWidth - 2, ht, Qt::AlignCenter, text() );
}
}
@@ -1082,6 +1182,7 @@ int KJanusWidget::IconListItem::width( const TQListBox *lb ) const
void KJanusWidget::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
+
// TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to
// delete the node.
void KJanusWidget::removePage( TQWidget *page )
@@ -1129,6 +1230,7 @@ void KJanusWidget::removePage( TQWidget *page )
}
}
+
TQString KJanusWidget::pageTitle(int index) const
{
if (!d || !d->mIntToTitle.contains(index))
@@ -1137,6 +1239,7 @@ TQString KJanusWidget::pageTitle(int index) const
return d->mIntToTitle[index];
}
+
TQWidget *KJanusWidget::pageWidget(int index) const
{
if (!d || !d->mIntToPage.contains(index))
diff --git a/kdeui/kjanuswidget.h b/kdeui/kjanuswidget.h
index 29bfd0462..cc22dc334 100644
--- a/kdeui/kjanuswidget.h
+++ b/kdeui/kjanuswidget.h
@@ -71,6 +71,8 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
private:
class IconListBox : public KListBox
{
+ friend class KJanusWidget;
+
public:
IconListBox( TQWidget *parent=0, const char *name=0, WFlags f=0 );
void updateMinimumHeight();
@@ -79,10 +81,15 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
void invalidateWidth();
void setShowAll( bool showAll );
+ protected:
+ void slotOnItem( TQListBoxItem *item );
+ virtual void leaveEvent( TQEvent * );
+
private:
bool mShowAll;
bool mHeightValid;
bool mWidthValid;
+ TQListBoxItem *mOldItem;
};
public:
@@ -558,6 +565,8 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
private slots:
bool slotShowPage();
void slotFontChanged();
+
+ void slotOnItem(TQListBoxItem *item);
void slotItemClicked(TQListViewItem *it);
void pageGone(TQObject *obj); // signal from the added page's "destroyed" signal
void slotReopen(TQListViewItem *item);
diff --git a/kdeui/kpassdlg.cpp b/kdeui/kpassdlg.cpp
index 8a2d54989..11db31eb5 100644
--- a/kdeui/kpassdlg.cpp
+++ b/kdeui/kpassdlg.cpp
@@ -49,6 +49,8 @@
#include "kpassdlg.h"
+#include "../kdesu/defaults.h"
+
/*
* Password line editor.
*/
@@ -337,7 +339,8 @@ void KPasswordDialog::init()
KConfig* const cfg = KGlobal::config();
const KConfigGroupSaver saver(cfg, "Passwords");
- if (m_Keep && cfg->readBoolEntry("Keep", false))
+ bool def = ( qstrcmp( qAppName(), "kdesu" ) == 0 ? defKeep : false );
+ if (m_Keep && cfg->readBoolEntry("Keep", def))
++m_Keep;
m_pMain = new TQWidget(this);
diff --git a/kdeui/ksconfig.cpp b/kdeui/ksconfig.cpp
index ec5460ed7..a8849e8fe 100644
--- a/kdeui/ksconfig.cpp
+++ b/kdeui/ksconfig.cpp
@@ -187,7 +187,7 @@ KSpellConfig::readGlobalSettings()
setRunTogether ( kc->readNumEntry("KSpell_RunTogether", 0) );
setDictionary ( kc->readEntry("KSpell_Dictionary") );
setDictFromList ( kc->readNumEntry("KSpell_DictFromList", false) );
- setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII) );
+ setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_UTF8) );
setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );
return true;
diff --git a/kdeui/ksyntaxhighlighter.cpp b/kdeui/ksyntaxhighlighter.cpp
index c70cd672e..a5485841f 100644
--- a/kdeui/ksyntaxhighlighter.cpp
+++ b/kdeui/ksyntaxhighlighter.cpp
@@ -551,7 +551,7 @@ TQString KDictSpellingHighlighter::spellKey()
key += '/';
key += TQString::number( config->readNumEntry( "KSpell_DictFromList", false ));
key += '/';
- key += TQString::number( config->readNumEntry( "KSpell_Encoding", KS_E_ASCII ));
+ key += TQString::number( config->readNumEntry( "KSpell_Encoding", KS_E_UTF8 ));
key += '/';
key += TQString::number( config->readNumEntry( "KSpell_Client", KS_CLIENT_ISPELL ));
return key;
diff --git a/kdeui/ktip.cpp b/kdeui/ktip.cpp
index 778d5e33b..ae619a173 100644
--- a/kdeui/ktip.cpp
+++ b/kdeui/ktip.cpp
@@ -367,24 +367,47 @@ void KTipDialog::showMultiTip(TQWidget *parent, const TQStringList &tipFiles, bo
mInstance->raise();
}
+static TQString fixTip(TQString tip)
+{
+ TQRegExp iconRegExp("<img src=\"(.*)\">");
+ iconRegExp.setMinimal(true);
+ if (iconRegExp.search(tip)>-1) {
+ TQString iconName = iconRegExp.cap(1);
+ if (!iconName.isEmpty())
+ if (KGlobal::dirs()->findResource("icon", iconName).isEmpty())
+ tip.replace("crystalsvg","hicolor");
+ }
+
+ return tip;
+}
+
void KTipDialog::prevTip()
{
mDatabase->prevTip();
- mTipText->setText(TQString::fromLatin1(
+ TQString currentTip = TQString::fromLatin1(
"<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
.arg(mTextColor.name())
.arg(mBaseColor.name())
- .arg(i18n(mDatabase->tip().utf8())));
+ .arg(i18n(mDatabase->tip().utf8()));
+
+
+ currentTip = fixTip(currentTip);
+ mTipText->setText(currentTip);
mTipText->setContentsPos(0, 0);
}
void KTipDialog::nextTip()
{
mDatabase->nextTip();
- mTipText->setText(TQString::fromLatin1("<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
+ TQString currentTip = TQString::fromLatin1(
+ "<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
.arg(mTextColor.name())
.arg(mBaseColor.name())
- .arg(i18n(mDatabase->tip().utf8())));
+ .arg(i18n(mDatabase->tip().utf8()));
+
+
+ currentTip = fixTip(currentTip);
+ mTipText->setText(currentTip);
mTipText->setContentsPos(0, 0);
}
diff --git a/kdeui/qxembed.cpp b/kdeui/qxembed.cpp
index 6403f9d8a..7ec1db3a2 100644
--- a/kdeui/qxembed.cpp
+++ b/kdeui/qxembed.cpp
@@ -314,8 +314,8 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
if ( qApp->focusWidget() == o &&
((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
TQFocusEvent* fe = (TQFocusEvent*) e;
- if ( obeyFocus || fe->reason() == TQFocusEvent::Mouse ||
- fe->reason() == TQFocusEvent::Shortcut ) {
+ if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow /*|| fe->reason() == TQFocusEvent::Mouse ||
+ fe->reason() == TQFocusEvent::Shortcut*/ ) {
// L0614: A widget in the embedded client was just given the Qt focus.
// Variable `obeyFocus' suggests that this is the result of mouse
// activity in the client. The XEMBED_REQUEST_FOCUS message causes
@@ -478,8 +478,11 @@ static int qxembed_x11_event_filter( XEvent* e)
switch ( detail ) {
case XEMBED_FOCUS_CURRENT:
// L0683: Set focus on saved focus widget
- if ( focusCurrent )
+ if ( focusCurrent ) {
focusCurrent->setFocus();
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( focusCurrent ))
+ emb->updateEmbeddedFocus( true );
+ }
else if ( !w->topLevelWidget()->focusWidget() )
w->topLevelWidget()->setFocus();
break;
@@ -511,6 +514,8 @@ static int qxembed_x11_event_filter( XEvent* e)
// We first record what the focus widget was
// and clear the Qt focus.
if ( w->topLevelWidget()->focusWidget() ) {
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget()))
+ emb->updateEmbeddedFocus( false );
focusMap->insert( w->topLevelWidget(),
new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) );
w->topLevelWidget()->focusWidget()->clearFocus();
@@ -919,6 +924,17 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){
}
+// When QXEmbed has TQt focus and gets/loses X focus, make sure the client knows
+// about the state of the focus.
+void QXEmbed::updateEmbeddedFocus( bool hasfocus ){
+ if (!window || d->xplain)
+ return;
+ if( hasfocus )
+ sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT);
+ else
+ sendXEmbedMessage( window, XEMBED_FOCUS_OUT);
+}
+
// L1600: Helper for QXEmbed::embed()
// Check whether a window is in withdrawn state.
static bool wstate_withdrawn( WId winid )
@@ -1161,6 +1177,8 @@ bool QXEmbed::x11Event( XEvent* e)
// L2085: The client asks for the focus.
case XEMBED_REQUEST_FOCUS:
if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) {
+ focusMap->remove( topLevelWidget() );
+ focusMap->insert( topLevelWidget(), new TQGuardedPtr<TQWidget>( this ));
WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else {
diff --git a/kdeui/qxembed.h b/kdeui/qxembed.h
index 38aabbd77..3b345554f 100644
--- a/kdeui/qxembed.h
+++ b/kdeui/qxembed.h
@@ -191,6 +191,11 @@ public:
void enterWhatsThisMode(); // temporary, fix in Qt (Matthias, Mon Jul 17 15:20:55 CEST 2000 )
virtual void reparent( TQWidget * parent, WFlags f, const TQPoint & p, bool showIt = false );
+ /**
+ * @internal
+ */
+ void updateEmbeddedFocus( bool hasfocus );
+
signals:
/**
* This signal is emitted when the embedded window has been lost (destroyed or reparented away)