[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs
From: Pascal Létourneau <pascal.letourneau () kdemail ! net>
Date: 2006-09-11 17:45:05
Message-ID: 1157996705.142589.16708.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 583199 by pletourn:
Replace some virtual_hook() with real virtual functions
M +5 -9 khtml/khtml_ext.cpp
M +2 -2 khtml/khtml_ext.h
M +2 -13 kio/kfile/kcombiview.cpp
M +1 -2 kio/kfile/kcombiview.h
M +0 -3 kio/kfile/kdiroperator.cpp
M +1 -4 kio/kfile/kdiroperator.h
M +0 -3 kio/kfile/kfilepreview.cpp
M +0 -3 kio/kfile/kfilepreview.h
M +0 -17 kio/kfile/kfileview.cpp
M +0 -5 kio/kfile/kfileview.h
M +1 -35 kio/kio/dataslave.cpp
M +0 -2 kio/kio/dataslave.h
M +1 -66 kio/kio/slave.cpp
M +8 -33 kio/kio/slave.h
M +1 -12 kparts/browserextension.cpp
M +1 -19 kparts/browserextension.h
M +0 -3 kparts/historyprovider.cpp
M +0 -2 kparts/historyprovider.h
M +0 -3 kparts/partmanager.cpp
M +0 -2 kparts/partmanager.h
--- trunk/KDE/kdelibs/khtml/khtml_ext.cpp #583198:583199
@@ -962,17 +962,13 @@
return m_part->openURLInFrame( url, urlArgs );
}
-void KHTMLPartBrowserHostExtension::virtual_hook( int id, void *data )
+KParts::BrowserHostExtension* KHTMLPartBrowserHostExtension::findFrameParent( \
KParts::ReadOnlyPart + *callingPart, const QString &frame )
{
- if (id == VIRTUAL_FIND_FRAME_PARENT)
- {
- FindFrameParentParams *param = static_cast<FindFrameParentParams*>(data);
- KHTMLPart *parentPart = m_part->findFrameParent(param->callingPart, \
param->frame); + KHTMLPart *parentPart = m_part->findFrameParent(callingPart, \
frame); if (parentPart)
- param->parent = parentPart->browserHostExtension();
- return;
- }
- BrowserHostExtension::virtual_hook( id, data );
+ return parentPart->browserHostExtension();
+ return 0;
}
--- trunk/KDE/kdelibs/khtml/khtml_ext.h #583198:583199
@@ -100,10 +100,10 @@
virtual const QList<KParts::ReadOnlyPart*> frames() const;
+ virtual BrowserHostExtension* findFrameParent( KParts::ReadOnlyPart *callingPart, \
const QString &frame ); +
virtual bool openURLInFrame( const KUrl &url, const KParts::URLArgs &urlArgs );
-protected:
- virtual void virtual_hook( int id, void* data );
private:
KHTMLPart *m_part;
};
--- trunk/KDE/kdelibs/kio/kfile/kcombiview.cpp #583198:583199
@@ -337,25 +337,14 @@
QSplitter::setAcceptDrops(b);
}
-void KCombiView::setDropOptions_impl(int options)
+void KCombiView::setDropOptions(int options)
{
- KFileView::setDropOptions_impl(options);
+ KFileView::setDropOptions(options);
left->setDropOptions(options);
if (right)
right->setDropOptions(options);
}
-void KCombiView::virtual_hook( int id, void* data )
-{
- switch(id) {
- case VIRTUAL_SET_DROP_OPTIONS:
- setDropOptions_impl(*(int *)data);
- break;
- default:
- KFileView::virtual_hook( id, data );
- }
-}
-
bool KCombiView::eventFilter( QObject *o, QEvent *e )
{
int type = e->type();
--- trunk/KDE/kdelibs/kio/kfile/kcombiview.h #583198:583199
@@ -120,9 +120,8 @@
protected:
virtual bool eventFilter( QObject *o, QEvent *e );
- void setDropOptions_impl(int options);
+ virtual void setDropOptions(int options);
- virtual void virtual_hook( int id, void* data );
private:
class KCombiViewPrivate;
KCombiViewPrivate *d;
--- trunk/KDE/kdelibs/kio/kfile/kdiroperator.cpp #583198:583199
@@ -1713,7 +1713,4 @@
return showHiddenAction->isChecked();
}
-void KDirOperator::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
#include "kdiroperator.moc"
--- trunk/KDE/kdelibs/kio/kfile/kdiroperator.h #583198:583199
@@ -539,8 +539,7 @@
* Sets the options for dropping files.
* @see KFileView::DropOptions
*/
- // ### KDE4: make virtual
- void setDropOptions(int options);
+ virtual void setDropOptions(int options);
/**
* Starts and returns a KIO::CopyJob to trash the given @p items.
@@ -923,8 +922,6 @@
private:
static bool isReadable( const KUrl& url );
-protected:
- virtual void virtual_hook( int id, void* data );
private:
class KDirOperatorPrivate;
KDirOperatorPrivate* const d;
--- trunk/KDE/kdelibs/kio/kfile/kfilepreview.cpp #583198:583199
@@ -275,6 +275,3 @@
left->writeConfig( configGroup);
}
-void KFilePreview::virtual_hook( int id, void* data )
-{ KFileView::virtual_hook( id, data ); }
-
--- trunk/KDE/kdelibs/kio/kfile/kfilepreview.h #583198:583199
@@ -112,9 +112,6 @@
QWidget *preview;
QString viewname;
-protected:
- /** \internal */
- virtual void virtual_hook( int id, void* data );
private:
class KFilePreviewPrivate;
KFilePreviewPrivate *d;
--- trunk/KDE/kdelibs/kio/kfile/kfileview.cpp #583198:583199
@@ -395,11 +395,6 @@
void KFileView::setDropOptions(int options)
{
- virtual_hook(VIRTUAL_SET_DROP_OPTIONS, &options); // Virtual call
-}
-
-void KFileView::setDropOptions_impl(int options)
-{
d->dropOptions = options;
}
@@ -413,16 +408,4 @@
return (QApplication::startDragTime() * 3) / 2;
}
-void KFileView::virtual_hook( int id, void* data)
-{
- switch(id) {
- case VIRTUAL_SET_DROP_OPTIONS:
- setDropOptions_impl(*(int *)data);
- break;
- default:
- /*BASE::virtual_hook( id, data );*/
- break;
- }
-}
-
#include "kfileview.moc"
--- trunk/KDE/kdelibs/kio/kfile/kfileview.h #583198:583199
@@ -427,11 +427,6 @@
mutable KFileItemList *m_selectedList;
bool myOnlyDoubleClickSelectsFiles;
-protected:
- virtual void virtual_hook( int id, void* data );
- /* @internal for virtual_hook */
- enum { VIRTUAL_SET_DROP_OPTIONS = 1 };
- void setDropOptions_impl(int options);
private:
class KFileViewPrivate;
KFileViewPrivate* const d;
--- trunk/KDE/kdelibs/kio/kio/dataslave.cpp #583198:583199
@@ -57,7 +57,7 @@
DataSlave::DataSlave() :
- Slave(true, 0, "data", QString())
+ Slave(0, "data", QString())
{
//kDebug() << this << k_funcinfo << endl;
_suspended = false;
@@ -168,40 +168,6 @@
emit metaData(meta_data);
}
-void DataSlave::virtual_hook( int id, void* data ) {
- switch (id) {
- case VIRTUAL_SUSPEND: suspend(); return;
- case VIRTUAL_RESUME: resume(); return;
- case VIRTUAL_SEND: {
- SendParams *params = reinterpret_cast<SendParams *>(data);
- send(params->cmd, *params->arr);
- return;
- }
- case VIRTUAL_HOLD: {
- HoldParams *params = reinterpret_cast<HoldParams *>(data);
- hold(*params->url);
- return;
- }
- case VIRTUAL_SUSPENDED: {
- SuspendedParams *params = reinterpret_cast<SuspendedParams *>(data);
- params->retval = suspended();
- return;
- }
- case VIRTUAL_SET_HOST: {
- SetHostParams *params = reinterpret_cast<SetHostParams *>(data);
- setHost(*params->host,params->port,*params->user,*params->passwd);
- return;
- }
- case VIRTUAL_SET_CONFIG: {
- SetConfigParams *params = reinterpret_cast<SetConfigParams *>(data);
- setConfig(*params->config);
- return;
- }
- default:
- KIO::Slave::virtual_hook( id, data );
- }
-}
-
DISPATCH_IMPL1(mimeType, const QString &, s)
DISPATCH_IMPL1(totalSize, KIO::filesize_t, size)
DISPATCH_IMPL(sendMetaData)
--- trunk/KDE/kdelibs/kio/kio/dataslave.h #583198:583199
@@ -110,8 +110,6 @@
* queued methods.
*/
void dispatchNext();
- protected:
- virtual void virtual_hook( int id, void* data );
private:
MetaData meta_data;
bool _suspended;
--- trunk/KDE/kdelibs/kio/kio/slave.cpp #583198:583199
@@ -82,11 +82,6 @@
* @internal
*/
class SlavePrivate {
- public:
- bool derived; // true if this instance of Slave is actually an
- // instance of a derived class.
-
- SlavePrivate(bool derived) : derived(derived) {}
};
}
@@ -142,8 +137,7 @@
}
Slave::Slave(KServerSocket *socket, const QString &protocol, const QString \
&socketname)
- : SlaveInterface(&slaveconn), serv(socket), contacted(false),
- d(new SlavePrivate(false))
+ : SlaveInterface(&slaveconn), serv(socket), contacted(false)
{
m_refCount = 1;
m_protocol = protocol;
@@ -161,30 +155,6 @@
#endif
}
-Slave::Slave(bool /*derived*/, KServerSocket *socket, const QString &protocol,
- const QString &socketname)
- : SlaveInterface(&slaveconn), serv(socket), contacted(false),
- d(new SlavePrivate(true))
-{
- // FIXME: hmm, duplicating code here from public ctor, no good (LS)
- m_refCount = 1;
- m_protocol = protocol;
- m_slaveProtocol = protocol;
- m_socket = socketname;
- dead = false;
- contact_started = time(0);
- idle_since = contact_started;
- m_pid = 0;
- m_port = 0;
- if (serv != 0) {
-#ifndef Q_WS_WIN
- serv->setAcceptBuffered(false);
- connect(serv, SIGNAL(readyAccept()),
- SLOT(accept() ) );
-#endif
- }
-}
-
Slave::~Slave()
{
// kDebug(7002) << "destructing slave object pid = " << m_pid << endl;
@@ -220,13 +190,6 @@
void Slave::hold(const KUrl &url)
{
- if (d->derived) { // TODO: clean up before KDE 4
- HoldParams params;
- params.url = &url;
- virtual_hook(VIRTUAL_HOLD, ¶ms);
- return;
- }/*end if*/
-
ref();
{
QByteArray data;
@@ -246,44 +209,20 @@
void Slave::suspend()
{
- if (d->derived) { // TODO: clean up before KDE 4
- virtual_hook(VIRTUAL_SUSPEND, 0);
- return;
- }/*end if*/
-
slaveconn.suspend();
}
void Slave::resume()
{
- if (d->derived) { // TODO: clean up before KDE 4
- virtual_hook(VIRTUAL_RESUME, 0);
- return;
- }/*end if*/
-
slaveconn.resume();
}
bool Slave::suspended()
{
- if (d->derived) { // TODO: clean up before KDE 4
- SuspendedParams params;
- virtual_hook(VIRTUAL_SUSPENDED, ¶ms);
- return params.retval;
- }/*end if*/
-
return slaveconn.suspended();
}
void Slave::send(int cmd, const QByteArray &arr) {
- if (d->derived) { // TODO: clean up before KDE 4
- SendParams params;
- params.cmd = cmd;
- params.arr = &arr;
- virtual_hook(VIRTUAL_SEND, ¶ms);
- return;
- }/*end if*/
-
slaveconn.send(cmd, arr);
}
@@ -496,8 +435,4 @@
return slave;
}
-void Slave::virtual_hook( int id, void* data ) {
- KIO::SlaveInterface::virtual_hook( id, data );
-}
-
#include "slave.moc"
--- trunk/KDE/kdelibs/kio/kio/slave.h #583198:583199
@@ -82,8 +82,8 @@
* @param user to login as
* @param passwd to login with
*/
- void setHost( const QString &host, int port,
- const QString &user, const QString &passwd); // TODO(BIC): \
make virtual + virtual void setHost( const QString &host, int port,
+ const QString &user, const QString &passwd);
/**
* Clear host info.
@@ -93,7 +93,7 @@
/**
* Configure slave
*/
- void setConfig(const MetaData &config); // TODO(BIC): make virtual
+ virtual void setConfig(const MetaData &config);
/**
* The protocol this slave handles.
@@ -155,28 +155,28 @@
/**
* Suspends the operation of the attached kioslave.
*/
- void suspend(); // TODO(BIC): make virtual
+ virtual void suspend();
/**
* Resumes the operation of the attached kioslave.
*/
- void resume(); // TODO(BIC): make virtual
+ virtual void resume();
/**
* Tells wether the kioslave is suspended.
* @return true if the kioslave is suspended.
*/
- bool suspended(); // TODO(BIC): make virtual
+ virtual bool suspended();
/**
* Sends the given command to the kioslave.
* @param cmd command id
* @param arr byte array containing data
*/
- void send(int cmd, const QByteArray &arr = QByteArray());// TODO(BIC): make \
virtual + virtual void send(int cmd, const QByteArray &arr = QByteArray());
// == end communication with connected kioslave ==
/**
* Puts the kioslave associated with @p url at halt.
*/
- void hold(const KUrl &url); // TODO(BIC): make virtual
+ virtual void hold(const KUrl &url);
/**
* @return The time this slave has been idle.
@@ -224,31 +224,6 @@
time_t idle_since;
KIO::Connection slaveconn;
int m_refCount;
- protected:
- virtual void virtual_hook( int id, void* data );
- // grant SlaveInterface all IDs < 0x200
- enum { VIRTUAL_SUSPEND = 0x200, VIRTUAL_RESUME, VIRTUAL_SEND,
- VIRTUAL_HOLD, VIRTUAL_SUSPENDED,
- VIRTUAL_SET_HOST, VIRTUAL_SET_CONFIG };
- struct SendParams {
- int cmd;
- const QByteArray *arr;
- };
- struct HoldParams {
- const KUrl *url;
- };
- struct SuspendedParams {
- bool retval;
- };
- struct SetHostParams {
- const QString *host;
- int port;
- const QString *user;
- const QString *passwd;
- };
- struct SetConfigParams {
- const MetaData *config;
- };
private:
class SlavePrivate* d;
};
--- trunk/KDE/kdelibs/kparts/browserextension.cpp #583198:583199
@@ -679,23 +679,12 @@
return 0L;
}
-void BrowserExtension::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
BrowserHostExtension *
BrowserHostExtension::findFrameParent(KParts::ReadOnlyPart *callingPart, const \
QString &frame) {
- FindFrameParentParams param;
- param.parent = 0;
- param.callingPart = callingPart;
- param.frame = frame;
- virtual_hook(VIRTUAL_FIND_FRAME_PARENT, ¶m);
- return param.parent;
+ return 0;
}
-void BrowserHostExtension::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
LiveConnectExtension::LiveConnectExtension( KParts::ReadOnlyPart *parent ) : \
QObject( parent) {}
bool LiveConnectExtension::get( const unsigned long, const QString &, Type &, \
unsigned long &, QString & ) {
--- trunk/KDE/kdelibs/kparts/browserextension.h #583198:583199
@@ -694,9 +694,6 @@
static ActionNumberMap * s_actionNumberMap;
static ActionSlotMap * s_actionSlotMap;
static void createActionSlotMap();
-protected:
- virtual void virtual_hook( int id, void* data );
-private:
BrowserExtensionPrivate *d;
};
@@ -731,7 +728,7 @@
* Returns the part that contains @p frame and that may be accessed
* by @p callingPart
*/
- BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const \
QString &frame); + virtual BrowserHostExtension \
*findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame);
/**
* Opens the given url in a hosted child frame. The frame name is specified in the
@@ -745,21 +742,6 @@
*/
static BrowserHostExtension *childObject( QObject *obj );
-protected:
- /** This 'enum' along with the structure below is NOT part of the public API.
- * It's going to disappear in KDE 4.0 and is likely to change inbetween.
- *
- * @internal
- */
- enum { VIRTUAL_FIND_FRAME_PARENT = 0x10 };
- struct FindFrameParentParams
- {
- BrowserHostExtension *parent;
- KParts::ReadOnlyPart *callingPart;
- QString frame;
- };
-
- virtual void virtual_hook( int id, void* data );
private:
class BrowserHostExtensionPrivate;
BrowserHostExtensionPrivate *d;
--- trunk/KDE/kdelibs/kparts/historyprovider.cpp #583198:583199
@@ -81,7 +81,4 @@
emit cleared();
}
-void HistoryProvider::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
#include "historyprovider.moc"
--- trunk/KDE/kdelibs/kparts/historyprovider.h #583198:583199
@@ -91,8 +91,6 @@
private:
static HistoryProvider *s_self;
-protected:
- virtual void virtual_hook( int id, void* data );
private:
class HistoryProviderPrivate;
HistoryProviderPrivate* const d;
--- trunk/KDE/kdelibs/kparts/partmanager.cpp #583198:583199
@@ -587,9 +587,6 @@
return d->m_reason;
}
-void PartManager::virtual_hook( int, void* )
-{ /*BASE::virtual_hook( id, data );*/ }
-
#include "partmanager.moc"
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- trunk/KDE/kdelibs/kparts/partmanager.h #583198:583199
@@ -272,8 +272,6 @@
Part * findPartFromWidget( QWidget * widget, const QPoint &pos );
Part * findPartFromWidget( QWidget * widget );
-protected:
- virtual void virtual_hook( int id, void* data );
private:
PartManagerPrivate* const d;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic