generic: obsolete code removal

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-10-13 01:57:36 +00:00
parent 953ab7ee0c
commit 9c496296af
13 changed files with 35 additions and 151 deletions

View file

@ -33,7 +33,7 @@ find_library(LIBUSB_LIBRARIES
NAMES
usb-1.0
HINTS
$ENV{FONTCONFIGDIR}/lib
$ENV{LIBUSBDIR}/lib
${PC_LIBUSB_LIBDIR}
${LIB_INSTALL_DIR}
)

View file

@ -292,8 +292,6 @@ public:
* Of course you can also call setStatusTip, setToolTip and setWhatsThis
* separately for more flexibility.
*
* This method is also the easiest way to port from KDE3's KAction::setToolTip.
*
* @since 4.3
*/
void setHelpText(const QString& text);

View file

@ -171,7 +171,7 @@ class KStartupInfo::Private
: q( q ),
timeout( 60 ),
#ifdef Q_WS_X11
msgs( NET_STARTUP_MSG, NULL, false ),
msgs( NET_STARTUP_MSG, NULL ),
#endif
flags( flags_P )
{
@ -450,10 +450,10 @@ bool KStartupInfo::sendStartup( const KStartupInfoId& id_P, const KStartupInfoDa
KXMessages msgs;
QString msg = QString::fromLatin1( "new: %1 %2" )
.arg( id_P.d->to_text()).arg( data_P.d->to_text());
QX11Info inf;
QX11Info inf;
msg = Private::check_required_startup_fields( msg, data_P, inf.screen());
kDebug( 172 ) << "sending " << msg;
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1);
#endif
return true;
}
@ -470,7 +470,7 @@ bool KStartupInfo::sendStartupX( Display* disp_P, const KStartupInfoId& id_P,
#ifdef KSTARTUPINFO_ALL_DEBUG
kDebug( 172 ) << "sending " << msg;
#endif
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1 );
#else
return true;
#endif
@ -502,7 +502,7 @@ bool KStartupInfo::sendChange( const KStartupInfoId& id_P, const KStartupInfoDat
QString msg = QString::fromLatin1( "change: %1 %2" )
.arg( id_P.d->to_text()).arg( data_P.d->to_text());
kDebug( 172 ) << "sending " << msg;
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1 );
#endif
return true;
}
@ -518,7 +518,7 @@ bool KStartupInfo::sendChangeX( Display* disp_P, const KStartupInfoId& id_P,
#ifdef KSTARTUPINFO_ALL_DEBUG
kDebug( 172 ) << "sending " << msg;
#endif
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1 );
#else
return true;
#endif
@ -532,7 +532,7 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P )
KXMessages msgs;
QString msg = QString::fromLatin1( "remove: %1" ).arg( id_P.d->to_text());
kDebug( 172 ) << "sending " << msg;
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1 );
#endif
return true;
}
@ -546,7 +546,7 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P )
#ifdef KSTARTUPINFO_ALL_DEBUG
kDebug( 172 ) << "sending " << msg;
#endif
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1 );
#else
return true;
#endif
@ -561,7 +561,7 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P, const KStartupInfoDat
QString msg = QString::fromLatin1( "remove: %1 %2" )
.arg( id_P.d->to_text()).arg( data_P.d->to_text());
kDebug( 172 ) << "sending " << msg;
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1 );
#endif
return true;
}
@ -577,7 +577,7 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P,
#ifdef KSTARTUPINFO_ALL_DEBUG
kDebug( 172 ) << "sending " << msg;
#endif
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1 );
#else
return true;
#endif

View file

@ -17,6 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
#include <QRect>
#include <QFontMetrics>
#include <QtGui/qx11info_x11.h>
#include <qtest_kde.h>

View file

@ -63,72 +63,35 @@ KXMessages::KXMessages( const char* accept_broadcast_P, QWidget* parent_P )
d->handle = new QWidget( this );
}
KXMessages::KXMessages( const char* accept_broadcast_P, QWidget* parent_P, bool obsolete_P )
: QWidget( parent_P )
, d( new KXMessagesPrivate )
{
if( accept_broadcast_P != NULL )
{
( void ) qApp->desktop(); //trigger desktop widget creation to select root window events
kapp->installX11EventFilter( this ); // i.e. PropertyChangeMask
d->accept_atom2 = XInternAtom( QX11Info::display(), accept_broadcast_P, false );
d->accept_atom1 = obsolete_P ? d->accept_atom2
: XInternAtom( QX11Info::display(), QByteArray(QByteArray( accept_broadcast_P ) + "_BEGIN").constData(), false );
}
else
{
d->accept_atom1 = d->accept_atom2 = None;
}
d->handle = new QWidget( this );
}
KXMessages::~KXMessages()
{
delete d;
}
void KXMessages::broadcastMessage( const char* msg_type_P, const QString& message_P )
{
broadcastMessage( msg_type_P, message_P, -1, true );
}
void KXMessages::broadcastMessage( const char* msg_type_P, const QString& message_P,
int screen_P, bool obsolete_P )
int screen_P )
{
Atom a2 = XInternAtom( QX11Info::display(), msg_type_P, false );
Atom a1 = obsolete_P ? a2 : XInternAtom( QX11Info::display(), QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Atom a1 = XInternAtom( QX11Info::display(), QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Window root = screen_P == -1 ? QX11Info::appRootWindow() : QX11Info::appRootWindow( screen_P );
send_message_internal( root, message_P, BROADCAST_MASK, QX11Info::display(),
a1, a2, d->handle->winId());
}
void KXMessages::sendMessage( WId w_P, const char* msg_type_P, const QString& message_P )
{
sendMessage( w_P, msg_type_P, message_P, true );
}
void KXMessages::sendMessage( WId w_P, const char* msg_type_P, const QString& message_P,
bool obsolete_P )
{
Atom a2 = XInternAtom( QX11Info::display(), msg_type_P, false );
Atom a1 = obsolete_P ? a2 : XInternAtom( QX11Info::display(), QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Atom a1 = XInternAtom( QX11Info::display(), QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
send_message_internal( w_P, message_P, 0, QX11Info::display(), a1, a2, d->handle->winId());
}
bool KXMessages::broadcastMessageX( Display* disp, const char* msg_type_P,
const QString& message_P )
{
return broadcastMessageX( disp, msg_type_P, message_P, -1, true );
}
bool KXMessages::broadcastMessageX( Display* disp, const char* msg_type_P,
const QString& message_P, int screen_P, bool obsolete_P )
const QString& message_P, int screen_P )
{
if( disp == NULL )
return false;
Atom a2 = XInternAtom( disp, msg_type_P, false );
Atom a1 = obsolete_P ? a2 : XInternAtom( disp, QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Atom a1 = XInternAtom( disp, QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Window root = screen_P == -1 ? DefaultRootWindow( disp ) : RootWindow( disp, screen_P );
Window win = XCreateSimpleWindow( disp, root, 0, 0, 1, 1,
0, BlackPixel( disp, screen_P == -1 ? DefaultScreen( disp ) : screen_P ),
@ -142,16 +105,10 @@ bool KXMessages::broadcastMessageX( Display* disp, const char* msg_type_P,
bool KXMessages::sendMessageX( Display* disp, WId w_P, const char* msg_type_P,
const QString& message_P )
{
return sendMessageX( disp, w_P, msg_type_P, message_P, true );
}
bool KXMessages::sendMessageX( Display* disp, WId w_P, const char* msg_type_P,
const QString& message_P, bool obsolete_P )
{
if( disp == NULL )
return false;
Atom a2 = XInternAtom( disp, msg_type_P, false );
Atom a1 = obsolete_P ? a2 : XInternAtom( disp, QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Atom a1 = XInternAtom( disp, QByteArray(QByteArray( msg_type_P ) + "_BEGIN").constData(), false );
Window win = XCreateSimpleWindow( disp, DefaultRootWindow( disp ), 0, 0, 1, 1,
0, BlackPixelOfScreen( DefaultScreenOfDisplay( disp )),
BlackPixelOfScreen( DefaultScreenOfDisplay( disp )));

View file

@ -54,15 +54,8 @@ class KDEUI_EXPORT KXMessages
* @param accept_broadcast if non-NULL, all broadcast messages with
* this message type will be received.
* @param parent the parent of this widget
* @param obsolete always set to false (needed for backwards compatibility
* with KDE3.1 and older)
*/
KXMessages( const char* accept_broadcast, QWidget* parent, bool obsolete );
/**
* @deprecated
* This method is equivalent to the other constructor with obsolete = true.
*/
explicit KXMessages( const char* accept_broadcast = NULL, QWidget* parent = NULL );
KXMessages( const char* accept_broadcast = NULL, QWidget* parent = 0 );
virtual ~KXMessages();
/**
@ -72,14 +65,6 @@ class KDEUI_EXPORT KXMessages
* @param w X11 handle for the destination window
* @param msg_type the type of the message
* @param message the message itself
* @param obsolete always set to false (needed for backwards compatibility
* with KDE3.1 and older)
*/
void sendMessage( WId w, const char* msg_type, const QString& message,
bool obsolete );
/**
* @deprecated
* This method is equivalent to sendMessage() with obsolete = true.
*/
void sendMessage( WId w, const char* msg_type, const QString& message );
/**
@ -87,17 +72,9 @@ class KDEUI_EXPORT KXMessages
* @param msg_type the type of the message
* @param message the message itself
* @param screen X11 screen to use, -1 for the default
* @param obsolete always set to false (needed for backwards compatibility
* with KDE3.1 and older)
*/
void broadcastMessage( const char* msg_type, const QString& message,
int screen, bool obsolete );
/**
* @deprecated
* This method is equivalent to broadcastMessage() with obsolete = true.
*/
void broadcastMessage( const char* msg_type, const QString& message );
int screen = -1);
/**
* Sends the given message with the given message type only to given
* window.
@ -107,19 +84,10 @@ class KDEUI_EXPORT KXMessages
* @param w X11 handle for the destination window
* @param msg_type the type of the message
* @param message the message itself
* @param obsolete always set to false (needed for backwards compatibility
* with KDE3.1 and older)
* @return false when an error occurred, true otherwise
*/
static bool sendMessageX( Display* disp, WId w, const char* msg_type,
const QString& message, bool obsolete );
/**
* @deprecated
* This method is equivalent to sendMessageX() with obsolete = true.
*/
static bool sendMessageX( Display* disp, WId w, const char* msg_type,
const QString& message );
/**
* Broadcasts the given message with the given message type.
*
@ -128,18 +96,10 @@ class KDEUI_EXPORT KXMessages
* @param msg_type the type of the message
* @param message the message itself
* @param screen X11 screen to use, -1 for the default
* @param obsolete always set to false (needed for backwards compatibility
* with KDE3.1 and older)
* @return false when an error occurred, true otherwise
*/
static bool broadcastMessageX( Display* disp, const char* msg_type,
const QString& message, int screen, bool obsolete );
/**
* @deprecated
* This method is equivalent to broadcastMessageX() with obsolete = true.
*/
static bool broadcastMessageX( Display* disp, const char* msg_type,
const QString& message );
const QString& message, int screen );
Q_SIGNALS:
/**
* Emitted when a message was received.

View file

@ -734,7 +734,7 @@ bool KMainWindow::readPropertiesInternal( KConfig *config, int number )
return true;
}
void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg, bool force)
void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg)
{
K_D(KMainWindow);
kDebug(200) << "KMainWindow::applyMainWindowSettings " << cg.name();
@ -783,7 +783,7 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg, bool force)
group += (toolbar->objectName().isEmpty() ? QString::number(n) : QString(" ")+toolbar->objectName());
KConfigGroup toolbarGroup(&cg, group);
toolbar->applySettings(toolbarGroup, force);
toolbar->applySettings(toolbarGroup);
n++;
}

View file

@ -379,9 +379,8 @@ public:
* groups in the config file and apply them.
*
* @param config Config group to read the settings from.
* @param forceGlobal see the same argument in KToolBar::applySettings
*/
virtual void applyMainWindowSettings( const KConfigGroup &config, bool forceGlobal = false);
virtual void applyMainWindowSettings( const KConfigGroup &config);
/**
* Save settings for statusbar, menubar and toolbar to their respective

View file

@ -808,10 +808,6 @@ void KToolBar::saveSettings(KConfigGroup &cg)
{
Q_ASSERT(!cg.name().isEmpty());
if (cg.hasKey("Hidden")) {
cg.deleteEntry("Hidden"); // remove old key to avoid bugs from the compat code in applySettings. KDE5: remove.
}
const int currentIconSize = iconSize().width();
//kDebug() << objectName() << currentIconSize << d->iconSizeSettings.toString() << "defaultValue=" << d->iconSizeSettings.defaultValue();
if (!cg.hasDefault("IconSize") && currentIconSize == d->iconSizeSettings.defaultValue()) {
@ -997,22 +993,9 @@ void KToolBar::saveState(QDomElement &current) const
}
// called by KMainWindow::applyMainWindowSettings to read from the user settings
void KToolBar::applySettings(const KConfigGroup &cg, bool forceGlobal)
void KToolBar::applySettings(const KConfigGroup &cg)
{
Q_ASSERT(!cg.name().isEmpty());
Q_UNUSED(forceGlobal); // KDE5: remove
// a small leftover from kde3: separate bool for hidden/shown. But it's also part of saveMainWindowSettings,
// it is not really useful anymore, except in the unlikely case where someone would call this by hand.
// KDE5: remove the block below
if (cg.hasKey("Hidden")) {
const bool hidden = cg.readEntry("Hidden", false);
if (hidden)
hide();
else {
show();
}
}
if (cg.hasKey("IconSize")) {
d->iconSizeSettings[Level_UserSettings] = cg.readEntry("IconSize", 0);

View file

@ -132,7 +132,7 @@ public:
*/
void saveSettings( KConfigGroup &cg );
void applySettings( const KConfigGroup &cg, bool forceGlobal = false );
void applySettings( const KConfigGroup &cg );
/**
* Adds an XML gui client that uses this toolbar

View file

@ -402,7 +402,7 @@ void KXMLGUIBuilder::setBuilderComponentData(const KComponentData &componentData
d->m_componentData = componentData;
}
void KXMLGUIBuilder::finalizeGUI( KXMLGUIClient * )
void KXMLGUIBuilder::finalizeGUI( KXMLGUIClient *client )
{
KXmlGuiWindow* window = qobject_cast<KXmlGuiWindow*>(d->m_widget);
if (!window)
@ -416,7 +416,7 @@ void KXMLGUIBuilder::finalizeGUI( KXMLGUIClient * )
toolbar->positionYourself();
}
#else
window->finalizeGUI( false );
window->finalizeGUI( client );
#endif
}

View file

@ -325,37 +325,29 @@ void KXmlGuiWindow::createStandardStatusBarAction(){
d->showStatusBarAction->setChecked(sb->isHidden());
} else {
// If the language has changed, we'll need to grab the new text and whatsThis
KAction *tmpStatusBar = KStandardAction::showStatusbar(NULL, NULL, NULL);
KAction *tmpStatusBar = KStandardAction::showStatusbar(NULL, NULL, NULL);
d->showStatusBarAction->setText(tmpStatusBar->text());
d->showStatusBarAction->setWhatsThis(tmpStatusBar->whatsThis());
delete tmpStatusBar;
delete tmpStatusBar;
}
}
void KXmlGuiWindow::finalizeGUI( bool /*force*/ )
void KXmlGuiWindow::finalizeGUI( KXMLGUIClient *client )
{
// FIXME: this really needs to be removed with a code more like the one we had on KDE3.
// what we need to do here is to position correctly toolbars so they don't overlap.
// Also, take in count plugins could provide their own toolbars and those also need to
// be restored.
Q_UNUSED(client);
if (autoSaveSettings() && autoSaveConfigGroup().isValid()) {
applyMainWindowSettings(autoSaveConfigGroup());
}
}
void KXmlGuiWindow::applyMainWindowSettings(const KConfigGroup &config, bool force)
void KXmlGuiWindow::applyMainWindowSettings(const KConfigGroup &config)
{
K_D(KXmlGuiWindow);
KMainWindow::applyMainWindowSettings(config, force);
KMainWindow::applyMainWindowSettings(config);
KStatusBar *sb = this->findChild<KStatusBar*>();
if (sb && d->showStatusBarAction)
d->showStatusBarAction->setChecked(!sb->isHidden());
}
// KDE5 TODO: change it to "using KXMLGUIBuilder::finalizeGUI;" in the header
// and remove the reimplementation
void KXmlGuiWindow::finalizeGUI( KXMLGUIClient *client )
{ KXMLGUIBuilder::finalizeGUI( client ); }
#include "moc_kxmlguiwindow.cpp"

View file

@ -286,16 +286,10 @@ public:
*/
void setupToolbarMenuActions();
// KDE5 TODO: change it to "using KXMLGUIBuilder::finalizeGUI;"
virtual void finalizeGUI( KXMLGUIClient *client );
/**
* @internal
*/
void finalizeGUI( bool force );
// reimplemented for internal reasons
virtual void applyMainWindowSettings(const KConfigGroup &config, bool force = false);
virtual void applyMainWindowSettings(const KConfigGroup &config);
public Q_SLOTS:
/**