Commit 833d797b authored by Stephan Kulow's avatar Stephan Kulow
Browse files

less use of deprecated functions

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=535352
parent 6bf45207
......@@ -150,8 +150,13 @@ static const ColorEntry base_color_table[TABLE_COLORS] =
void TEWidget::setDefaultBackColor(const QColor& color)
{
defaultBgColor = color;
if (qAlpha(blend_color) != 0xff && !backgroundPixmap())
setBackgroundColor(getDefaultBackColor());
#warning backgroundPixmap returns always 0 in Qt4, the logic needs to be a different now
if (qAlpha(blend_color) != 0xff /* && !backgroundPixmap() */)
{
QPalette p = palette();
p.setColor( backgroundRole(), getDefaultBackColor() );
setPalette( p );
}
}
QColor TEWidget::getDefaultBackColor()
......@@ -169,14 +174,20 @@ const ColorEntry* TEWidget::getColorTable() const
void TEWidget::setColorTable(const ColorEntry table[])
{
for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
const QPixmap* pm = backgroundPixmap();
#warning backgroundPixmap is always 0 in Qt4
const QPixmap* pm = 0; // backgroundPixmap();
if (!pm)
if (!argb_visual || (qAlpha(blend_color) == 0xff))
setBackgroundColor(getDefaultBackColor());
else {
//### probably buggy
setBackgroundColor(blend_color);
{
QPalette p = palette();
p.setColor( backgroundRole(), getDefaultBackColor() );
setPalette( p );
} else {
//### probably buggy
QPalette p = palette();
p.setColor( backgroundRole(), blend_color );
setPalette( p );
}
update();
}
......@@ -326,8 +337,8 @@ void TEWidget::setFont(const QFont &)
/* */
/* ------------------------------------------------------------------------- */
TEWidget::TEWidget(QWidget *parent, const char *name)
:QFrame(parent,name)
TEWidget::TEWidget(QWidget *parent)
:QFrame(parent)
,font_h(1)
,font_w(1)
,font_a(1)
......@@ -411,7 +422,7 @@ TEWidget::TEWidget(QWidget *parent, const char *name)
setFocusPolicy( Qt::WheelFocus );
// im
setInputMethodEnabled(true);
setAttribute(Qt::WA_InputMethodEnabled, true);
if (!argb_visual)
{
......@@ -803,7 +814,6 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
updateImageSize(); // Create image
int y,x,len;
const QPixmap* pm = backgroundPixmap();
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
......@@ -903,6 +913,7 @@ void TEWidget::setImage(const ca* const newimg, int lines, int columns)
dirtyRegion |= QRect(bX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h);
/*
#warning pm (backgroundPixmap) is always NULL
drawAttrStr(paint,
QRect(bX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h),
unistr, &ext[x], pm != NULL, true);
......@@ -1110,14 +1121,14 @@ void TEWidget::blinkEvent()
{
blinking = !blinking;
isBlinkEvent = true;
repaint(false);
repaint();
isBlinkEvent = false;
}
void TEWidget::blinkCursorEvent()
{
cursorBlinking = !cursorBlinking;
repaint(cursorRect, true);
repaint(cursorRect);
}
/* ------------------------------------------------------------------------- */
......@@ -1694,14 +1705,15 @@ void TEWidget::mouseTripleClickEvent(QMouseEvent* ev)
void TEWidget::focusInEvent( QFocusEvent * )
{
repaint(cursorRect, true); // *do* erase area, to get rid of the
// hollow cursor rectangle.
#warning Qt4 always double buffers, so the _Do erase_ part is gone
repaint(cursorRect); // *do* erase area, to get rid of the
// hollow cursor rectangle.
}
void TEWidget::focusOutEvent( QFocusEvent * )
{
repaint(cursorRect, true); // don't erase area
repaint(cursorRect); // don't erase area
}
bool TEWidget::focusNextPrevChild( bool next )
......@@ -1718,7 +1730,7 @@ int TEWidget::charClass(UINT16 ch) const
QChar qch=QChar(ch);
if ( qch.isSpace() ) return ' ';
if ( qch.isLetterOrNumber() || word_characters.contains(qch, false) )
if ( qch.isLetterOrNumber() || word_characters.contains(qch, Qt::CaseInsensitive ) )
return 'a';
// Everything else is weird
......@@ -1875,7 +1887,7 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
return QFrame::eventFilter( obj, e );
}
void TEWidget::inputMethodEvent ( QInputMethodEvent * e )
void TEWidget::inputMethodEvent ( QInputMethodEvent * )
{
#ifdef __GNUC__
#warning "FIXME: Port the IM stuff!"
......@@ -2220,7 +2232,7 @@ void TEWidget::drop_menu_activated(int item)
if (m_dnd_file_count==1)
KRun::shellQuote(dropText);
emit sendStringToEmu(dropText.toLocal8Bit());
setActiveWindow();
activateWindow();
break;
case cd:
emit sendStringToEmu("cd ");
......@@ -2237,7 +2249,7 @@ void TEWidget::drop_menu_activated(int item)
KRun::shellQuote(dropText);
emit sendStringToEmu(dropText.toLocal8Bit());
emit sendStringToEmu("\n");
setActiveWindow();
activateWindow();
break;
case cp:
emit sendStringToEmu("kfmclient copy " );
......@@ -2254,7 +2266,7 @@ void TEWidget::drop_menu_activated(int item)
KRun::shellQuote(dropText);
emit sendStringToEmu(dropText.toLocal8Bit());
emit sendStringToEmu(" .\n");
setActiveWindow();
activateWindow();
}
}
......
......@@ -54,7 +54,7 @@ class TEWidget : public QFrame
friend class Konsole;
public:
TEWidget(QWidget *parent=0, const char *name=0);
TEWidget(QWidget *parent=0);
virtual ~TEWidget();
void setBlendColor(const QRgb color) { blend_color = color; }
......@@ -96,7 +96,7 @@ public:
int fontHeight() { return font_h; }
int fontWidth() { return font_w; }
void calcGeometry();
void propagateSize();
void updateImageSize();
......@@ -130,7 +130,7 @@ public:
void setBidiEnabled(bool set) { bidiEnabled=set; }
bool isBidiEnabled() { return bidiEnabled; }
void print(QPainter &paint, bool friendly, bool exact);
void setRim(int rim) { rimX=rim; rimY=rim; }
......@@ -316,7 +316,7 @@ private:
bool m_isIMSel;
QRgb blend_color;
private Q_SLOTS:
void drop_menu_activated(int item);
void swapColorTable();
......
......@@ -1132,7 +1132,7 @@ void Konsole::makeBasicGUI()
this, SLOT(nextSession()), m_shortcuts, "next_session");
for (int i=1;i<13;i++) { // Due to 12 function keys?
new KAction(i18n("Switch to Session %1", i), 0, this, SLOT(switchToSession()), m_shortcuts, QString().sprintf("switch_to_session_%02d", i).latin1());
new KAction(i18n("Switch to Session %1", i), 0, this, SLOT(switchToSession()), m_shortcuts, QString().sprintf("switch_to_session_%02d", i).toLatin1().constData());
}
new KAction(i18n("Enlarge Font"), 0, this, SLOT(biggerFont()), m_shortcuts, "bigger_font");
......@@ -3871,7 +3871,9 @@ void Konsole::slotClearHistory()
void Konsole::slotFindHistory()
{
if( !m_finddialog ) {
m_finddialog = new KonsoleFind( this, "konsolefind", false);
m_finddialog = new KonsoleFind( this );
m_finddialog->setObjectName( "konsolefind" );
m_finddialog->setModal( false );
connect(m_finddialog,SIGNAL(search()),this,SLOT(slotFind()));
connect(m_finddialog,SIGNAL(done()),this,SLOT(slotFindDone()));
}
......@@ -4145,7 +4147,7 @@ unsigned int SizeDialog::lines() const
//////////////////////////////////////////////////////////////////////
KonsoleFind::KonsoleFind( QWidget *parent, const char *name, bool /*modal*/ )
KonsoleFind::KonsoleFind( QWidget *parent )
: KEdFind( parent, false ), m_editorDialog(0), m_editRegExp(0)
{
QWidget* row = new QWidget((QWidget*)group );
......
......@@ -486,7 +486,7 @@ class KonsoleFind : public KEdFind
{
Q_OBJECT
public:
KonsoleFind( QWidget *parent = 0, const char *name=0, bool modal=true );
KonsoleFind( QWidget *parent = 0 );
bool reg_exp() const;
private Q_SLOTS:
......
......@@ -150,7 +150,8 @@ konsolePart::konsolePart(QWidget *_parentWidget, const char *widgetName, QObject
const char* shell = getenv("SHELL");
if (shell == NULL || *shell == '\0') shell = "/bin/sh";
eargs.append(shell);
te = new TEWidget(parentWidget,widgetName);
te = new TEWidget(parentWidget);
te->setObjectName(widgetName);
te->setMinimumSize(150,70); // allow resizing, cause resize in TEWidget
setWidget(te);
......
......@@ -148,7 +148,7 @@ void KonsoleBookmarkMenu::fillBookmarkMenu()
void KonsoleBookmarkMenu::slotBookmarkSelected()
{
if ( !m_pOwner ) return; // this view doesn't handle bookmarks...
m_kOwner->openBookmarkURL( QString::fromUtf8(sender()->name()), /* URL */
m_kOwner->openBookmarkURL( sender()->objectName(), /* URL */
( (KAction *)sender() )->text() /* Title */ );
}
......
......@@ -401,8 +401,8 @@ void SchemaEditor::saveCurrent()
QString image;
image.sprintf("image %s %s",
(const char *) smode.latin1(),
(const char *) backgndLine->text().toUtf8());
smode.toLatin1().constData(),
backgndLine->text().toUtf8().constData());
t << image << endl;
}
t << endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment