mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kparts: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f8f34a1825
commit
f43675b01d
8 changed files with 759 additions and 750 deletions
|
@ -51,9 +51,7 @@ public:
|
||||||
, m_browserArgs(browserArgs)
|
, m_browserArgs(browserArgs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~OpenUrlEventPrivate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static const char *s_strOpenUrlEvent;
|
static const char *s_strOpenUrlEvent;
|
||||||
ReadOnlyPart *m_part;
|
ReadOnlyPart *m_part;
|
||||||
KUrl m_url;
|
KUrl m_url;
|
||||||
|
@ -107,13 +105,15 @@ namespace KParts
|
||||||
|
|
||||||
struct BrowserArgumentsPrivate
|
struct BrowserArgumentsPrivate
|
||||||
{
|
{
|
||||||
BrowserArgumentsPrivate() {
|
BrowserArgumentsPrivate()
|
||||||
|
{
|
||||||
doPost = false;
|
doPost = false;
|
||||||
redirectedRequest = false;
|
redirectedRequest = false;
|
||||||
lockHistory = false;
|
lockHistory = false;
|
||||||
newTab = false;
|
newTab = false;
|
||||||
forcesNewWindow = false;
|
forcesNewWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString contentType; // for POST
|
QString contentType; // for POST
|
||||||
bool doPost;
|
bool doPost;
|
||||||
bool redirectedRequest;
|
bool redirectedRequest;
|
||||||
|
@ -139,9 +139,12 @@ BrowserArguments::BrowserArguments( const BrowserArguments &args )
|
||||||
|
|
||||||
BrowserArguments &BrowserArguments::operator=(const BrowserArguments &args)
|
BrowserArguments &BrowserArguments::operator=(const BrowserArguments &args)
|
||||||
{
|
{
|
||||||
if (this == &args) return *this;
|
if (this == &args) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
delete d; d= 0;
|
delete d;
|
||||||
|
d = nullptr;
|
||||||
|
|
||||||
softReload = args.softReload;
|
softReload = args.softReload;
|
||||||
postData = args.postData;
|
postData = args.postData;
|
||||||
|
@ -149,8 +152,9 @@ BrowserArguments &BrowserArguments::operator=(const BrowserArguments &args)
|
||||||
docState = args.docState;
|
docState = args.docState;
|
||||||
trustedSource = args.trustedSource;
|
trustedSource = args.trustedSource;
|
||||||
|
|
||||||
if ( args.d )
|
if (args.d) {
|
||||||
d = new BrowserArgumentsPrivate(*args.d);
|
d = new BrowserArgumentsPrivate(*args.d);
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -158,20 +162,22 @@ BrowserArguments &BrowserArguments::operator=(const BrowserArguments &args)
|
||||||
BrowserArguments::~BrowserArguments()
|
BrowserArguments::~BrowserArguments()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
d = 0;
|
d = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserArguments::setContentType(const QString &contentType)
|
void BrowserArguments::setContentType(const QString &contentType)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->contentType = contentType;
|
d->contentType = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserArguments::setRedirectedRequest(bool redirected)
|
void BrowserArguments::setRedirectedRequest(bool redirected)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->redirectedRequest = redirected;
|
d->redirectedRequest = redirected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +193,9 @@ QString BrowserArguments::contentType() const
|
||||||
|
|
||||||
void BrowserArguments::setDoPost(bool enable)
|
void BrowserArguments::setDoPost(bool enable)
|
||||||
{
|
{
|
||||||
if ( !d )
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->doPost = enable;
|
d->doPost = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +206,9 @@ bool BrowserArguments::doPost() const
|
||||||
|
|
||||||
void BrowserArguments::setLockHistory(bool lock)
|
void BrowserArguments::setLockHistory(bool lock)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->lockHistory = lock;
|
d->lockHistory = lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +219,9 @@ bool BrowserArguments::lockHistory() const
|
||||||
|
|
||||||
void BrowserArguments::setNewTab(bool newTab)
|
void BrowserArguments::setNewTab(bool newTab)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->newTab = newTab;
|
d->newTab = newTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,8 +232,9 @@ bool BrowserArguments::newTab() const
|
||||||
|
|
||||||
void BrowserArguments::setForcesNewWindow(bool forcesNewWindow)
|
void BrowserArguments::setForcesNewWindow(bool forcesNewWindow)
|
||||||
{
|
{
|
||||||
if (!d)
|
if (!d) {
|
||||||
d = new BrowserArgumentsPrivate;
|
d = new BrowserArgumentsPrivate();
|
||||||
|
}
|
||||||
d->forcesNewWindow = forcesNewWindow;
|
d->forcesNewWindow = forcesNewWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +252,8 @@ public:
|
||||||
BrowserExtensionPrivate(KParts::ReadOnlyPart *parent)
|
BrowserExtensionPrivate(KParts::ReadOnlyPart *parent)
|
||||||
: m_urlDropHandlingEnabled(false),
|
: m_urlDropHandlingEnabled(false),
|
||||||
m_part(parent)
|
m_part(parent)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
struct DelayedRequest {
|
struct DelayedRequest {
|
||||||
KUrl m_delayedURL;
|
KUrl m_delayedURL;
|
||||||
|
@ -279,8 +290,7 @@ void BrowserExtension::BrowserExtensionPrivate::createActionSlotMap()
|
||||||
// Create the action-number map
|
// Create the action-number map
|
||||||
ActionSlotMap::ConstIterator it = s_actionSlotMap->constBegin();
|
ActionSlotMap::ConstIterator it = s_actionSlotMap->constBegin();
|
||||||
ActionSlotMap::ConstIterator itEnd = s_actionSlotMap->constEnd();
|
ActionSlotMap::ConstIterator itEnd = s_actionSlotMap->constEnd();
|
||||||
for ( int i=0 ; it != itEnd ; ++it, ++i )
|
for (int i = 0 ; it != itEnd ; ++it, ++i) {
|
||||||
{
|
|
||||||
// kDebug() << " action " << it.key() << " number " << i;
|
// kDebug() << " action " << it.key() << " number " << i;
|
||||||
s_actionNumberMap->insert( it.key(), i );
|
s_actionNumberMap->insert( it.key(), i );
|
||||||
}
|
}
|
||||||
|
@ -289,44 +299,53 @@ void BrowserExtension::BrowserExtensionPrivate::createActionSlotMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserExtension::BrowserExtension(KParts::ReadOnlyPart *parent)
|
BrowserExtension::BrowserExtension(KParts::ReadOnlyPart *parent)
|
||||||
: QObject( parent ), d( new BrowserExtensionPrivate(parent) )
|
: QObject(parent),
|
||||||
|
d(new BrowserExtensionPrivate(parent))
|
||||||
{
|
{
|
||||||
// kDebug() << "BrowserExtension::BrowserExtension() " << this;
|
// kDebug() << "BrowserExtension::BrowserExtension() " << this;
|
||||||
|
|
||||||
if (s_actionSlotMap->isEmpty())
|
if (s_actionSlotMap->isEmpty()) {
|
||||||
// Create the action-slot map
|
// Create the action-slot map
|
||||||
BrowserExtensionPrivate::createActionSlotMap();
|
BrowserExtensionPrivate::createActionSlotMap();
|
||||||
|
}
|
||||||
|
|
||||||
// Build list with this extension's slot names.
|
// Build list with this extension's slot names.
|
||||||
QList<QByteArray> slotNames;
|
QList<QByteArray> slotNames;
|
||||||
int methodCount = metaObject()->methodCount();
|
int methodCount = metaObject()->methodCount();
|
||||||
int methodOffset = metaObject()->methodOffset();
|
int methodOffset = metaObject()->methodOffset();
|
||||||
for ( int i=0 ; i < methodCount; ++i )
|
for (int i= 0; i < methodCount; ++i) {
|
||||||
{
|
|
||||||
QMetaMethod method = metaObject()->method(methodOffset + i);
|
QMetaMethod method = metaObject()->method(methodOffset + i);
|
||||||
if ( method.methodType() == QMetaMethod::Slot )
|
if (method.methodType() == QMetaMethod::Slot) {
|
||||||
slotNames.append(method.signature());
|
slotNames.append(method.signature());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the initial status of the actions depending on whether
|
// Set the initial status of the actions depending on whether
|
||||||
// they're supported or not
|
// they're supported or not
|
||||||
ActionSlotMap::ConstIterator it = s_actionSlotMap->constBegin();
|
ActionSlotMap::ConstIterator it = s_actionSlotMap->constBegin();
|
||||||
ActionSlotMap::ConstIterator itEnd = s_actionSlotMap->constEnd();
|
ActionSlotMap::ConstIterator itEnd = s_actionSlotMap->constEnd();
|
||||||
for ( int i=0 ; it != itEnd ; ++it, ++i )
|
for (int i = 0 ; it != itEnd ; ++it, ++i) {
|
||||||
{
|
|
||||||
// Does the extension have a slot with the name of this action ?
|
// Does the extension have a slot with the name of this action ?
|
||||||
// ######### KDE4 TODO: use QMetaObject::indexOfMethod() #######
|
// ######### KDE4 TODO: use QMetaObject::indexOfMethod() #######
|
||||||
d->m_actionStatus.setBit(i, slotNames.contains(it.key()+"()"));
|
d->m_actionStatus.setBit(i, slotNames.contains(it.key()+"()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( d->m_part, SIGNAL(completed()),
|
connect(
|
||||||
this, SLOT(slotCompleted()) );
|
d->m_part, SIGNAL(completed()),
|
||||||
connect( this, SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
|
this, SLOT(slotCompleted())
|
||||||
this, SLOT(slotOpenUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)) );
|
);
|
||||||
connect( this, SIGNAL(enableAction(const char*,bool)),
|
connect(
|
||||||
this, SLOT(slotEnableAction(const char*,bool)) );
|
this, SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
|
||||||
connect( this, SIGNAL(setActionText(const char*,QString)),
|
this, SLOT(slotOpenUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments))
|
||||||
this, SLOT(slotSetActionText(const char*,QString)) );
|
);
|
||||||
|
connect(
|
||||||
|
this, SIGNAL(enableAction(const char*,bool)),
|
||||||
|
this, SLOT(slotEnableAction(const char*,bool))
|
||||||
|
);
|
||||||
|
connect(
|
||||||
|
this, SIGNAL(setActionText(const char*,QString)),
|
||||||
|
this, SLOT(slotSetActionText(const char*,QString))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserExtension::~BrowserExtension()
|
BrowserExtension::~BrowserExtension()
|
||||||
|
@ -364,7 +383,8 @@ void BrowserExtension::saveState( QDataStream &stream )
|
||||||
void BrowserExtension::restoreState( QDataStream &stream )
|
void BrowserExtension::restoreState( QDataStream &stream )
|
||||||
{
|
{
|
||||||
KUrl u;
|
KUrl u;
|
||||||
qint32 xOfs, yOfs;
|
qint32 xOfs = 0;
|
||||||
|
qint32 yOfs = 0;
|
||||||
stream >> u >> xOfs >> yOfs;
|
stream >> u >> xOfs >> yOfs;
|
||||||
|
|
||||||
OpenUrlArguments args;
|
OpenUrlArguments args;
|
||||||
|
@ -405,24 +425,23 @@ void BrowserExtension::pasteRequest()
|
||||||
KUriFilterData filterData;
|
KUriFilterData filterData;
|
||||||
filterData.setData( url );
|
filterData.setData( url );
|
||||||
filterData.setCheckForExecutables(false);
|
filterData.setCheckForExecutables(false);
|
||||||
if ( KUriFilter::self()->filterUri( filterData, filters ) )
|
if (KUriFilter::self()->filterUri(filterData, filters)) {
|
||||||
{
|
switch (filterData.uriType()) {
|
||||||
switch ( filterData.uriType() )
|
|
||||||
{
|
|
||||||
case KUriFilterData::LocalFile:
|
case KUriFilterData::LocalFile:
|
||||||
case KUriFilterData::LocalDir:
|
case KUriFilterData::LocalDir:
|
||||||
case KUriFilterData::NetProtocol:
|
case KUriFilterData::NetProtocol: {
|
||||||
slotOpenUrlRequest(filterData.uri());
|
slotOpenUrlRequest(filterData.uri());
|
||||||
break;
|
break;
|
||||||
case KUriFilterData::Error:
|
}
|
||||||
|
case KUriFilterData::Error: {
|
||||||
KMessageBox::sorry( d->m_part->widget(), filterData.errorMsg());
|
KMessageBox::sorry( d->m_part->widget(), filterData.errorMsg());
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( KUriFilter::self()->filterUri( filterData,
|
} else if (KUriFilter::self()->filterUri(filterData, QStringList(QLatin1String("kuriikwsfilter"))) &&
|
||||||
QStringList( QLatin1String( "kuriikwsfilter" ) ) ) &&
|
|
||||||
url.length() < 250 )
|
url.length() < 250 )
|
||||||
{
|
{
|
||||||
if (KMessageBox::questionYesNo(d->m_part->widget(),
|
if (KMessageBox::questionYesNo(d->m_part->widget(),
|
||||||
|
@ -433,7 +452,9 @@ void BrowserExtension::pasteRequest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserExtension::slotOpenUrlRequest( const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments &browserArgs )
|
void BrowserExtension::slotOpenUrlRequest(const KUrl &url,
|
||||||
|
const KParts::OpenUrlArguments &args,
|
||||||
|
const KParts::BrowserArguments &browserArgs)
|
||||||
{
|
{
|
||||||
// kDebug() << this << " BrowserExtension::slotOpenURLRequest(): url=" << url.url();
|
// kDebug() << this << " BrowserExtension::slotOpenURLRequest(): url=" << url.url();
|
||||||
BrowserExtensionPrivate::DelayedRequest req;
|
BrowserExtensionPrivate::DelayedRequest req;
|
||||||
|
@ -446,7 +467,9 @@ void BrowserExtension::slotOpenUrlRequest( const KUrl &url, const KParts::OpenUr
|
||||||
|
|
||||||
void BrowserExtension::slotEmitOpenUrlRequestDelayed()
|
void BrowserExtension::slotEmitOpenUrlRequestDelayed()
|
||||||
{
|
{
|
||||||
if (d->m_requests.isEmpty()) return;
|
if (d->m_requests.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
BrowserExtensionPrivate::DelayedRequest req = d->m_requests.front();
|
BrowserExtensionPrivate::DelayedRequest req = d->m_requests.front();
|
||||||
d->m_requests.pop_front();
|
d->m_requests.pop_front();
|
||||||
emit openUrlRequestDelayed(req.m_delayedURL, req.m_delayedArgs, req.m_delayedBrowserArgs);
|
emit openUrlRequestDelayed(req.m_delayedURL, req.m_delayedArgs, req.m_delayedBrowserArgs);
|
||||||
|
@ -457,14 +480,13 @@ void BrowserExtension::slotEnableAction( const char * name, bool enabled )
|
||||||
{
|
{
|
||||||
//kDebug() << "BrowserExtension::slotEnableAction " << name << " " << enabled;
|
//kDebug() << "BrowserExtension::slotEnableAction " << name << " " << enabled;
|
||||||
ActionNumberMap::ConstIterator it = s_actionNumberMap->constFind(name);
|
ActionNumberMap::ConstIterator it = s_actionNumberMap->constFind(name);
|
||||||
if ( it != s_actionNumberMap->constEnd() )
|
if (it != s_actionNumberMap->constEnd()) {
|
||||||
{
|
|
||||||
d->m_actionStatus.setBit( it.value(), enabled );
|
d->m_actionStatus.setBit( it.value(), enabled );
|
||||||
//kDebug() << "BrowserExtension::slotEnableAction setting bit " << it.data() << " to " << enabled;
|
//kDebug() << "BrowserExtension::slotEnableAction setting bit " << it.data() << " to " << enabled;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
kWarning() << "BrowserExtension::slotEnableAction unknown action " << name;
|
kWarning() << "BrowserExtension::slotEnableAction unknown action " << name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowserExtension::isActionEnabled(const char *name) const
|
bool BrowserExtension::isActionEnabled(const char *name) const
|
||||||
{
|
{
|
||||||
|
@ -476,20 +498,20 @@ void BrowserExtension::slotSetActionText( const char * name, const QString& text
|
||||||
{
|
{
|
||||||
//kDebug() << "BrowserExtension::slotSetActionText " << name << " " << text;
|
//kDebug() << "BrowserExtension::slotSetActionText " << name << " " << text;
|
||||||
ActionNumberMap::ConstIterator it = s_actionNumberMap->constFind(name);
|
ActionNumberMap::ConstIterator it = s_actionNumberMap->constFind(name);
|
||||||
if ( it != s_actionNumberMap->constEnd() )
|
if (it != s_actionNumberMap->constEnd()) {
|
||||||
{
|
|
||||||
d->m_actionText[it.value()] = text;
|
d->m_actionText[it.value()] = text;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
kWarning() << "BrowserExtension::slotSetActionText unknown action" << name;
|
kWarning() << "BrowserExtension::slotSetActionText unknown action" << name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString BrowserExtension::actionText(const char *name) const
|
QString BrowserExtension::actionText(const char *name) const
|
||||||
{
|
{
|
||||||
int actionNumber = (*s_actionNumberMap)[ name ];
|
int actionNumber = (*s_actionNumberMap)[ name ];
|
||||||
QMap<int, QString>::ConstIterator it = d->m_actionText.constFind(actionNumber);
|
QMap<int, QString>::ConstIterator it = d->m_actionText.constFind(actionNumber);
|
||||||
if ( it != d->m_actionText.constEnd() )
|
if (it != d->m_actionText.constEnd()) {
|
||||||
return *it;
|
return *it;
|
||||||
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,8 +523,9 @@ BrowserExtension::ActionSlotMap BrowserExtension::actionSlotMap()
|
||||||
|
|
||||||
BrowserExtension::ActionSlotMap* BrowserExtension::actionSlotMapPtr()
|
BrowserExtension::ActionSlotMap* BrowserExtension::actionSlotMapPtr()
|
||||||
{
|
{
|
||||||
if (s_actionSlotMap->isEmpty())
|
if (s_actionSlotMap->isEmpty()) {
|
||||||
BrowserExtensionPrivate::createActionSlotMap();
|
BrowserExtensionPrivate::createActionSlotMap();
|
||||||
|
}
|
||||||
return s_actionSlotMap;
|
return s_actionSlotMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,6 @@ struct KPARTS_EXPORT BrowserArguments
|
||||||
|
|
||||||
virtual ~BrowserArguments();
|
virtual ~BrowserArguments();
|
||||||
|
|
||||||
// KDE4: a struct has the problem that the stuff added after BC-freeze uses methods
|
|
||||||
// so it looks inconsistent with the member vars. -> better use methods for everything,
|
|
||||||
// even if they are inline.
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This buffer can be used by the part to save and restore its contents.
|
* This buffer can be used by the part to save and restore its contents.
|
||||||
* See KWebKitPart for instance.
|
* See KWebKitPart for instance.
|
||||||
|
@ -96,6 +91,7 @@ struct KPARTS_EXPORT BrowserArguments
|
||||||
* KHTML-specific field, header defining the type of the POST data.
|
* KHTML-specific field, header defining the type of the POST data.
|
||||||
*/
|
*/
|
||||||
QString contentType() const;
|
QString contentType() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* KHTML-specific field, whether to do a POST instead of a GET,
|
* KHTML-specific field, whether to do a POST instead of a GET,
|
||||||
* for the next openURL.
|
* for the next openURL.
|
||||||
|
@ -267,7 +263,6 @@ public:
|
||||||
*/
|
*/
|
||||||
explicit BrowserExtension(KParts::ReadOnlyPart *parent);
|
explicit BrowserExtension(KParts::ReadOnlyPart *parent);
|
||||||
|
|
||||||
|
|
||||||
virtual ~BrowserExtension();
|
virtual ~BrowserExtension();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,7 +283,6 @@ public:
|
||||||
ShowUrlOperations = 0x0100, /**< show copy, paste, as well as cut if NoDeletion is not set. */
|
ShowUrlOperations = 0x0100, /**< show copy, paste, as well as cut if NoDeletion is not set. */
|
||||||
ShowProperties = 0x200 /**< show "Properties" action (usually done by directory views) */
|
ShowProperties = 0x200 /**< show "Properties" action (usually done by directory views) */
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(PopupFlags, PopupFlag)
|
Q_DECLARE_FLAGS(PopupFlags, PopupFlag)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -510,7 +504,7 @@ public: // yes, those signals are public; don't tell moc or doxygen :)
|
||||||
void createNewWindow(const KUrl &url,
|
void createNewWindow(const KUrl &url,
|
||||||
const KParts::OpenUrlArguments &arguments = KParts::OpenUrlArguments(),
|
const KParts::OpenUrlArguments &arguments = KParts::OpenUrlArguments(),
|
||||||
const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments(),
|
const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments(),
|
||||||
KParts::ReadOnlyPart** part = 0 );
|
KParts::ReadOnlyPart** part = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since the part emits the jobid in the started() signal,
|
* Since the part emits the jobid in the started() signal,
|
||||||
|
@ -643,4 +637,3 @@ private:
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::BrowserExtension::PopupFlags)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::BrowserExtension::PopupFlags)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,11 @@ using namespace KParts;
|
||||||
class KParts::EventPrivate
|
class KParts::EventPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventPrivate( const char *eventName ) :
|
EventPrivate(const char *eventName)
|
||||||
m_eventName(eventName)
|
: m_eventName(eventName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* m_eventName;
|
const char* m_eventName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,23 +53,22 @@ const char *Event::eventName() const
|
||||||
|
|
||||||
bool Event::test(const QEvent *event)
|
bool Event::test(const QEvent *event)
|
||||||
{
|
{
|
||||||
if ( !event )
|
if (!event) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return (event->type() == (QEvent::Type)(QEvent::User + KPARTS_EVENT_MAGIC));
|
return (event->type() == (QEvent::Type)(QEvent::User + KPARTS_EVENT_MAGIC));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Event::test(const QEvent *event, const char *name)
|
bool Event::test(const QEvent *event, const char *name)
|
||||||
{
|
{
|
||||||
if ( !test( event ) )
|
if (!test(event)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return ( strcmp( name, ((Event*)event)->eventName() ) == 0 );
|
return (qstrcmp(name, ((Event*)event)->eventName()) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////// GUIActivateEvent ////////
|
/////// GUIActivateEvent ////////
|
||||||
|
|
||||||
class KParts::GUIActivateEventPrivate
|
class KParts::GUIActivateEventPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -82,8 +82,8 @@ public:
|
||||||
|
|
||||||
const char *GUIActivateEventPrivate::s_strGUIActivateEvent = "KParts/GUIActivate";
|
const char *GUIActivateEventPrivate::s_strGUIActivateEvent = "KParts/GUIActivate";
|
||||||
|
|
||||||
GUIActivateEvent::GUIActivateEvent( bool activated ) :
|
GUIActivateEvent::GUIActivateEvent(bool activated)
|
||||||
Event( GUIActivateEventPrivate::s_strGUIActivateEvent ),
|
: Event(GUIActivateEventPrivate::s_strGUIActivateEvent),
|
||||||
d(new GUIActivateEventPrivate(activated))
|
d(new GUIActivateEventPrivate(activated))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -102,4 +102,3 @@ bool GUIActivateEvent::test( const QEvent *event )
|
||||||
{
|
{
|
||||||
return Event::test(event, GUIActivateEventPrivate::s_strGUIActivateEvent);
|
return Event::test(event, GUIActivateEventPrivate::s_strGUIActivateEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <kcomponentdata.h>
|
#include <kcomponentdata.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
using namespace KParts;
|
using namespace KParts;
|
||||||
|
|
||||||
Factory::Factory(QObject *parent)
|
Factory::Factory(QObject *parent)
|
||||||
|
@ -44,8 +42,9 @@ Factory::~Factory()
|
||||||
Part *Factory::createPart(QWidget *parentWidget, QObject *parent, const char *classname, const QStringList &args)
|
Part *Factory::createPart(QWidget *parentWidget, QObject *parent, const char *classname, const QStringList &args)
|
||||||
{
|
{
|
||||||
Part* part = createPartObject(parentWidget, parent, classname, args);
|
Part* part = createPartObject(parentWidget, parent, classname, args);
|
||||||
if ( part )
|
if (part) {
|
||||||
emit objectCreated(part);
|
emit objectCreated(part);
|
||||||
|
}
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,24 +56,25 @@ KComponentData Factory::partComponentData()
|
||||||
KComponentData Factory::partComponentDataFromLibrary(const QString &libraryName)
|
KComponentData Factory::partComponentDataFromLibrary(const QString &libraryName)
|
||||||
{
|
{
|
||||||
KPluginLoader loader(libraryName);
|
KPluginLoader loader(libraryName);
|
||||||
|
|
||||||
KPluginFactory *factory = loader.factory();
|
KPluginFactory *factory = loader.factory();
|
||||||
if ( !factory )
|
if (!factory) {
|
||||||
return KComponentData();
|
return KComponentData();
|
||||||
|
}
|
||||||
KParts::Factory *pfactory = qobject_cast<KParts::Factory*>(factory);
|
KParts::Factory *pfactory = qobject_cast<KParts::Factory*>(factory);
|
||||||
if ( !pfactory )
|
if (!pfactory) {
|
||||||
return KComponentData();
|
return KComponentData();
|
||||||
|
}
|
||||||
return pfactory->partComponentData();
|
return pfactory->partComponentData();
|
||||||
}
|
}
|
||||||
|
|
||||||
Part *Factory::createPartObject(QWidget *, QObject *, const char *, const QStringList &)
|
Part *Factory::createPartObject(QWidget *, QObject *, const char *, const QStringList &)
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *Factory::createObject(QObject *parent, const char *classname, const QStringList &args)
|
QObject *Factory::createObject(QObject *parent, const char *classname, const QStringList &args)
|
||||||
{
|
{
|
||||||
assert( !parent || parent->isWidgetType() );
|
Q_ASSERT(!parent || parent->isWidgetType());
|
||||||
return createPart(static_cast<QWidget*>(parent), parent, classname, args);
|
return createPart(static_cast<QWidget*>(parent), parent, classname, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class KPARTS_EXPORT Factory : public KPluginFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Factory( QObject *parent = 0 );
|
Factory(QObject *parent = nullptr);
|
||||||
virtual ~Factory();
|
virtual ~Factory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,8 @@ public:
|
||||||
* important for reference counting, and allows unloading the
|
* important for reference counting, and allows unloading the
|
||||||
* library automatically once all its objects have been destroyed.
|
* library automatically once all its objects have been destroyed.
|
||||||
*/
|
*/
|
||||||
Part *createPart( QWidget *parentWidget = 0, QObject *parent = 0, const char *classname = "KParts::Part", const QStringList &args = QStringList() );
|
Part* createPart(QWidget *parentWidget = nullptr, QObject *parent = nullptr,
|
||||||
|
const char *classname = "KParts::Part", const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you have a part contained in a shared library you might want to query
|
* If you have a part contained in a shared library you might want to query
|
||||||
|
@ -92,7 +93,6 @@ public:
|
||||||
static KComponentData partComponentDataFromLibrary(const QString &libraryName);
|
static KComponentData partComponentDataFromLibrary(const QString &libraryName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplement this method in your implementation to create the Part.
|
* Reimplement this method in your implementation to create the Part.
|
||||||
*
|
*
|
||||||
|
@ -115,19 +115,16 @@ protected:
|
||||||
*
|
*
|
||||||
* @returns the newly created part.
|
* @returns the newly created part.
|
||||||
*/
|
*/
|
||||||
virtual Part *createPartObject( QWidget *parentWidget = 0, QObject *parent = 0, const char *classname = "KParts::Part", const QStringList &args = QStringList() ) = 0;
|
virtual Part* createPartObject(QWidget *parentWidget = nullptr, QObject *parent = nullptr,
|
||||||
|
const char *classname = "KParts::Part", const QStringList &args = QStringList()) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplemented from KPluginFactory. Calls createPart()
|
* Reimplemented from KPluginFactory. Calls createPart()
|
||||||
*/
|
*/
|
||||||
virtual QObject *createObject( QObject *parent = 0, const char *classname = "QObject", const QStringList &args = QStringList() );
|
virtual QObject* createObject(QObject *parent = nullptr,
|
||||||
|
const char *classname = "QObject", const QStringList &args = QStringList());
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* vim: et sw=4
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,12 +42,9 @@ class MainWindowPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MainWindowPrivate()
|
MainWindowPrivate()
|
||||||
: m_activePart(0),
|
: m_activePart(nullptr),
|
||||||
m_bShellGUIActivated(false),
|
m_bShellGUIActivated(false),
|
||||||
m_helpMenu(0)
|
m_helpMenu(nullptr)
|
||||||
{
|
|
||||||
}
|
|
||||||
~MainWindowPrivate()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +55,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags f)
|
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags f)
|
||||||
: KXmlGuiWindow( parent, f ), d(new MainWindowPrivate())
|
: KXmlGuiWindow(parent, f),
|
||||||
|
d(new MainWindowPrivate())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,13 @@ class KPARTS_EXPORT MainWindow : public KXmlGuiWindow, virtual public PartBase
|
||||||
/**
|
/**
|
||||||
* Constructor, same signature as KMainWindow.
|
* Constructor, same signature as KMainWindow.
|
||||||
*/
|
*/
|
||||||
explicit MainWindow( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
explicit MainWindow(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the GUI (by merging the host's and the active part's)
|
* Create the GUI (by merging the host's and the active part's)
|
||||||
* You _must_ call this in order to see any GUI being created.
|
* You _must_ call this in order to see any GUI being created.
|
||||||
|
|
Loading…
Add table
Reference in a new issue