diff --git a/abstractrunner.cpp b/abstractrunner.cpp index ac28cb679..12de71b02 100644 --- a/abstractrunner.cpp +++ b/abstractrunner.cpp @@ -142,7 +142,9 @@ void AbstractRunner::performMatch(Plasma::RunnerContext &localContext) if (!slowed && runtime > reasonableRunTime) { // we punish runners that return too slowly, even if they don't bring // back matches +#ifndef NDEBUG kDebug() << id() << "runner is too slow, putting it on the back burner."; +#endif d->fastRuns = 0; setSpeed(SlowSpeed); } @@ -153,7 +155,9 @@ void AbstractRunner::performMatch(Plasma::RunnerContext &localContext) if (d->fastRuns > 2) { // we reward slowed runners who bring back matches fast enough // 3 times in a row +#ifndef NDEBUG kDebug() << id() << "runner is faster than we thought, kicking it up a notch"; +#endif setSpeed(NormalSpeed); } } @@ -389,7 +393,9 @@ void AbstractRunnerPrivate::init(const KService::Ptr service) const QString path = KStandardDirs::locate("data", "plasma/runners/" + runnerDescription.pluginName() + '/'); prepScripting(path, api); if (!script) { +#ifndef NDEBUG kDebug() << "Could not create a(n)" << api << "ScriptEngine for the" << runnerDescription.name() << "Runner."; +#endif } } } @@ -419,7 +425,9 @@ void AbstractRunnerPrivate::prepScripting(const QString &path, const QString &ap package->setPath(path); if (!package->isValid()) { +#ifndef NDEBUG kDebug() << "Invalid Runner package at" << path; +#endif return; } @@ -438,8 +446,10 @@ void AbstractRunnerPrivate::setupScriptSupport() return; } +#ifndef NDEBUG kDebug() << "setting up script support, package is in" << package->path() << ", main script is" << package->filePath("mainscript"); +#endif const QString translationsPath = package->filePath("translations"); if (!translationsPath.isEmpty()) { diff --git a/animations/animationscriptengine.cpp b/animations/animationscriptengine.cpp index 08a175b3c..6896661a9 100644 --- a/animations/animationscriptengine.cpp +++ b/animations/animationscriptengine.cpp @@ -178,7 +178,9 @@ QScriptEngine *globalEngine() global.setProperty("AnimationGroup", inst->newFunction(AnimationScriptEngine::animationGroup)); global.setProperty("ParallelAnimationGroup", inst->newFunction(AnimationScriptEngine::parallelAnimationGroup)); global.setProperty("QEasingCurve", constructEasingCurveClass(inst)); +#ifndef NDEBUG kDebug() << "........... first js animation, creating the engine!"; +#endif } return inst; diff --git a/animations/javascriptanimation.cpp b/animations/javascriptanimation.cpp index 01cefdf98..d472b062e 100644 --- a/animations/javascriptanimation.cpp +++ b/animations/javascriptanimation.cpp @@ -76,7 +76,9 @@ void JavascriptAnimation::updateState(QAbstractAnimation::State newState, QAbstr if (!m_method.isFunction()) { //Define the class and create an instance m_instance = AnimationScriptEngine::animation(m_name).construct(); +#ifndef NDEBUG kDebug() << "trying for" << m_name << m_instance.isFunction(); +#endif //Get the method of the object m_method = m_instance.property(QString("updateCurrentTime")); @@ -101,7 +103,9 @@ void JavascriptAnimation::updateState(QAbstractAnimation::State newState, QAbstr #ifdef PLASMA_JSANIM_FPS m_fps = 0; } else if (oldState == Running && newState == Stopped) { +#ifndef NDEBUG kDebug() << ".........." << m_name << " fps: " << m_fps * 1000/duration(); +#endif #endif } } diff --git a/animator.cpp b/animator.cpp index 54ee29bca..213dd55b3 100644 --- a/animator.cpp +++ b/animator.cpp @@ -180,7 +180,9 @@ QEasingCurve Animator::create(Animator::CurveShape type) break; default: +#ifndef NDEBUG kDebug() << "Unsupported easing curve type."; +#endif break; } diff --git a/applet.cpp b/applet.cpp index d97f90749..b12e63d35 100644 --- a/applet.cpp +++ b/applet.cpp @@ -318,8 +318,12 @@ void Applet::restore(KConfigGroup &group) if (!shortcutText.isEmpty()) { setGlobalShortcut(KShortcut(shortcutText)); /* +#ifndef NDEBUG kDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); +#endif +#ifndef NDEBUG kDebug() << "set to" << d->activationAction->objectName() +#endif << d->activationAction->globalShortcut().primary(); */ } @@ -1645,7 +1649,9 @@ void Applet::publish(AnnouncementMethods methods, const QString &resourceName) const QString resName = resourceName.isEmpty() ? i18nc("%1 is the name of a plasmoid, %2 the name of the machine that plasmoid is published on", "%1 on %2", name(), QHostInfo::localHostName()) : resourceName; +#ifndef NDEBUG kDebug() << "publishing package under name " << resName; +#endif if (d->package && d->package->isValid()) { d->service->d->publish(methods, resName, d->package->metadata()); } else if (!d->package && d->appletDescription.isValid()) { @@ -1653,7 +1659,9 @@ void Applet::publish(AnnouncementMethods methods, const QString &resourceName) } else { delete d->service; d->service = 0; +#ifndef NDEBUG kDebug() << "Can not publish invalid applets."; +#endif } } @@ -2228,7 +2236,9 @@ KPluginInfo::List Applet::listAppletInfoForUrl(const QUrl &url) QRegExp rx(glob); rx.setPatternSyntax(QRegExp::Wildcard); if (rx.exactMatch(url.toString())) { +#ifndef NDEBUG kDebug() << info.name() << "matches" << glob << url; +#endif filtered << info; } } @@ -2262,8 +2272,10 @@ QStringList Applet::listCategories(const QString &parentApp, bool visibleOnly) //kDebug() << " and we have " << appletCategory; if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) { +#ifndef NDEBUG kDebug() << "Unknown category: " << applet->name() << "says it is in the" << appletCategory << "category which is unknown to us"; +#endif appletCategory.clear(); } @@ -2613,9 +2625,11 @@ void AppletPrivate::init(const QString &packagePath) QObject::connect(q, SIGNAL(activate()), q, SLOT(setFocus())); if (!appletDescription.isValid()) { +#ifndef NDEBUG kDebug() << "Check your constructor! " << "You probably want to be passing in a Service::Ptr " << "or a QVariantList with a valid storageid as arg[0]."; +#endif q->resize(size); return; } @@ -2698,8 +2712,10 @@ void AppletPrivate::setupScriptSupport() return; } +#ifndef NDEBUG kDebug() << "setting up script support, package is in" << package->path() << ", main script is" << package->filePath("mainscript"); +#endif const QString translationsPath = package->filePath("translations"); if (!translationsPath.isEmpty()) { @@ -2819,7 +2835,9 @@ KConfigGroup *AppletPrivate::mainConfigGroup() //see if we have a default configuration in our package const QString defaultConfigFile = package->filePath("defaultconfig"); if (!defaultConfigFile.isEmpty()) { +#ifndef NDEBUG kDebug() << "copying default config: " << package->filePath("defaultconfig"); +#endif KConfigGroup defaultConfig(KSharedConfig::openConfig(defaultConfigFile)->group("Configuration")); defaultConfig.copyTo(mainConfig); } diff --git a/containment.cpp b/containment.cpp index e344c6f85..262877cf9 100644 --- a/containment.cpp +++ b/containment.cpp @@ -295,11 +295,15 @@ bool appletConfigLessThan(const KConfigGroup &c1, const KConfigGroup &c2) void Containment::restore(KConfigGroup &group) { - /*kDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type; + /* +#ifndef NDEBUG + kDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type; kDebug() << " location:" << group.readEntry("location", (int)d->location); kDebug() << " geom:" << group.readEntry("geometry", geometry()); kDebug() << " formfactor:" << group.readEntry("formfactor", (int)d->formFactor); - kDebug() << " screen:" << group.readEntry("screen", d->screen);*/ + kDebug() << " screen:" << group.readEntry("screen", d->screen); +#endif +*/ if (!isContainment()) { Applet::restore(group); return; @@ -392,7 +396,9 @@ void Containment::restore(KConfigGroup &group) } /* +#ifndef NDEBUG kDebug() << "Containment" << id() << +#endif "screen" << screen() << "geometry is" << geometry() << "wallpaper" << ((d->wallpaper) ? d->wallpaper->pluginName() : QString()) << @@ -460,7 +466,9 @@ void ContainmentPrivate::initApplets() foreach (Applet *applet, applets) { applet->restore(*applet->d->mainConfigGroup()); applet->init(); +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Applet" << applet->name(); +#endif } q->flushPendingConstraintsEvents(); @@ -469,7 +477,9 @@ void ContainmentPrivate::initApplets() applet->flushPendingConstraintsEvents(); } +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment's applets initialized" << q->name(); +#endif } void Containment::restoreContents(KConfigGroup &group) @@ -857,12 +867,16 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit) } if (!applet) { +#ifndef NDEBUG kDebug() << "adding null applet!?!"; +#endif return; } if (d->applets.contains(applet)) { +#ifndef NDEBUG kDebug() << "already have this applet!"; +#endif } Containment *currentContainment = applet->containment(); @@ -1000,10 +1014,12 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn // sanity check to make sure someone else doesn't have this screen already! Containment *currently = corona->containmentForScreen(newScreen, newDesktop); if (currently && currently != q) { +#ifndef NDEBUG kDebug() << "currently is on screen" << currently->screen() << "desktop" << currently->desktop() << "and is" << currently->activity() << (QObject*)currently << "i'm" << (QObject*)q; +#endif currently->setScreen(-1, currently->desktop()); swapScreensWith = currently; } @@ -1025,7 +1041,9 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn if (oldScreen != newScreen || oldDesktop != newDesktop) { /* +#ifndef NDEBUG kDebug() << "going to signal change for" << q +#endif << ", old screen & desktop:" << oldScreen << oldDesktop << ", new:" << screen << desktop; */ @@ -1251,7 +1269,9 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS if (!mimeData) { //Selection is either empty or not supported on this OS +#ifndef NDEBUG kDebug() << "no mime data"; +#endif return; } @@ -1271,13 +1291,17 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS dropEvent->acceptProposedAction(); } } else if (mimeData->hasFormat(ExtenderItemMimeData::mimeType())) { +#ifndef NDEBUG kDebug() << "mimeType plasma/extenderitem is dropped, creating internal:extender"; +#endif //Handle dropping extenderitems. const ExtenderItemMimeData *extenderData = qobject_cast(mimeData); if (extenderData) { ExtenderItem *item = extenderData->extenderItem(); QRectF geometry(pos - extenderData->pointerOffset(), item->size()); +#ifndef NDEBUG kDebug() << "desired geometry: " << geometry; +#endif Applet *applet = qobject_cast(item->extender() ? item->extender()->applet() : 0); if (applet) { qreal left, top, right, bottom; @@ -1318,7 +1342,9 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS QRectF geom(pos, QSize()); QVariantList args; args << url.url(); +#ifndef NDEBUG kDebug() << "can decode" << mimeName << args; +#endif // It may be a directory or a file, let's stat KIO::JobFlags flags = KIO::HideProgressInfo; @@ -1418,7 +1444,9 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS QRectF geom(pos, QSize()); QVariantList args; args << tempFile.fileName(); +#ifndef NDEBUG kDebug() << args; +#endif tempFile.close(); q->addApplet(selectedPlugin, args, geom); @@ -1443,12 +1471,16 @@ void ContainmentPrivate::remoteAppletReady(Plasma::AccessAppletJob *job) QPointF pos = dropPoints.take(job); if (job->error()) { //TODO: nice user visible error handling (knotification probably?) +#ifndef NDEBUG kDebug() << "remote applet access failed: " << job->errorText(); +#endif return; } if (!job->applet()) { +#ifndef NDEBUG kDebug() << "how did we end up here? if applet is null, the job->error should be nonzero"; +#endif return; } @@ -1460,12 +1492,16 @@ void ContainmentPrivate::dropJobResult(KJob *job) #ifndef PLASMA_NO_KIO KIO::TransferJob* tjob = dynamic_cast(job); if (!tjob) { +#ifndef NDEBUG kDebug() << "job is not a KIO::TransferJob, won't handle the drop..."; +#endif clearDataForMimeJob(tjob); return; } if (job->error()) { +#ifndef NDEBUG kDebug() << "ERROR" << tjob->error() << ' ' << tjob->errorString(); +#endif } // We call mimeTypeRetrieved since there might be other mechanisms // for finding suitable applets. Cleanup happens there as well. @@ -1476,33 +1512,45 @@ void ContainmentPrivate::dropJobResult(KJob *job) void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimeType) { #ifndef PLASMA_NO_KIO +#ifndef NDEBUG kDebug() << "Mimetype Job returns." << mimeType; +#endif KIO::TransferJob* tjob = dynamic_cast(job); if (!tjob) { +#ifndef NDEBUG kDebug() << "job should be a TransferJob, but isn't"; +#endif clearDataForMimeJob(job); return; } KPluginInfo::List appletList = Applet::listAppletInfoForUrl(tjob->url()); if (mimeType.isEmpty() && !appletList.count()) { clearDataForMimeJob(job); +#ifndef NDEBUG kDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimeType (" << mimeType << ")"; +#endif return; } else { QPointF posi; // will be overwritten with the event's position if (dropPoints.keys().contains(tjob)) { posi = dropPoints[tjob]; +#ifndef NDEBUG kDebug() << "Received a suitable dropEvent at" << posi; +#endif } else { +#ifndef NDEBUG kDebug() << "Bailing out. Cannot find associated dropEvent related to the TransferJob"; +#endif clearDataForMimeJob(job); return; } KMenu *choices = dropMenus.value(tjob); if (!choices) { +#ifndef NDEBUG kDebug() << "Bailing out. No QMenu found for this job."; +#endif clearDataForMimeJob(job); return; } @@ -1510,7 +1558,9 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimeTyp QVariantList args; args << tjob->url().url() << mimeType; +#ifndef NDEBUG kDebug() << "Creating menu for:" << mimeType << posi << args; +#endif appletList << Applet::listAppletInfoForMimeType(mimeType); KPluginInfo::List wallpaperList; @@ -1527,7 +1577,9 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimeTyp QHash actionsToApplets; choices->addTitle(i18n("Widgets")); foreach (const KPluginInfo &info, appletList) { +#ifndef NDEBUG kDebug() << info.name(); +#endif QAction *action; if (!info.icon().isEmpty()) { action = choices->addAction(KIcon(info.icon()), info.name()); @@ -1536,7 +1588,9 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimeTyp } actionsToApplets.insert(action, info.pluginName()); +#ifndef NDEBUG kDebug() << info.pluginName(); +#endif } actionsToApplets.insert(choices->addAction(i18n("Icon")), "icon"); @@ -1636,7 +1690,9 @@ void Containment::keyPressEvent(QKeyEvent *event) // << "and hoping and wishing for a" << Qt::Key_Tab; if (event->key() == Qt::Key_Tab) { // && event->modifiers() == 0) { if (!d->applets.isEmpty()) { +#ifndef NDEBUG kDebug() << "let's give focus to...." << (QObject*)d->applets.first(); +#endif d->applets.first()->setFocus(Qt::TabFocusReason); } } @@ -1983,7 +2039,9 @@ void Containment::focusNextApplet() if (index >= d->applets.size()) { index = 0; } +#ifndef NDEBUG kDebug() << "index" << index; +#endif d->focusApplet(d->applets.at(index)); } @@ -1996,7 +2054,9 @@ void Containment::focusPreviousApplet() if (index < 0) { index = d->applets.size() - 1; } +#ifndef NDEBUG kDebug() << "index" << index; +#endif d->focusApplet(d->applets.at(index)); } @@ -2156,7 +2216,9 @@ Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &a } if (!delayInit && q->immutability() != Mutable) { +#ifndef NDEBUG kDebug() << "addApplet for" << name << "requested, but we're currently immutable!"; +#endif return 0; } @@ -2171,7 +2233,9 @@ Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &a } if (!applet) { +#ifndef NDEBUG kDebug() << "Applet" << name << "could not be loaded."; +#endif applet = new Applet(0, QString(), id); applet->setFailedToLaunch(true, i18n("Could not find requested component: %1", name)); } @@ -2225,7 +2289,9 @@ void ContainmentPrivate::appletAppeared(Applet *applet) void ContainmentPrivate::positionPanel(bool force) { if (!q->scene()) { +#ifndef NDEBUG kDebug() << "no scene yet"; +#endif return; } @@ -2322,12 +2388,16 @@ QPointF ContainmentPrivate::preferredPanelPos(Corona *corona) const if (horiz) { bottom -= lastHeight + INTER_CONTAINMENT_MARGIN; //TODO: fix x position for non-flush-left panels +#ifndef NDEBUG kDebug() << "moved to" << QPointF(0, bottom - q->size().height()); +#endif newPos = QPointF(0, bottom - q->size().height()); } else { bottom += lastHeight + INTER_CONTAINMENT_MARGIN; //TODO: fix y position for non-flush-top panels +#ifndef NDEBUG kDebug() << "moved to" << QPointF(bottom + q->size().width(), -INTER_CONTAINMENT_MARGIN - q->size().height()); +#endif newPos = QPointF(bottom + q->size().width(), -INTER_CONTAINMENT_MARGIN - q->size().height()); } diff --git a/corona.cpp b/corona.cpp index 85a0bd5fd..9163a0f93 100644 --- a/corona.cpp +++ b/corona.cpp @@ -64,7 +64,9 @@ Corona::Corona(QObject *parent) : QGraphicsScene(parent), d(new CoronaPrivate(this)) { +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start"; +#endif d->init(); ToolTipManager::self()->m_corona = this; //setViewport(new QGLWidget(QGLFormat(QGL::StencilBuffer | QGL::AlphaChannel))); @@ -368,7 +370,9 @@ void Corona::addOffscreenWidget(QGraphicsWidget *widget) { foreach (QGraphicsWidget *w, d->offscreenWidgets) { if (w == widget) { +#ifndef NDEBUG kDebug() << "widget is already an offscreen widget!"; +#endif return; } } @@ -475,7 +479,9 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig } } +#ifndef NDEBUG kDebug() << actualItem; +#endif if (actualItem) { v = viewFor(actualItem); @@ -638,7 +644,9 @@ void Corona::setImmutability(const ImmutabilityType immutable) return; } +#ifndef NDEBUG kDebug() << "setting immutability to" << immutable; +#endif d->immutability = immutable; d->updateContainmentImmutability(); //tell non-containments that might care (like plasmaapp or a custom corona) @@ -917,7 +925,9 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi if (!containment) { if (!loadingNull) { +#ifndef NDEBUG kDebug() << "loading of containment" << name << "failed."; +#endif } // in case we got a non-Containment from Applet::loadApplet or @@ -1020,7 +1030,9 @@ QList CoronaPrivate::importLayout(const KConfigGroup &con } //kDebug() << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group; +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin", QString()); +#endif Containment *c = addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(), cid, true); if (!c) { continue; @@ -1030,16 +1042,22 @@ QList CoronaPrivate::importLayout(const KConfigGroup &con containmentsIds.insert(c->id()); c->init(); +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Init Containment" << c->pluginName(); +#endif c->restore(containmentConfig); +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Restored Containment" << c->pluginName(); +#endif } foreach (Containment *containment, newContainments) { containment->updateConstraints(Plasma::StartupCompletedConstraint); containment->d->initApplets(); emit q->containmentAdded(containment); +#ifndef NDEBUG kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment" << containment->name(); +#endif } return newContainments; diff --git a/dataengine.cpp b/dataengine.cpp index 641dca4ce..7f9082328 100644 --- a/dataengine.cpp +++ b/dataengine.cpp @@ -249,7 +249,9 @@ void DataEngine::removeData(const QString &source, const QString &key) void DataEngine::addSource(DataContainer *source) { if (d->sources.contains(source->objectName())) { +#ifndef NDEBUG kDebug() << "source named \"" << source->objectName() << "\" already exists."; +#endif return; } @@ -452,7 +454,9 @@ void DataEnginePrivate::publish(AnnouncementMethods methods, const QString &name //i18nc("%1 is the name of a dataengine, %2 the name of the machine that engine is published //on", //"%1 dataengine on %2", name(), AuthorizationManager::self()->d->myCredentials.name()); +#ifndef NDEBUG kDebug() << "name: " << name; +#endif publishedService->d->publish(methods, name); } @@ -550,8 +554,10 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info) } if (!script) { +#ifndef NDEBUG kDebug() << "Could not create a" << api << "ScriptEngine for the" << dataEngineDescription.name() << "DataEngine."; +#endif delete package; package = 0; } @@ -584,7 +590,9 @@ void DataEnginePrivate::internalUpdateSource(DataContainer *source) //kDebug() << "queuing an update"; q->scheduleSourcesUpdated(); }/* else { +#ifndef NDEBUG kDebug() << "no update"; +#endif }*/ } @@ -740,7 +748,9 @@ void DataEnginePrivate::setupScriptSupport() } /* +#ifndef NDEBUG kDebug() << "sletting up script support, package is in" << package->path() +#endif << "which is a" << package->structure()->type() << "package" << ", main script is" << package->filePath("mainscript"); */ diff --git a/dialog.cpp b/dialog.cpp index ca4dbb056..14c7bebea 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -298,7 +298,9 @@ void Dialog::syncToGraphicsWidget() d->resizeStartCorner = -1; QSize prevSize = size(); /* +#ifndef NDEBUG kDebug() << "Widget size:" << graphicsWidget->size() +#endif << "| Widget size hint:" << graphicsWidget->effectiveSizeHint(Qt::PreferredSize) << "| Widget minsize hint:" << graphicsWidget->minimumSize() << "| Widget maxsize hint:" << graphicsWidget->maximumSize() diff --git a/extenders/extender.cpp b/extenders/extender.cpp index 1ae51ca5c..449f8f635 100644 --- a/extenders/extender.cpp +++ b/extenders/extender.cpp @@ -447,13 +447,17 @@ void Extender::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) //targetting. PopupApplet *popupApplet = qobject_cast(d->applet.data()); if (popupApplet && sourceExtender != this) { +#ifndef NDEBUG kDebug() << "leaving another extender then the extender we started, so hide the popup."; +#endif popupApplet->showPopup(250); } //Hide popups when we drag the last item away. if (popupApplet && sourceExtender == this && (attachedItems().count() < 2)) { +#ifndef NDEBUG kDebug() << "leaving the extender, and there are no more attached items so hide the popup."; +#endif popupApplet->hidePopup(); } @@ -463,7 +467,9 @@ void Extender::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) if (extenderApplet && sourceExtender == this && attachedItems().count() < 2 && extenderApplet->formFactor() != Plasma::Horizontal && extenderApplet->formFactor() != Plasma::Vertical) { +#ifndef NDEBUG kDebug() << "leaving the internal extender container, so hide the applet and it's handle."; +#endif extenderApplet->hide(); AppletHandle *handle = dynamic_cast(extenderApplet->parentItem()); if (handle) { @@ -508,9 +514,13 @@ void Extender::itemAddedEvent(ExtenderItem *item, const QPointF &pos) d->layout->addItem(item); } } else { +#ifndef NDEBUG kDebug() << "inserting at" << pos << d->insertIndexFromPos(pos) << item->size(); +#endif d->layout->insertItem(d->insertIndexFromPos(pos), item); +#ifndef NDEBUG kDebug() << item->size(); +#endif } } @@ -745,8 +755,12 @@ void ExtenderPrivate::loadExtenderItems() bool temporarySourceApplet = false; +#ifndef NDEBUG kDebug() << "applet id = " << applet.data()->id(); +#endif +#ifndef NDEBUG kDebug() << "sourceappletid = " << sourceAppletId; +#endif //find the source applet. Applet *sourceApplet = 0; @@ -777,7 +791,9 @@ void ExtenderPrivate::loadExtenderItems() //There is no source applet. We just instantiate one just for the sake of creating //detachables. if (!sourceApplet) { +#ifndef NDEBUG kDebug() << "creating a temporary applet as factory"; +#endif sourceApplet = PluginLoader::self()->loadApplet(appletName); temporarySourceApplet = true; //TODO: maybe add an option to applet to indicate that it shouldn't be deleted after @@ -785,8 +801,12 @@ void ExtenderPrivate::loadExtenderItems() } if (!sourceApplet) { +#ifndef NDEBUG kDebug() << "sourceApplet is null? appletName = " << appletName; +#endif +#ifndef NDEBUG kDebug() << " extenderItemId = " << extenderItemId; +#endif } else { ExtenderItem *item; if (dg.readEntry("isGroup", false)) { diff --git a/extenders/extenderitem.cpp b/extenders/extenderitem.cpp index 8a32a21a2..89f7e0ed6 100644 --- a/extenders/extenderitem.cpp +++ b/extenders/extenderitem.cpp @@ -406,7 +406,9 @@ void ExtenderItem::setExtender(Extender *extender, const QPointF &pos) KConfigGroup extenderItemGroup(corona->config(), "DetachedExtenderItems"); if (isDetached()) { +#ifndef NDEBUG kDebug() << "detached, adding entry to the global group"; +#endif KConfigGroup itemConfig = extenderItemGroup.group(QString::number(d->extenderItemId)); itemConfig.writeEntry("sourceAppletPluginName", config().readEntry("sourceAppletPluginName", "")); @@ -415,7 +417,9 @@ void ExtenderItem::setExtender(Extender *extender, const QPointF &pos) itemConfig.writeEntry("extenderItemName", config().readEntry("extenderItemName", "")); } else if (extenderItemGroup.hasGroup(QString::number(d->extenderItemId))) { +#ifndef NDEBUG kDebug() << "no longer detached, removing entry from the global group"; +#endif extenderItemGroup.deleteGroup(QString::number(d->extenderItemId)); } @@ -454,7 +458,9 @@ void ExtenderItem::setGroup(ExtenderGroup *group, const QPointF &pos) config().writeEntry("group", group->name()); //TODO: move to another extender if the group we set is actually detached. if (group->extender() != extender()) { +#ifndef NDEBUG kDebug() << "moving to another extender because we're joining a detached group."; +#endif setExtender(group->extender()); } group->d->addItemToGroup(this, pos); @@ -724,7 +730,9 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (extenderApplet && d->extender->attachedItems().count() < 2 && extenderApplet->formFactor() != Plasma::Horizontal && extenderApplet->formFactor() != Plasma::Vertical) { +#ifndef NDEBUG kDebug() << "leaving the internal extender container, so hide the applet and it's handle."; +#endif extenderApplet->hide(); } @@ -1002,7 +1010,9 @@ Applet *ExtenderItemPrivate::hostApplet() const void ExtenderItemPrivate::themeChanged() { +#ifndef NDEBUG kDebug(); +#endif if (dragStarted) { background->setImagePath("opaque/dialogs/background"); background->setEnabledBorders(FrameSvg::AllBorders); diff --git a/framesvg.cpp b/framesvg.cpp index bac787942..d25dfef1b 100644 --- a/framesvg.cpp +++ b/framesvg.cpp @@ -321,7 +321,9 @@ void FrameSvg::resizeFrame(const QSizeF &size) } if (size.isEmpty()) { +#ifndef NDEBUG kDebug() << "Invalid size" << size; +#endif return; } @@ -539,7 +541,9 @@ void FrameSvg::paintFrame(QPainter *painter, const QPointF &pos) FrameSvgPrivate::~FrameSvgPrivate() { #ifdef DEBUG_FRAMESVG_CACHE +#ifndef NDEBUG kDebug() << "*************" << q << q->imagePath() << "****************"; +#endif #endif QHashIterator it(frames); @@ -551,17 +555,23 @@ FrameSvgPrivate::~FrameSvgPrivate() if (it.value()->removeRefs(q)) { const QString key = cacheId(it.value(), it.key()); #ifdef DEBUG_FRAMESVG_CACHE +#ifndef NDEBUG kDebug() << "2. Removing it" << key << it.value() << it.value()->refcount() << s_sharedFrames.contains(key); +#endif #endif s_sharedFrames.remove(key); delete it.value(); } #ifdef DEBUG_FRAMESVG_CACHE else { +#ifndef NDEBUG kDebug() << "still shared:" << cacheId(it.value(), it.key()) << it.value() << it.value()->refcount() << it.value()->isUsed(); +#endif } } else { +#ifndef NDEBUG kDebug() << "lost our value for" << it.key(); +#endif #endif } } @@ -573,16 +583,24 @@ FrameSvgPrivate::~FrameSvgPrivate() it2.next(); const int rc = it2.value()->refcount(); if (rc == 0) { +#ifndef NDEBUG kDebug() << " LOST!" << it2.key() << rc << it2.value();// << it2.value()->references; +#endif } else { +#ifndef NDEBUG kDebug() << " " << it2.key() << rc << it2.value(); +#endif foreach (FrameSvg *data, it2.value()->references.keys()) { +#ifndef NDEBUG kDebug( )<< " " << (void*)data << it2.value()->references[data]; +#endif } shares += rc - 1; } } +#ifndef NDEBUG kDebug() << "#####################################" << s_sharedFrames.count() << ", pixmaps saved:" << shares; +#endif #endif frames.clear(); @@ -746,7 +764,9 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame) if (!size.isValid()) { +#ifndef NDEBUG kDebug() << "Invalid frame size" << size; +#endif return; } if (size.width() >= MAX_FRAME_SIZE || size.height() >= MAX_FRAME_SIZE) { diff --git a/package.cpp b/package.cpp index 4b75d606f..d6a66ccea 100644 --- a/package.cpp +++ b/package.cpp @@ -489,7 +489,9 @@ void Package::setPath(const QString &path) } //kDebug() << "basePath is" << basePath; } else { +#ifndef NDEBUG kDebug() << path << "invalid, basePath is" << basePath; +#endif return; } @@ -903,7 +905,9 @@ bool PackagePrivate::uninstallPackage(const QString &packageName, const QString const QString serviceName = servicePrefix + packageName + ".desktop"; QString service = KStandardDirs::locateLocal("services", serviceName); +#ifndef NDEBUG kDebug() << "Removing service file " << service; +#endif bool ok = QFile::remove(service); if (!ok) { diff --git a/pluginloader.cpp b/pluginloader.cpp index 21ffa2c4e..ce08999af 100644 --- a/pluginloader.cpp +++ b/pluginloader.cpp @@ -74,7 +74,9 @@ void PluginLoader::setPluginLoader(PluginLoader* loader) if (!s_pluginLoader) { s_pluginLoader = loader; } else { +#ifndef NDEBUG kDebug() << "Cannot set pluginLoader, already set!" << s_pluginLoader; +#endif } } @@ -117,12 +119,16 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari } /* if (offers.count() > 1) { +#ifndef NDEBUG kDebug() << "hey! we got more than one! let's blindly take the first one"; +#endif } */ AppletPrivate::filterOffers(offers); if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "offers is empty for " << name; +#endif return 0; } @@ -136,8 +142,10 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari allArgs << offer->storageId() << appletId << args; if (!offer->property("X-Plasma-API").toString().isEmpty()) { +#ifndef NDEBUG kDebug() << "we have a script using the" << offer->property("X-Plasma-API").toString() << "API"; +#endif if (isContainment) { return new Containment(0, allArgs); } else { @@ -167,7 +175,9 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari } if (!applet) { +#ifndef NDEBUG kDebug() << "Couldn't load applet \"" << name << "\"! reason given: " << error; +#endif } return applet; @@ -187,7 +197,9 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name) QString error; if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "offers are empty for " << name << " with constraint " << constraint; +#endif } else { QVariantList allArgs; allArgs << offers.first()->storageId(); @@ -205,7 +217,9 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name) } if (!engine) { +#ifndef NDEBUG kDebug() << "Couldn't load engine \"" << name << "\". Error given: " << error; +#endif } return engine; @@ -236,7 +250,9 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args KService::List offers = KServiceTypeTrader::self()->query("Plasma/Service", constraint); if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "offers is empty for " << name; +#endif return new NullService(name, parent); } @@ -248,7 +264,9 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args } if (!service) { +#ifndef NDEBUG kDebug() << "Couldn't load Service \"" << name << "\"! reason given: " << error; +#endif return new NullService(name, parent); } @@ -274,7 +292,9 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co KService::List offers = KServiceTypeTrader::self()->query("Plasma/ContainmentActions", constraint); if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "offers is empty for " << name; +#endif return 0; } @@ -291,7 +311,9 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co actions = offer->createInstance(parent, allArgs, &error); if (!actions) { +#ifndef NDEBUG kDebug() << "Couldn't load containmentActions \"" << name << "\"! reason given: " << error; +#endif } return actions; @@ -372,7 +394,9 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s return Package(structure); } +#ifndef NDEBUG kDebug() << "Couldn't load Package for" << packageFormat << "! reason given: " << error; +#endif } return Package(); diff --git a/private/dataengineconsumer.cpp b/private/dataengineconsumer.cpp index 6af441fb4..2de105fe7 100644 --- a/private/dataengineconsumer.cpp +++ b/private/dataengineconsumer.cpp @@ -43,33 +43,50 @@ ServiceMonitor::~ServiceMonitor() void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job) { +#ifndef NDEBUG kDebug() << "engine ready!"; +#endif QString engineName = job->parameters()["EngineName"].toString(); QString location = job->destination(); QPair pair(location, engineName); +#ifndef NDEBUG kDebug() << "pair = " << pair; +#endif if (!m_consumer->m_remoteEngines.contains(pair)) { +#ifndef NDEBUG kDebug() << "engine does not exist yet!"; +#endif } else { KUrl engineLocation(location); engineLocation.setFileName(job->result().toString()); - kDebug() << "setting location : " - << engineLocation.prettyUrl(); +#ifndef NDEBUG + kDebug() << "setting location : " << engineLocation.prettyUrl(); +#endif m_consumer->m_remoteEngines[pair]->setLocation(engineLocation); } } void ServiceMonitor::slotServiceReady(Plasma::Service *plasmoidService) { +#ifndef NDEBUG kDebug() << "service ready!"; +#endif if (!m_consumer->m_engineNameForService.contains(plasmoidService)) { +#ifndef NDEBUG kDebug() << "no engine name for service!"; +#endif +#ifndef NDEBUG kDebug() << "amount of services in map: " << m_consumer->m_engineNameForService.count(); +#endif } else { +#ifndef NDEBUG kDebug() << "value = " << m_consumer->m_engineNameForService.value(plasmoidService); +#endif } +#ifndef NDEBUG kDebug() << "requesting dataengine!"; +#endif KConfigGroup op = plasmoidService->operationDescription("DataEngine"); op.writeEntry("EngineName", m_consumer->m_engineNameForService.value(plasmoidService)); plasmoidService->startOperationCall(op); @@ -113,19 +130,27 @@ DataEngine *DataEngineConsumer::dataEngine(const QString &name) DataEngine *DataEngineConsumer::remoteDataEngine(const KUrl &location, const QString &name) { QPair pair(location.prettyUrl(), name); +#ifndef NDEBUG kDebug() << "pair = " << pair; +#endif if (m_remoteEngines.contains(pair)) { +#ifndef NDEBUG kDebug() << "existing remote dataengine at " << location; +#endif return m_remoteEngines[pair]; } +#ifndef NDEBUG kDebug() << "new remote dataengine at " << location; +#endif RemoteDataEngine *engine = new RemoteDataEngine(KUrl()); m_remoteEngines[pair] = engine; Service *plasmoidService = Service::access(location); plasmoidService->setDestination(location.prettyUrl()); m_engineNameForService[plasmoidService] = name; +#ifndef NDEBUG kDebug() << "name = " << name; +#endif QObject::connect(plasmoidService, SIGNAL(serviceReady(Plasma::Service*)), m_monitor, SLOT(slotServiceReady(Plasma::Service*))); return engine; diff --git a/private/effects/ripple.cpp b/private/effects/ripple.cpp index 2f8526287..5005e4c7d 100644 --- a/private/effects/ripple.cpp +++ b/private/effects/ripple.cpp @@ -31,14 +31,18 @@ int **allocateWaveMap(const QSize &size) { int **waveMap = new int *[size.width()]; if (!waveMap) { +#ifndef NDEBUG kDebug() << "could not allocate wave map"; +#endif return 0; } for (int x = 0; x < size.width(); ++x) { waveMap[x] = new int[size.height()]; if (!waveMap[x]) { +#ifndef NDEBUG kDebug() << "could not allocate wave map"; +#endif return 0; } } diff --git a/private/getsource.cpp b/private/getsource.cpp index e09bd770b..9e28e7d3a 100644 --- a/private/getsource.cpp +++ b/private/getsource.cpp @@ -43,7 +43,9 @@ GetSource::GetSource(DataEngine *engine, const QString& operation, void GetSource::start() { +#ifndef NDEBUG kDebug() << "Trying to perform the action" << operationName(); +#endif //TODO: check with capabilities before performing actions. if (operationName() == "GetSource") { @@ -62,7 +64,9 @@ void GetSource::start() Service *service = m_engine->serviceForSource(source); QString serviceName = "plasma-service-" + service->name(); +#ifndef NDEBUG kDebug() << "serviceForSource: getting source " << serviceName; +#endif service->d->publish(Plasma::NoAnnouncement, serviceName); if (!AuthorizationManager::self()->d->matchingRule(serviceName, identity())) { AuthorizationRule *rule = new AuthorizationRule(serviceName, identity().id()); diff --git a/private/plasmoidservice.cpp b/private/plasmoidservice.cpp index 7db041fdc..cbc627a68 100644 --- a/private/plasmoidservice.cpp +++ b/private/plasmoidservice.cpp @@ -54,7 +54,9 @@ PlasmoidServiceJob::PlasmoidServiceJob(const QString &destination, void PlasmoidServiceJob::start() { if (operationName() == "GetPackage") { +#ifndef NDEBUG kDebug() << "sending " << m_service->m_packagePath; +#endif if (m_service->m_packagePath.isEmpty()) { // just return the plugin name in this case setResult(m_service->m_pluginName); @@ -62,7 +64,9 @@ void PlasmoidServiceJob::start() QFileInfo fileInfo(m_service->m_packagePath); if (fileInfo.exists() && fileInfo.isAbsolute()) { +#ifndef NDEBUG kDebug() << "file exists, let's try and read it"; +#endif QFile file(m_service->m_packagePath); file.open(QIODevice::ReadOnly); setResult(file.readAll()); @@ -117,10 +121,14 @@ PlasmoidService::PlasmoidService(Applet *applet) creation.close(); } else { +#ifndef NDEBUG kDebug() << "could not open archive"; +#endif } } else { +#ifndef NDEBUG kDebug() << "applet lacks a valid package"; +#endif const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(applet->pluginName()); KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint); if (!offers.isEmpty()) { diff --git a/private/remotedataengine.cpp b/private/remotedataengine.cpp index b40c2a6d5..ccdff0314 100644 --- a/private/remotedataengine.cpp +++ b/private/remotedataengine.cpp @@ -42,7 +42,9 @@ RemoteDataEngine::RemoteDataEngine(KUrl location, QObject* parent, const QVarian if (!location.isEmpty()) { setLocation(location); } else { +#ifndef NDEBUG kDebug() << "LOCATION IS EMPTY"; +#endif } } @@ -107,14 +109,18 @@ QStringList RemoteDataEngine::sources() const void RemoteDataEngine::remoteCallFinished(Plasma::ServiceJob *job) { if (job->operationName() == "GetSourceNames") { +#ifndef NDEBUG kDebug() << "get source names"; +#endif const QSet oldsources = m_sources; m_sources = QSet::fromList(job->result().toStringList()); //first check if there are sources that have to be removed: foreach (const QString &source, oldsources) { if (!m_sources.contains(source)) { +#ifndef NDEBUG kDebug() << "source no longer exists... remove that data."; +#endif removeSource(source); emit sourceRemoved(source); } @@ -131,7 +137,9 @@ void RemoteDataEngine::remoteCallFinished(Plasma::ServiceJob *job) const SourceDict s = containerDict(); foreach (const QString &source, m_sources) { if (!oldsources.contains(source) && !s.contains(source)) { +#ifndef NDEBUG kDebug() << "new source = " << source; +#endif emit sourceAdded(source); } } @@ -144,10 +152,14 @@ void RemoteDataEngine::remoteCallFinished(Plasma::ServiceJob *job) m_pendingSources.clear(); } else if (job->operationName() == "GetSource") { QString source = job->parameters().value("SourceName").toString(); +#ifndef NDEBUG kDebug() << "setting data for " << source; +#endif bool newSource = !m_sources.contains(source); if (job->result().type() == QVariant::Bool && job->result().toBool() == false) { +#ifndef NDEBUG kDebug() << "there is no update"; +#endif if (newSource) { // the source doesn't exist on the remote side! removeSource(source); @@ -170,7 +182,9 @@ void RemoteDataEngine::remoteCallFinished(Plasma::ServiceJob *job) } } else { QString source = job->parameters().value("SourceName").toString(); +#ifndef NDEBUG kDebug() << "setting serviceForSource for " << source; +#endif QString resource = job->result().toString(); KUrl loc = m_location; loc.setFileName(resource); @@ -178,7 +192,9 @@ void RemoteDataEngine::remoteCallFinished(Plasma::ServiceJob *job) if (rs) { rs->setLocation(loc); } else { +#ifndef NDEBUG kDebug() << "no such service?" << source; +#endif } } } diff --git a/private/remoteservice.cpp b/private/remoteservice.cpp index 92c5c354e..c70389d2e 100644 --- a/private/remoteservice.cpp +++ b/private/remoteservice.cpp @@ -77,18 +77,24 @@ RemoteService::~RemoteService() void RemoteService::slotReadyForRemoteAccess() { +#ifndef NDEBUG kDebug() << "AuthorizationManager is now ready for remote access!"; +#endif setLocation(m_location); } void RemoteService::setLocation(const KUrl &location) { +#ifndef NDEBUG kDebug() << "Setting RemoteService location to " << location.prettyUrl(); +#endif m_uuid = QUuid::createUuid().toString(); Credentials identity = AuthorizationManager::self()->d->myCredentials; if (!identity.canSign()) { +#ifndef NDEBUG kDebug() << "we can't sign? how did we get here?"; +#endif return; } @@ -141,7 +147,9 @@ void RemoteService::callCompleted(Jolie::PendingCallWatcher *watcher) Jolie::Message response = reply.reply(); if (response.operationName() == "startConnection") { +#ifndef NDEBUG kDebug() << "Started connection: fetching .operations"; +#endif m_token = JolieMessage::field(JolieMessage::Field::TOKEN, response); Jolie::Message getOpDesc(m_location.path(KUrl::RemoveTrailingSlash).remove(0, 1).toUtf8(), "getOperations"); @@ -152,13 +160,17 @@ void RemoteService::callCompleted(Jolie::PendingCallWatcher *watcher) this, SLOT(callCompleted(Jolie::PendingCallWatcher*))); } else if (response.operationName() == "getOperations") { if (response.fault().name() == JolieMessage::Error::REQUIREPIN) { +#ifndef NDEBUG kDebug() << "pin required, request auth interface"; +#endif ClientPinRequest *request = new ClientPinRequest(this); connect(request, SIGNAL(changed(Plasma::ClientPinRequest*)), this, SLOT(slotGotPin(Plasma::ClientPinRequest*))); AuthorizationManager::self()->d->authorizationInterface->clientPinRequest(*request); } else { +#ifndef NDEBUG kDebug() << "RemoteService is now ready for use!"; +#endif m_operationsScheme = JolieMessage::field(JolieMessage::Field::OPERATIONSDESCRIPTION, response); m_token = JolieMessage::field(JolieMessage::Field::TOKEN, response); m_ready = true; @@ -176,10 +188,14 @@ void RemoteService::callCompleted(Jolie::PendingCallWatcher *watcher) foreach (const QString &operation, operationNames()) { if (enabledOperationsList.contains(operation) && !isOperationEnabled(operation)) { +#ifndef NDEBUG kDebug() << "yeah, we're enabling the operation with the name " << operation; +#endif setOperationEnabled(operation, true); } else if (!enabledOperationsList.contains(operation) && isOperationEnabled(operation)) { +#ifndef NDEBUG kDebug() << "we're disabling the operation with the name " << operation; +#endif setOperationEnabled(operation, false); } } @@ -188,7 +204,9 @@ void RemoteService::callCompleted(Jolie::PendingCallWatcher *watcher) m_busy = false; slotFinished(); } else { +#ifndef NDEBUG kDebug() << "How did we end up here?"; +#endif } } @@ -233,7 +251,9 @@ void RemoteService::slotUpdateEnabledOperations() connect(watcher, SIGNAL(finished(Jolie::PendingCallWatcher*)), this, SLOT(callCompleted(Jolie::PendingCallWatcher*))); } else { +#ifndef NDEBUG kDebug() << "We would like to update enabled operations, but are still busy so let's wait for now."; +#endif } } @@ -241,7 +261,9 @@ ServiceJob* RemoteService::createJob(const QString& operation, QHash& parameters) { if (!m_ready) { +#ifndef NDEBUG kDebug() << "Use of this service hasn't checked for the serviceReady signal, which it should."; +#endif } ServiceJob *job = new RemoteServiceJob(m_location, destination(), operation, parameters, m_token, this); @@ -252,7 +274,9 @@ ServiceJob* RemoteService::createJob(const QString& operation, void RemoteService::slotFinished() { if (!m_queue.isEmpty()) { +#ifndef NDEBUG kDebug() << "Job finished, there are still service jobs in queue, starting next in queue."; +#endif ServiceJob *job = m_queue.dequeue(); QTimer::singleShot(0, job, SLOT(slotStart())); } @@ -264,7 +288,9 @@ Jolie::Message RemoteService::signMessage(const Jolie::Message &message) const Credentials identity = AuthorizationManager::self()->d->myCredentials; if (!identity.isValid()) { +#ifndef NDEBUG kDebug() << "We don't have our identity yet, just drop this message"; +#endif return response; } diff --git a/private/remoteservicejob.cpp b/private/remoteservicejob.cpp index ec5f004e7..dfd314b1b 100644 --- a/private/remoteservicejob.cpp +++ b/private/remoteservicejob.cpp @@ -66,7 +66,9 @@ void RemoteServiceJob::start() if (m_service->m_busy || !m_service->m_ready) { //enqueue and wait m_service->m_queue.enqueue(this); +#ifndef NDEBUG kDebug() << "already busy... enqueue, queue contains " << m_service->m_queue.count(); +#endif return; } @@ -145,7 +147,9 @@ void RemoteServiceJob::callCompleted(Jolie::PendingCallWatcher *watcher) //TODO:async if (response.fault().isValid()) { +#ifndef NDEBUG kDebug() << "fault: " << response.fault().name(); +#endif setError(-1); setErrorText(JolieMessage::errorMessage(response.fault().name())); emitResult(); @@ -167,7 +171,9 @@ void RemoteServiceJob::callCompleted(Jolie::PendingCallWatcher *watcher) void RemoteServiceJob::timeout() { m_service->m_busy = false; +#ifndef NDEBUG kDebug() << "Service job timed out."; +#endif setError(-1); setErrorText(i18n("Timeout.")); m_service->m_queue.removeAll(this); diff --git a/private/serviceprovider.cpp b/private/serviceprovider.cpp index 0f3efc85c..adc78e843 100644 --- a/private/serviceprovider.cpp +++ b/private/serviceprovider.cpp @@ -57,7 +57,9 @@ ServiceProvider::ServiceProvider(const QString &name, Service *service) m_providerName = name; AuthorizationManager::self()->d->server->registerAdaptor(m_providerName.toUtf8(), this); +#ifndef NDEBUG kDebug() << "registered service provider " << m_providerName; +#endif } ServiceProvider::~ServiceProvider() @@ -67,7 +69,9 @@ ServiceProvider::~ServiceProvider() void ServiceProvider::startOperationCall(Jolie::Message message) { +#ifndef NDEBUG kDebug() << "starting operation call"; +#endif KConfigGroup description = m_service->operationDescription(QString(JolieMessage::field(JolieMessage::Field::OPERATION, message))); @@ -75,7 +79,9 @@ void ServiceProvider::startOperationCall(Jolie::Message message) //deserialize the parameters QByteArray parametersByteArray; parametersByteArray = JolieMessage::field(JolieMessage::Field::PARAMETERS, message); +#ifndef NDEBUG kDebug() << "parameters byte array: " << parametersByteArray.toBase64(); +#endif QBuffer buffer(¶metersByteArray); buffer.open(QIODevice::ReadOnly); QDataStream in(&buffer); @@ -83,10 +89,14 @@ void ServiceProvider::startOperationCall(Jolie::Message message) in >> parameters; if (!description.isValid()) { +#ifndef NDEBUG kDebug() << "invalid description."; +#endif } +#ifndef NDEBUG kDebug() << "====PARAMETERS===="; +#endif //write the parameters into the operation description QMap::const_iterator it = parameters.constBegin(); @@ -94,7 +104,9 @@ void ServiceProvider::startOperationCall(Jolie::Message message) for ( ; it != itEnd; ++it) { const QString key = it.key(); const QVariant value = it.value(); +#ifndef NDEBUG kDebug() << "key = " << key << ", value = " << value; +#endif description.writeEntry(key, value); } @@ -102,13 +114,17 @@ void ServiceProvider::startOperationCall(Jolie::Message message) ServiceJob *job = m_service->startOperationCall(description); QString identityID = JolieMessage::field(JolieMessage::Field::IDENTITYID, message); job->d->identity = AuthorizationManager::self()->d->getCredentials(identityID); +#ifndef NDEBUG kDebug() << "adding into messagemap:" << ((QObject*)job); +#endif m_messageMap[job] = message; } void ServiceProvider::sendOperations(Jolie::Message message) { +#ifndef NDEBUG kDebug() << "send operations."; +#endif //kDebug() << printJolieMessage(message); Jolie::Message response(message.resourcePath(), message.operationName(), message.id()); @@ -117,10 +133,14 @@ void ServiceProvider::sendOperations(Jolie::Message message) ".operations"); if (path.isEmpty()) { +#ifndef NDEBUG kDebug() << "Cannot find operations description:" << m_service->name() << ".operations"; +#endif response.setFault(Jolie::Fault("NoOperationsDescription")); } else { +#ifndef NDEBUG kDebug() << "file = " << path; +#endif QFile file(path); file.open(QIODevice::ReadOnly); Jolie::Value value; @@ -132,21 +152,29 @@ void ServiceProvider::sendOperations(Jolie::Message message) QByteArray id = JolieMessage::field(JolieMessage::Field::IDENTITYID, message); QByteArray uuid = JolieMessage::field(JolieMessage::Field::UUID, message); response = appendToken(response, id, uuid); +#ifndef NDEBUG kDebug() << "caller = " << id.toBase64(); +#endif //hack around the not yet async service adaptor api in qtjolie if (m_descriptorMap.contains(id + uuid)) { +#ifndef NDEBUG kDebug() << "descriptor found, sending message"; +#endif AuthorizationManager::self()->d->server->sendReply( m_descriptorMap.value(id + uuid), response); } else { +#ifndef NDEBUG kDebug() << "no valid entry in descriptormap."; +#endif } } void ServiceProvider::sendEnabledOperations(Jolie::Message message) { +#ifndef NDEBUG kDebug() << "send enabled operations."; +#endif Jolie::Message response(message.resourcePath(), message.operationName(), message.id()); QStringList enabledOperationsList; @@ -156,7 +184,9 @@ void ServiceProvider::sendEnabledOperations(Jolie::Message message) } } +#ifndef NDEBUG kDebug() << "enabled operations: " << enabledOperationsList; +#endif QByteArray enabledOperationsArray; QDataStream out(&enabledOperationsArray, QIODevice::WriteOnly); @@ -169,15 +199,21 @@ void ServiceProvider::sendEnabledOperations(Jolie::Message message) QByteArray id = JolieMessage::field(JolieMessage::Field::IDENTITYID, message); QByteArray uuid = JolieMessage::field(JolieMessage::Field::UUID, message); response = appendToken(response, id, uuid); +#ifndef NDEBUG kDebug() << "caller = " << id.toBase64(); +#endif //hack around the not yet async service adaptor api in qtjolie if (m_descriptorMap.contains(id + uuid)) { +#ifndef NDEBUG kDebug() << "descriptor found, sending message"; +#endif AuthorizationManager::self()->d->server->sendReply( m_descriptorMap.value(id + uuid), response); } else { +#ifndef NDEBUG kDebug() << "no valid entry in descriptormap."; +#endif } } @@ -192,7 +228,9 @@ void ServiceProvider::relay(Jolie::Server *server, int descriptor, Q_UNUSED(server) if (message.operationName() == "startConnection") { +#ifndef NDEBUG kDebug() << "reset token"; +#endif //add the identity Credentials identity; QByteArray identityByteArray = JolieMessage::field(JolieMessage::Field::IDENTITY, message); @@ -224,19 +262,27 @@ void ServiceProvider::relay(Jolie::Server *server, int descriptor, void ServiceProvider::operationCompleted(Plasma::ServiceJob *job) { +#ifndef NDEBUG kDebug() << "operation completed."; +#endif if (!m_messageMap.contains(job)) { +#ifndef NDEBUG kDebug() << "service not in map!"; +#endif return; } +#ifndef NDEBUG kDebug() << "found message in message map!"; +#endif Jolie::Message message = m_messageMap.take(job); Jolie::Message response(message.resourcePath(), message.operationName(), message.id()); QVariant variantResult = job->result(); +#ifndef NDEBUG kDebug() << "got a result: " << variantResult; +#endif QByteArray byteArrayResult; QBuffer buffer(&byteArrayResult); buffer.open(QIODevice::WriteOnly); @@ -256,11 +302,15 @@ void ServiceProvider::operationCompleted(Plasma::ServiceJob *job) //hack around the not yet async service adaptor api in qtjolie if (m_descriptorMap.contains(id + uuid)) { +#ifndef NDEBUG kDebug() << "descriptor found, sending message"; +#endif AuthorizationManager::self()->d->server->sendReply( m_descriptorMap.value(id + uuid), response); } else { +#ifndef NDEBUG kDebug() << "no valid entry in descriptormap."; +#endif } } @@ -274,13 +324,17 @@ void ServiceProvider::ruleChanged(Plasma::AuthorizationRule *rule) bool matches = rule->d->matches(message.resourcePath(), id); if (matches && rule->policy() == AuthorizationRule::PinRequired && JolieMessage::field(JolieMessage::Field::PIN, message) != rule->pin()) { +#ifndef NDEBUG kDebug() << "we need a pin"; +#endif authorizationFailed(message, JolieMessage::Error::REQUIREPIN); m_messagesPendingAuthorization.removeAt(i); return; /** } else if (matches && rule->policy() == AuthorizationRule::PinRequired) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is freely accessable for verified caller."; +#endif rule->setPolicy(AuthorizationRule::Allow); authorizationSuccess(message); //TODO: it might be nicer to do a removeAll once Jolie::Message implements == @@ -288,13 +342,17 @@ void ServiceProvider::ruleChanged(Plasma::AuthorizationRule *rule) return; */ } else if (matches && rule->policy() == AuthorizationRule::Allow) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is freely accessable for verified caller."; +#endif authorizationSuccess(message); //TODO: it might be nicer to do a removeAll once Jolie::Message implements == m_messagesPendingAuthorization.removeAt(i); return; } else if (matches && rule->policy() == AuthorizationRule::Deny) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is never accessable for verified caller."; +#endif authorizationFailed(message, JolieMessage::Error::ACCESSDENIED); m_messagesPendingAuthorization.removeAt(i); return; @@ -321,31 +379,45 @@ Jolie::Message ServiceProvider::appendToken(Jolie::Message message, void ServiceProvider::authorize(const Jolie::Message &message, const QByteArray &validToken) { +#ifndef NDEBUG kDebug() << "VALIDATING MESSAGE:"; +#endif //kDebug() << JolieMessage::print(message); //Authorization step 1: is the service accessable to all callers? In that case we can skip the //verification of the signature +#ifndef NDEBUG kDebug() << "STEP1"; +#endif AuthorizationRule *rule = AuthorizationManager::self()->d->matchingRule(message.resourcePath(), Credentials()); if (rule && rule->policy() == AuthorizationRule::Allow) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is freely accessable."; +#endif authorizationSuccess(message); return; } else if (rule && rule->policy() == AuthorizationRule::Deny) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is never accessable."; +#endif authorizationFailed(message, JolieMessage::Error::ACCESSDENIED); return; } //Authorization step 2: see if the token matches. If it doesn't we can't safely identify the //caller and are finished. +#ifndef NDEBUG kDebug() << "STEP2"; +#endif if (JolieMessage::field(JolieMessage::Field::TOKEN, message) != validToken && !validToken.isEmpty()) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Message token doesn't match."; +#endif +#ifndef NDEBUG kDebug() << "expected: " << validToken.toBase64(); +#endif authorizationFailed(message, JolieMessage::Error::INVALIDTOKEN); return; } @@ -356,25 +428,35 @@ void ServiceProvider::authorize(const Jolie::Message &message, const QByteArray JolieMessage::field(JolieMessage::Field::IDENTITYID, message)); if (!identity.isValid()) { +#ifndef NDEBUG kDebug() << "no identity"; +#endif authorizationFailed(message, JolieMessage::Error::INVALIDTOKEN); return; } +#ifndef NDEBUG kDebug() << "STEP3"; +#endif //Authorization step 3: see if we have the key and can validate the signature. If we can't, //either the public key has changed, or somebody is doing something nasty, and we're finished. if ((!identity.isValidSignature(signature, payload))) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: signature invalid."; +#endif authorizationFailed(message, JolieMessage::Error::ACCESSDENIED); return; } +#ifndef NDEBUG kDebug() << "STEP4"; +#endif //Authorization step 4: if we have a valid signature, see if we've got a matching rule rule = AuthorizationManager::self()->d->matchingRule(message.resourcePath(), identity); if (rule && rule->policy() == AuthorizationRule::PinRequired) { +#ifndef NDEBUG kDebug() << "we expect a pin!"; +#endif QByteArray pin = JolieMessage::field(JolieMessage::Field::PIN, message); if (rule->pin() == QString(pin)) { authorizationSuccess(message); @@ -385,17 +467,25 @@ void ServiceProvider::authorize(const Jolie::Message &message, const QByteArray delete rule; } } else if (rule && rule->policy() == AuthorizationRule::Allow) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is freely accessable for validated sender."; +#endif authorizationSuccess(message); return; } else if (rule && rule->policy() == AuthorizationRule::Deny) { +#ifndef NDEBUG kDebug() << "AUTHORIZATION: Service is not accessable for validated sender."; +#endif authorizationFailed(message, JolieMessage::Error::ACCESSDENIED); return; } else { //- let the shell set the rule matching this request: +#ifndef NDEBUG kDebug() << "STEP6"; +#endif +#ifndef NDEBUG kDebug() << "leave it up to the authorization interface"; +#endif m_messagesPendingAuthorization << message; AuthorizationRule *newRule = new AuthorizationRule(QString(message.resourcePath()), identity.id()); @@ -408,7 +498,9 @@ void ServiceProvider::authorize(const Jolie::Message &message, const QByteArray void ServiceProvider::authorizationSuccess(const Jolie::Message &message) { +#ifndef NDEBUG kDebug() << "message with operationName " << message.operationName() << " allowed!"; +#endif //would be lovely if this kind of stuff could be autogenerated code from xml like in dbus //adaptors @@ -423,7 +515,9 @@ void ServiceProvider::authorizationSuccess(const Jolie::Message &message) void ServiceProvider::authorizationFailed(const Jolie::Message &message, const QByteArray &error) { +#ifndef NDEBUG kDebug() << "message with operationName " << message.operationName() << " NOT allowed!"; +#endif Jolie::Message response(message.resourcePath(), message.operationName(), message.id()); response.setFault(Jolie::Fault(error)); diff --git a/private/tooltip.cpp b/private/tooltip.cpp index 20c4ee03d..3be6d7a88 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -273,7 +273,9 @@ void ToolTip::adjustPosition(const QSize &previous, const QSize ¤t) int deltaY = 0; if (d->direction == Plasma::Up) { /* +#ifndef NDEBUG kDebug() << "resizing from" << current << "to" << hint +#endif << "and moving from" << pos() << "to" << x() << y() + (current.height() - hint.height()) << current.height() - hint.height(); @@ -281,7 +283,9 @@ void ToolTip::adjustPosition(const QSize &previous, const QSize ¤t) deltaY = previous.height() - current.height(); } else if (d->direction == Plasma::Left) { /* +#ifndef NDEBUG kDebug() << "vertical resizing from" << current << "to" << hint +#endif << "and moving from" << pos() << "to" << x() + (current.width() - hint.width()) << y() << current.width() - hint.width(); */ diff --git a/private/wallpaperrenderthread.cpp b/private/wallpaperrenderthread.cpp index 316b89b60..8c0e04f3f 100644 --- a/private/wallpaperrenderthread.cpp +++ b/private/wallpaperrenderthread.cpp @@ -58,7 +58,9 @@ WallpaperRenderThread::WallpaperRenderThread(const WallpaperRenderRequest &reque WallpaperRenderThread::~WallpaperRenderThread() { +#ifndef NDEBUG kDebug() << "rendering done"; +#endif m_abort = true; wait(); --s_rendererCount; @@ -102,7 +104,9 @@ void WallpaperRenderThread::checkQueue() #else const int numProcs = 1; #endif +#ifndef NDEBUG kDebug() << "checking rendering against" << s_rendererCount << numProcs; +#endif if (s_rendererCount < numProcs) { WallpaperRenderThread *renderThread = new WallpaperRenderThread(s_renderQueue.dequeue()); renderThread->start(); @@ -111,7 +115,9 @@ void WallpaperRenderThread::checkQueue() void WallpaperRenderThread::run() { +#ifndef NDEBUG kDebug() << "rendering wallpaper" << m_request.file; +#endif QImage result(m_request.size, QImage::Format_ARGB32_Premultiplied); result.fill(m_request.color.rgba()); @@ -120,7 +126,9 @@ void WallpaperRenderThread::run() emit done(m_request, result); } +#ifndef NDEBUG kDebug() << "oh, fuck it"; +#endif deleteLater(); return; } @@ -223,7 +231,9 @@ void WallpaperRenderThread::run() QSvgRenderer svg(m_request.file); if (m_abort) { deleteLater(); +#ifndef NDEBUG kDebug() << "oh, fuck it 2"; +#endif return; } svg.render(&p); @@ -234,7 +244,9 @@ void WallpaperRenderThread::run() if (m_abort) { deleteLater(); +#ifndef NDEBUG kDebug() << "oh, fuck it 3"; +#endif return; } @@ -243,7 +255,9 @@ void WallpaperRenderThread::run() for (int y = pos.y(); y < m_request.size.height(); y += scaledSize.height()) { p.drawImage(QPoint(x, y), img); if (m_abort) { +#ifndef NDEBUG kDebug() << "oh, fuck it 4"; +#endif deleteLater(); return; } @@ -256,7 +270,9 @@ void WallpaperRenderThread::run() // signal we're done if (!m_abort) { +#ifndef NDEBUG kDebug() << "*****************************************************"; +#endif emit done(m_request, result); } diff --git a/remote/accessappletjob.cpp b/remote/accessappletjob.cpp index ff5b40346..f57abf027 100644 --- a/remote/accessappletjob.cpp +++ b/remote/accessappletjob.cpp @@ -65,7 +65,9 @@ public: void slotPackageDownloaded(Plasma::ServiceJob *job) { if (job->error()) { +#ifndef NDEBUG kDebug() << "Plasmoid Access Job triggers an error."; +#endif q->setError(job->error()); q->setErrorText(job->errorText()); } @@ -74,7 +76,9 @@ public: //the fetched package. Just extract the archive somewhere in a temp directory. if (job->result().type() == QVariant::String) { QString pluginName = job->result().toString(); +#ifndef NDEBUG kDebug() << "Server responded with a pluginname, trying to load: " << pluginName; +#endif applet = PluginLoader::self()->loadApplet(pluginName); if (applet) { @@ -86,7 +90,9 @@ public: q->emitResult(); } else { +#ifndef NDEBUG kDebug() << "Server responded with a plasmoid package"; +#endif //read, and extract the plasmoid package to a temporary directory QByteArray package = job->result().toByteArray(); QDataStream stream(&package, QIODevice::ReadOnly); @@ -183,7 +189,9 @@ Applet *AccessAppletJob::applet() const void AccessAppletJob::start() { #ifdef ENABLE_REMOTE_WIDGETS +#ifndef NDEBUG kDebug() << "fetching a plasmoid from location = " << d->location.prettyUrl(); +#endif Service *service = Service::access(d->location); connect(service, SIGNAL(serviceReady(Plasma::Service*)), this, SLOT(slotServiceReady(Plasma::Service*))); diff --git a/remote/accessmanager.cpp b/remote/accessmanager.cpp index cce0f2f0f..20a7db856 100644 --- a/remote/accessmanager.cpp +++ b/remote/accessmanager.cpp @@ -146,7 +146,9 @@ AccessAppletJob *AccessManager::accessRemoteApplet(const KUrl &location) const if (d->zeroconfServices.contains(location.host())) { resolvedLocation = d->services[location.host()].url(); } else { +#ifndef NDEBUG kDebug() << "There's no zeroconf service with this name."; +#endif } } else { resolvedLocation = location; @@ -197,30 +199,44 @@ void AccessManagerPrivate::slotJobFinished(KJob *job) void AccessManagerPrivate::slotAddService(DNSSD::RemoteService::Ptr service) { +#ifndef NDEBUG kDebug(); +#endif if (!service->resolve()) { +#ifndef NDEBUG kDebug() << "Zeroconf service can't be resolved"; +#endif return; } if (!services.contains(service->serviceName())) { RemoteObjectDescription metadata; +#ifndef NDEBUG kDebug() << "textdata = " << service->textData(); +#endif +#ifndef NDEBUG kDebug() << "hostname: " << service->hostName(); +#endif QHostAddress address = DNSSD::ServiceBrowser::resolveHostName(service->hostName()); QString ip = address.toString(); +#ifndef NDEBUG kDebug() << "result for resolve = " << ip; +#endif KUrl url(QString("plasma://%1:%2/%3").arg(ip) .arg(service->port()) .arg(service->serviceName())); if (service->textData().isEmpty()) { +#ifndef NDEBUG kDebug() << "no textdata?"; +#endif metadata.setName(service->serviceName()); metadata.setUrl(url); } else { +#ifndef NDEBUG kDebug() << "service has got textdata"; +#endif QMap textData = service->textData(); metadata.setName(textData["name"]); metadata.setDescription(textData["description"]); @@ -228,9 +244,15 @@ void AccessManagerPrivate::slotAddService(DNSSD::RemoteService::Ptr service) metadata.setUrl(url); } +#ifndef NDEBUG kDebug() << "location = " << metadata.url(); +#endif +#ifndef NDEBUG kDebug() << "name = " << metadata.name(); +#endif +#ifndef NDEBUG kDebug() << "description = " << metadata.name(); +#endif services[service->serviceName()] = metadata; zeroconfServices[service->serviceName()] = service; @@ -240,7 +262,9 @@ void AccessManagerPrivate::slotAddService(DNSSD::RemoteService::Ptr service) void AccessManagerPrivate::slotRemoveService(DNSSD::RemoteService::Ptr service) { +#ifndef NDEBUG kDebug(); +#endif emit q->remoteAppletUnannounced(services[service->serviceName()]); services.remove(service->serviceName()); zeroconfServices.remove(service->serviceName()); diff --git a/remote/authorizationmanager.cpp b/remote/authorizationmanager.cpp index e27b2518c..bc43c6855 100644 --- a/remote/authorizationmanager.cpp +++ b/remote/authorizationmanager.cpp @@ -81,7 +81,9 @@ AuthorizationManager::~AuthorizationManager() void AuthorizationManager::setAuthorizationPolicy(AuthorizationPolicy policy) { if (d->locked) { +#ifndef NDEBUG kDebug() << "Can't change AuthorizationPolicy: interface locked."; +#endif return; } @@ -116,7 +118,9 @@ void AuthorizationManager::setAuthorizationPolicy(AuthorizationPolicy policy) void AuthorizationManager::setAuthorizationInterface(AuthorizationInterface *interface) { if (d->authorizationInterface) { +#ifndef NDEBUG kDebug() << "Can't change AuthorizationInterface: interface locked."; +#endif return; } @@ -166,7 +170,9 @@ void AuthorizationManagerPrivate::prepareForServicePublication() void AuthorizationManagerPrivate::saveRules() { +#ifndef NDEBUG kDebug() << "SAVE RULES"; +#endif KTemporaryFile tempFile; tempFile.open(); @@ -176,7 +182,9 @@ void AuthorizationManagerPrivate::saveRules() int i = 0; foreach (AuthorizationRule *rule, rules) { if (rule->persistence() == AuthorizationRule::Persistent) { +#ifndef NDEBUG kDebug() << "adding rule " << i; +#endif rulesGroup.group(QString::number(i)).writeEntry("CredentialsID", rule->credentials().id()); rulesGroup.group(QString::number(i)).writeEntry("serviceName", rule->serviceName()); rulesGroup.group(QString::number(i)).writeEntry("Policy", (uint)rule->policy()); @@ -188,7 +196,9 @@ void AuthorizationManagerPrivate::saveRules() rulesGroup.sync(); tempFile.close(); +#ifndef NDEBUG kDebug() << "tempfile = " << tempFile.fileName(); +#endif KAuth::Action action("org.kde.kcontrol.kcmremotewidgets.save"); action.addArgument("source", tempFile.fileName()); @@ -196,7 +206,9 @@ void AuthorizationManagerPrivate::saveRules() KAuth::ActionReply reply = action.execute(); if (reply.failed()) { +#ifndef NDEBUG kDebug() << "KAuth failed.... YOU SUCK!"; +#endif } } @@ -205,13 +217,17 @@ void AuthorizationManagerPrivate::slotWalletOpened() QByteArray identity; if (!wallet->readEntry("Credentials", identity)) { +#ifndef NDEBUG kDebug() << "Existing identity found"; +#endif QDataStream stream(&identity, QIODevice::ReadOnly); stream >> myCredentials; } if (!myCredentials.isValid()) { +#ifndef NDEBUG kDebug() << "Creating a new identity"; +#endif myCredentials = Credentials::createCredentials(QHostInfo::localHostName()); QDataStream stream(&identity, QIODevice::WriteOnly); stream << myCredentials; @@ -231,7 +247,9 @@ void AuthorizationManagerPrivate::slotLoadRules() uint persistence = rulesConfig.group(groupName).readEntry("Persistence", 0); //Credentials storedCredentials = identities[identityID]; if (serviceName.isEmpty()) { +#ifndef NDEBUG kDebug() << "Invalid rule"; +#endif } else { AuthorizationRule *rule = new AuthorizationRule(serviceName, identityID); rule->setPolicy(static_cast(policy)); @@ -262,9 +280,13 @@ AuthorizationRule *AuthorizationManagerPrivate::matchingRule(const QString &serv } if (!matchingRule) { +#ifndef NDEBUG kDebug() << "no matching rule"; +#endif } else { +#ifndef NDEBUG kDebug() << "matching rule found: " << matchingRule->description(); +#endif } return matchingRule; } @@ -283,7 +305,9 @@ void AuthorizationManagerPrivate::addCredentials(const Credentials &identity) if (identities.contains(identity.id())) { return; } else if (identity.isValid()) { +#ifndef NDEBUG kDebug() << "Adding a new identity for " << identity.id(); +#endif identities[identity.id()] = identity; } } diff --git a/remote/clientpinrequest.cpp b/remote/clientpinrequest.cpp index 1d7f971ce..c77fe4ad0 100644 --- a/remote/clientpinrequest.cpp +++ b/remote/clientpinrequest.cpp @@ -60,7 +60,9 @@ QString ClientPinRequest::description() const void ClientPinRequest::setPin(const QString &pin) { +#ifndef NDEBUG kDebug() << "pin = " << pin; +#endif d->pin = pin; emit changed(this); } diff --git a/remote/credentials.cpp b/remote/credentials.cpp index c943e8ed8..4b4965c31 100644 --- a/remote/credentials.cpp +++ b/remote/credentials.cpp @@ -151,7 +151,9 @@ bool Credentials::isValid() const return (id == d->id); } #else +#ifndef NDEBUG kDebug() << "libplasma is compiled without support for remote widgets. Key invalid."; +#endif return false; #endif } @@ -176,14 +178,18 @@ bool Credentials::isValidSignature(const QByteArray &signature, const QByteArray if (d->publicKey.canVerify()) { if (!isValid()) { +#ifndef NDEBUG kDebug() << "Key is null?"; +#endif } QCA::PublicKey publicKey = QCA::PublicKey::fromPEM(d->publicKey.toPEM()); publicKey.startVerify( QCA::EMSA3_MD5 ); publicKey.update(payload); return ( publicKey.validSignature( signature ) ); } else { +#ifndef NDEBUG kDebug() << "Can't verify?"; +#endif return false; } #else @@ -209,7 +215,9 @@ QByteArray Credentials::signMessage(const QByteArray &message) { #ifdef ENABLE_REMOTE_WIDGETS if(!QCA::isSupported(REQUIRED_FEATURES)) { +#ifndef NDEBUG kDebug() << "RSA not supported"; +#endif return QByteArray(); } else if (canSign()) { //QCA::PrivateKey privateKey = QCA::PrivateKey::fromPEM(d->privateKey.toPEM()); @@ -285,7 +293,9 @@ QDataStream &operator>>(QDataStream &in, Credentials &myObj) } if (conversionResult != QCA::ConvertGood) { +#ifndef NDEBUG kDebug() << "Unsuccessfull conversion of key?"; +#endif } #endif diff --git a/remote/denyallauthorization.cpp b/remote/denyallauthorization.cpp index 31c56c378..bf2e1c120 100644 --- a/remote/denyallauthorization.cpp +++ b/remote/denyallauthorization.cpp @@ -38,13 +38,17 @@ DenyAllAuthorization::~DenyAllAuthorization() void DenyAllAuthorization::clientPinRequest(ClientPinRequest &request) { +#ifndef NDEBUG kDebug(); +#endif request.setPin(""); } void DenyAllAuthorization::authorizationRequest(AuthorizationRule &rule) { +#ifndef NDEBUG kDebug(); +#endif rule.setPolicy(AuthorizationRule::Deny); rule.setTargets(AuthorizationRule::AllServices | AuthorizationRule::AllUsers); } diff --git a/remote/pinpairingauthorization.cpp b/remote/pinpairingauthorization.cpp index 10a47e3cb..d9e3b03de 100644 --- a/remote/pinpairingauthorization.cpp +++ b/remote/pinpairingauthorization.cpp @@ -42,13 +42,17 @@ PinPairingAuthorization::~PinPairingAuthorization() void PinPairingAuthorization::clientPinRequest(ClientPinRequest &request) { +#ifndef NDEBUG kDebug(); +#endif new PinPairingDialog(request); } void PinPairingAuthorization::authorizationRequest(AuthorizationRule &rule) { +#ifndef NDEBUG kDebug(); +#endif if (rule.credentials().trustLevel() > UnknownTrusted) { rule.setPolicy(AuthorizationRule::Allow); rule.setTargets(AuthorizationRule::AllServices); diff --git a/remote/pinpairingdialog.cpp b/remote/pinpairingdialog.cpp index cc3de52a4..d2bf9a515 100644 --- a/remote/pinpairingdialog.cpp +++ b/remote/pinpairingdialog.cpp @@ -65,7 +65,9 @@ public: void slotAccept() { +#ifndef NDEBUG kDebug(); +#endif if (rule) { rule->setPin(pairingUI.password->text()); if (pairingUI.allServicesCheckbox->isChecked()) { diff --git a/remote/signing.cpp b/remote/signing.cpp index 1441ffed7..b0826923e 100644 --- a/remote/signing.cpp +++ b/remote/signing.cpp @@ -56,7 +56,9 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &path) GpgME::initializeLibrary(); GpgME::Error error = GpgME::checkEngine(GpgME::OpenPGP); if (error) { +#ifndef NDEBUG kDebug() << "OpenPGP engine not found: authentication will not work."; +#endif return; } @@ -73,7 +75,9 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &path) } else { error = m_gpgContext->setEngineHomeDirectory(m_keystorePath.toAscii().data()); if (error) { +#ifndef NDEBUG kDebug() << "Failed setting custom gpg keystore directory: using default."; +#endif } } @@ -104,14 +108,18 @@ void SigningPrivate::registerUltimateTrustKeys() keys[UltimatelyTrusted] = tmp; if (!m_gpgContext) { +#ifndef NDEBUG kDebug() << "GPGME context not valid: please re-initialize the library."; +#endif return; } QString path = ultimateKeyStoragePath(); QDir dir(path); if (!dir.exists() || path.isEmpty()) { +#ifndef NDEBUG kDebug() << "Directory with KDE keys not found: aborting"; +#endif return; } @@ -127,8 +135,12 @@ void SigningPrivate::registerUltimateTrustKeys() GpgME::Data data(fp); GpgME::ImportResult iRes = m_gpgContext->importKeys(data); if (iRes.error()) { +#ifndef NDEBUG kDebug() << "Error while importing the key located at: " << keyFile; +#endif +#ifndef NDEBUG kDebug() << " The error is:" << iRes.error().asString() << "; Skipping."; +#endif continue; } @@ -144,7 +156,9 @@ void SigningPrivate::registerUltimateTrustKeys() void SigningPrivate::splitKeysByTrustLevel() { if (!m_gpgContext) { +#ifndef NDEBUG kDebug() << "GPGME context not valid: please re-initialize the library."; +#endif return; } @@ -198,7 +212,9 @@ void SigningPrivate::splitKeysByTrustLevel() Plasma::TrustLevel SigningPrivate::addKeyToCache(const QByteArray &fingerprint) { if (!m_gpgContext) { +#ifndef NDEBUG kDebug() << "GPGME context not valid: please re-initialize the library."; +#endif return UnknownTrusted; } @@ -243,12 +259,24 @@ Plasma::TrustLevel SigningPrivate::addKeyToCache(const QByteArray &fingerprint) void SigningPrivate::dumpKeysToDebug() { +#ifndef NDEBUG kDebug() << "UltimatelyTrusted = " << keys[UltimatelyTrusted]; +#endif +#ifndef NDEBUG kDebug() << "FullyTrusted = " << keys[FullyTrusted]; +#endif +#ifndef NDEBUG kDebug() << "SelfTrusted = " << keys[SelfTrusted]; +#endif +#ifndef NDEBUG kDebug() << "UserTrusted = " << keys[UserTrusted]; +#endif +#ifndef NDEBUG kDebug() << "UnknownTrusted = " << keys[UnknownTrusted]; +#endif +#ifndef NDEBUG kDebug() << "CompletelyUntrusted = " << keys[CompletelyUntrusted]; +#endif } QStringList SigningPrivate::keysID(const bool returnPrivate) const @@ -256,7 +284,9 @@ QStringList SigningPrivate::keysID(const bool returnPrivate) const QStringList result; if (!m_gpgContext) { +#ifndef NDEBUG kDebug() << "GPGME context not valid: please re-initialize the library."; +#endif return result; } @@ -271,7 +301,9 @@ QStringList SigningPrivate::keysID(const bool returnPrivate) const } GpgME::KeyListResult lRes = m_gpgContext->endKeyListing(); if (lRes.error()) { +#ifndef NDEBUG kDebug() << "Error while ending the keyListing operation: " << lRes.error().asString(); +#endif } return result; @@ -405,7 +437,9 @@ void SigningPrivate::keyRemoved(const QString &path) error = m_gpgContext->startKeyDeletion(k, true); // GG if (error) { +#ifndef NDEBUG kDebug() << "Can't delete key with fingerprint: " << result; +#endif m_gpgContext->endKeyListing(); return; } @@ -415,7 +449,9 @@ void SigningPrivate::keyRemoved(const QString &path) } GpgME::KeyListResult lRes = m_gpgContext->endKeyListing(); if (lRes.error()) { +#ifndef NDEBUG kDebug() << "Error while ending the keyListing operation: " << lRes.error().asString(); +#endif } splitKeysByTrustLevel(); @@ -499,21 +535,27 @@ QString Signing::signerOf(const Package &package) const const QString contents = package.path() + "CONTENTS"; if (!QFile::exists(contents)) { +#ifndef NDEBUG kDebug() << "not contents hash for package at" << package.path(); +#endif return QString(); } QFile file(contents); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { +#ifndef NDEBUG kDebug() << "could not open hash file for reading" << contents; +#endif return QString(); } const QByteArray hash = file.read(10 * 1024); const QString actualHash = package.contentsHash(); if (actualHash != hash) { +#ifndef NDEBUG kDebug() << "CONTENTS does not match contents of package" << package.path(); +#endif return QString(); } @@ -522,11 +564,17 @@ QString Signing::signerOf(const Package &package) const QString Signing::signerOf(const KUrl &package, const KUrl &signature) const { +#ifndef NDEBUG kDebug() << "Checking existence of " << package.pathOrUrl(); +#endif +#ifndef NDEBUG kDebug() << "Checking existence of " << signature.pathOrUrl(); +#endif if (!package.isLocalFile() || (!signature.isEmpty() && !signature.isLocalFile())) { +#ifndef NDEBUG kDebug() << "Remote urls not yet supported. FIXME."; +#endif return QString(); } @@ -536,14 +584,18 @@ QString Signing::signerOf(const KUrl &package, const KUrl &signature) const QString SigningPrivate::verifySignature(const QString &filePath, const QString &signature) { if (!QFile::exists(filePath)) { +#ifndef NDEBUG kDebug() << "Package" << filePath << "does not exist: signature verification aborted."; +#endif return QString(); } const QString signaturePath = signature.isEmpty() ? filePath + (".sig") : signature; if (!QFile::exists(signaturePath)) { +#ifndef NDEBUG kDebug() << "Signature" << signaturePath << "does not exist: signature verification aborted."; +#endif return QString(); } @@ -551,13 +603,17 @@ QString SigningPrivate::verifySignature(const QString &filePath, const QString & FILE *pFile = fopen(filePath.toLocal8Bit().data(), "r"); if (!pFile) { +#ifndef NDEBUG kDebug() << "failed to open file" << filePath; +#endif return QString(); } FILE *pSig = fopen(signaturePath.toLocal8Bit().data(), "r"); if (!pSig) { +#ifndef NDEBUG kDebug() << "failed to open package file" << signaturePath; +#endif fclose(pFile); return QString(); } @@ -597,7 +653,9 @@ QString Signing::descriptiveString(const QString &keyID) const } if (!d->m_gpgContext) { +#ifndef NDEBUG kDebug() << "GPGME context not valid: please re-initialize the library."; +#endif return QString(); } diff --git a/runnercontext.cpp b/runnercontext.cpp index 5d57540d9..61f0d69b3 100644 --- a/runnercontext.cpp +++ b/runnercontext.cpp @@ -87,7 +87,9 @@ bool correctLastComponentCase(const QString &path, QString &correctCasePath, con return false; } else { /*if (matchingFilenames.size() > 1) { +#ifndef NDEBUG kDebug() << "Found multiple matches!!\n"; +#endif }*/ if (fileDir.path().endsWith(QDir::separator())) { diff --git a/runnermanager.cpp b/runnermanager.cpp index daadb5553..7eba834f1 100644 --- a/runnermanager.cpp +++ b/runnermanager.cpp @@ -224,12 +224,16 @@ public: } else if (loaded) { //Remove runner AbstractRunner *runner = runners.take(runnerName); +#ifndef NDEBUG kDebug() << "Removing runner: " << runnerName; +#endif delete runner; } } +#ifndef NDEBUG kDebug() << "All runners loaded, total:" << runners.count(); +#endif } AbstractRunner *loadInstalledRunner(const KService::Ptr service) @@ -252,7 +256,9 @@ public: QString error; runner = service->createInstance(q, args, &error); if (!runner) { +#ifndef NDEBUG kDebug() << "Failed to load runner:" << service->name() << ". error reported:" << error; +#endif } } } else { @@ -262,7 +268,9 @@ public: } if (runner) { +#ifndef NDEBUG kDebug() << "================= loading runner:" << service->name() << "================="; +#endif QObject::connect(runner, SIGNAL(matchingSuspended(bool)), q, SLOT(runnerMatchingSuspended(bool))); runner->init(); } @@ -576,7 +584,9 @@ void RunnerManager::run(const QueryMatch &match) foreach (FindMatchesJob *job, d->searchJobs) { if (job->runner() == runner && !job->isFinished()) { +#ifndef NDEBUG kDebug() << "deferred run"; +#endif d->deferredRun = match; return; } @@ -642,7 +652,9 @@ void RunnerManager::setupMatchSession() #endif emit runner->prepare(); #ifdef MEASURE_PREPTIME +#ifndef NDEBUG kDebug() << t.elapsed() << runner->name(); +#endif #endif } diff --git a/scripting/appletscript.cpp b/scripting/appletscript.cpp index 76173f700..6c1e634e6 100644 --- a/scripting/appletscript.cpp +++ b/scripting/appletscript.cpp @@ -203,13 +203,17 @@ Animation *AppletScript::loadAnimationFromPackage(const QString &name, QObject * const QString path = applet()->package().filePath("animations", file); if (path.isEmpty()) { +#ifndef NDEBUG kDebug() << "file path was empty for" << file; +#endif return 0; } if (!AnimationScriptEngine::loadScript(path, applet()->pluginName() + ':') || !AnimationScriptEngine::isAnimationRegistered(scopedName)) { +#ifndef NDEBUG kDebug() << "script engine loading failed for" << path; +#endif return 0; } } diff --git a/scripting/scriptengine.cpp b/scripting/scriptengine.cpp index 61c5668f6..38d1940c0 100644 --- a/scripting/scriptengine.cpp +++ b/scripting/scriptengine.cpp @@ -124,7 +124,9 @@ KService::List engineOffers(const QString &language, ComponentType type) QRegExp re("[^a-zA-Z0-9\\-_]"); if (re.indexIn(language) != -1) { +#ifndef NDEBUG kDebug() << "invalid language attempted:" << language; +#endif return KService::List(); } @@ -153,7 +155,9 @@ KService::List engineOffers(const QString &language, ComponentType type) /* kDebug() << "********************* loadingApplet with Plasma/ScriptEngine" << constraint << "resulting in" << offers.count() << "results";*/ if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "No offers for \"" << language << "\""; +#endif } return offers; @@ -190,8 +194,10 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p return engine; } +#ifndef NDEBUG kDebug() << "Couldn't load script engine for language " << language << "! error reported: " << error; +#endif } return 0; diff --git a/service.cpp b/service.cpp index e95079a91..4fae57bf5 100644 --- a/service.cpp +++ b/service.cpp @@ -98,15 +98,21 @@ void ServicePrivate::publish(AnnouncementMethods methods, const QString &name, c textData["description"] = metadata.comment().toUtf8(); textData["icon"] = metadata.icon().toUtf8(); publicService->setTextData(textData); +#ifndef NDEBUG kDebug() << "about to publish"; +#endif publicService->publishAsync(); } else if (methods.testFlag(ZeroconfAnnouncement) && (DNSSD::ServiceBrowser::isAvailable() != DNSSD::ServiceBrowser::Working)) { +#ifndef NDEBUG kDebug() << "sorry, but your zeroconf daemon doesn't seem to be running."; +#endif } } else { +#ifndef NDEBUG kDebug() << "already published!"; +#endif } #else kWarning() << "libplasma is compiled without support for remote widgets. not publishing."; @@ -153,7 +159,9 @@ QString Service::destination() const QStringList Service::operationNames() const { if (!d->config) { +#ifndef NDEBUG kDebug() << "No valid operations scheme has been registered"; +#endif return QStringList(); } @@ -163,7 +171,9 @@ QStringList Service::operationNames() const KConfigGroup Service::operationDescription(const QString &operationName) { if (!d->config) { +#ifndef NDEBUG kDebug() << "No valid operations scheme has been registered"; +#endif return d->dummyGroup(); } @@ -203,7 +213,9 @@ ServiceJob *Service::startOperationCall(const KConfigGroup &description, QObject RemoteService *rs = qobject_cast(this); if (!op.isEmpty() && rs && !rs->isReady()) { // if we have an operation, but a non-ready remote service, just let it through +#ifndef NDEBUG kDebug() << "Remote service is not ready; queueing operation"; +#endif QHash params; job = createJob(op, params); RemoteServiceJob *rsj = qobject_cast(job); @@ -211,16 +223,22 @@ ServiceJob *Service::startOperationCall(const KConfigGroup &description, QObject rsj->setDelayedDescription(description); } } else if (!d->config) { +#ifndef NDEBUG kDebug() << "No valid operations scheme has been registered"; +#endif } else if (!op.isEmpty() && d->config->hasGroup(op)) { if (d->disabledOperations.contains(op)) { +#ifndef NDEBUG kDebug() << "Operation" << op << "is disabled"; +#endif } else { QHash params = parametersFromDescription(description); job = createJob(op, params); } } else { +#ifndef NDEBUG kDebug() << "Not a valid group!"<config->groupList(); +#endif } if (!job) { @@ -378,14 +396,18 @@ void Service::registerOperationsScheme() } if (d->name.isEmpty()) { +#ifndef NDEBUG kDebug() << "No name found"; +#endif return; } const QString path = KStandardDirs::locate("data", "plasma/services/" + d->name + ".operations"); if (path.isEmpty()) { +#ifndef NDEBUG kDebug() << "Cannot find operations description:" << d->name << ".operations"; +#endif return; } diff --git a/svg.cpp b/svg.cpp index 4358578b3..01e5b31f3 100644 --- a/svg.cpp +++ b/svg.cpp @@ -207,7 +207,9 @@ bool SvgPrivate::setImagePath(const QString &imagePath) QObject::connect(cacheAndColorsTheme(), SIGNAL(themeChanged()), q, SLOT(themeChanged()), Qt::UniqueConnection); path = imagePath; } else { +#ifndef NDEBUG kDebug() << "file '" << path << "' does not exist!"; +#endif } // check if svg wants colorscheme applied diff --git a/tests/plasmoidpackagetest.cpp b/tests/plasmoidpackagetest.cpp index 2c79cb6ae..07aafadaa 100644 --- a/tests/plasmoidpackagetest.cpp +++ b/tests/plasmoidpackagetest.cpp @@ -104,7 +104,9 @@ void PlasmoidPackageTest::isValid() { Plasma::Package *p = new Plasma::Package(m_defaultPackage); p->setPath(m_packageRoot + '/' + m_package); +#ifndef NDEBUG kDebug() << "package path is" << p->path(); +#endif // A PlasmoidPackage is valid when: // - The package root exists. diff --git a/theme.cpp b/theme.cpp index 9253704c7..f4b7b01f5 100644 --- a/theme.cpp +++ b/theme.cpp @@ -137,7 +137,9 @@ public: QString app = KGlobal::mainComponent().componentName(); if (!app.isEmpty()) { +#ifndef NDEBUG kDebug() << "using theme for app" << app; +#endif groupName.append("-").append(app); } } @@ -544,14 +546,18 @@ void ThemePrivate::processAnimationSettings(const QString &theme, KConfigBase *m const QStringList anims = cg.readEntry(path, QStringList()); foreach (const QString &anim, anims) { if (!animationMapping.contains(anim)) { +#ifndef NDEBUG kDebug() << "Registering animation. animDir: " << animDir << "\tanim: " << anim << "\tpath: " << path << "\t*******\n\n\n"; +#endif //key: desktoptheme/default/animations/+ all.js //value: ZoomAnimation animationMapping.insert(anim, animDir % path); } else { +#ifndef NDEBUG kDebug() << "************Animation already registered!\n\n\n"; +#endif } } } @@ -682,7 +688,9 @@ QString Theme::imagePath(const QString &name) const // look for a compressed svg file in the theme if (name.contains("../") || name.isEmpty()) { // we don't support relative paths +#ifndef NDEBUG kDebug() << "Theme says: bad image path " << name; +#endif return QString(); } @@ -712,7 +720,9 @@ QString Theme::imagePath(const QString &name) const /* if (path.isEmpty()) { +#ifndef NDEBUG kDebug() << "Theme says: bad image path " << name; +#endif } */ @@ -778,7 +788,9 @@ QString Theme::wallpaperPath(const QSize &size) const fullPath = KStandardDirs::locate("wallpaper", defaultImage); if (fullPath.isEmpty()) { +#ifndef NDEBUG kDebug() << "exhausted every effort to find a wallpaper."; +#endif } } diff --git a/version.cpp b/version.cpp index 2fc56b949..7e870ae64 100644 --- a/version.cpp +++ b/version.cpp @@ -61,9 +61,11 @@ bool isPluginVersionCompatible(unsigned int version) const quint32 maxVersion = PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, PLASMA_VERSION_MINOR, 60); if (version < minVersion || version > maxVersion) { +#ifndef NDEBUG kDebug() << "plugin is compiled against incompatible Plasma version " << version << "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion << ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")"; +#endif return false; } diff --git a/view.cpp b/view.cpp index 7c6769635..34a103889 100644 --- a/view.cpp +++ b/view.cpp @@ -77,9 +77,11 @@ public: return; } +#ifndef NDEBUG kDebug() << "!!!!!!!!!!!!!!!!! setting the scene rect to" << containment->sceneBoundingRect() << "associated screen is" << containment->screen(); +#endif emit q->sceneRectAboutToChange(); if (q->transform().isIdentity()) { //we're not zoomed out @@ -288,7 +290,9 @@ void View::setContainment(Plasma::Containment *containment) /* if (oldContainment) { +#ifndef NDEBUG kDebug() << "old" << (QObject*)oldContainment << screen << oldContainment->screen() +#endif << "new" << (QObject*)containment << otherScreen << containment->screen(); } */ diff --git a/wallpaper.cpp b/wallpaper.cpp index bb96e2162..2baeae676 100644 --- a/wallpaper.cpp +++ b/wallpaper.cpp @@ -150,7 +150,9 @@ KPluginInfo::List Wallpaper::listWallpaperInfoForMimetype(const QString &mimeTyp } KService::List offers = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint); +#ifndef NDEBUG kDebug() << offers.count() << constraint; +#endif return KPluginInfo::fromServices(offers); } @@ -170,7 +172,9 @@ Wallpaper *Wallpaper::load(const QString &wallpaperName, const QVariantList &arg KService::List offers = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint); if (offers.isEmpty()) { +#ifndef NDEBUG kDebug() << "offers is empty for " << wallpaperName; +#endif return 0; } @@ -179,8 +183,10 @@ Wallpaper *Wallpaper::load(const QString &wallpaperName, const QVariantList &arg allArgs << offer->storageId() << args; if (!offer->property("X-Plasma-API").toString().isEmpty()) { +#ifndef NDEBUG kDebug() << "we have a script using the" << offer->property("X-Plasma-API").toString() << "API"; +#endif return new WallpaperWithPaint(0, allArgs); } @@ -194,7 +200,9 @@ Wallpaper *Wallpaper::load(const QString &wallpaperName, const QVariantList &arg Wallpaper *wallpaper = offer->createInstance(0, allArgs, &error); if (!wallpaper) { +#ifndef NDEBUG kDebug() << "Couldn't load wallpaper \"" << wallpaperName << "\"! reason given: " << error; +#endif } return wallpaper; @@ -452,8 +460,10 @@ WallpaperPrivate::WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) } if (!script) { +#ifndef NDEBUG kDebug() << "Could not create a" << api << "ScriptEngine for the" - << wallpaperDescription.name() << "Wallpaper."; + << wallpaperDescription.name() << "Wallpaper."; +#endif delete package; package = 0; } @@ -477,7 +487,9 @@ QString WallpaperPrivate::cachePath(const QString &key) const void WallpaperPrivate::newRenderCompleted(const WallpaperRenderRequest &request, const QImage &image) { +#ifndef NDEBUG kDebug() << request.token << renderToken; +#endif if (request.token != renderToken) { //kDebug() << "render token mismatch" << token << renderToken; return; @@ -496,8 +508,10 @@ void WallpaperPrivate::newRenderCompleted(const WallpaperRenderRequest &request, void WallpaperPrivate::setupScriptSupport() { Q_ASSERT(package); +#ifndef NDEBUG kDebug() << "setting up script support, package is in" << package->path() << ", main script is" << package->filePath("mainscript"); +#endif const QString translationsPath = package->filePath("translations"); if (!translationsPath.isEmpty()) { diff --git a/widgets/declarativewidget.cpp b/widgets/declarativewidget.cpp index fd4b4e0f7..80472c8e8 100644 --- a/widgets/declarativewidget.cpp +++ b/widgets/declarativewidget.cpp @@ -88,7 +88,9 @@ void DeclarativeWidgetPrivate::errorPrint() void DeclarativeWidgetPrivate::execute(const QString &fileName) { if (fileName.isEmpty()) { +#ifndef NDEBUG kDebug() << "File name empty!"; +#endif return; } @@ -130,7 +132,9 @@ void DeclarativeWidgetPrivate::finishExecute() errorPrint(); } +#ifndef NDEBUG kDebug() << "Execution of QML done!"; +#endif QGraphicsWidget *widget = dynamic_cast(root); QGraphicsObject *object = dynamic_cast(root); diff --git a/widgets/iconwidget.cpp b/widgets/iconwidget.cpp index b7c99de2d..6b7e6087f 100644 --- a/widgets/iconwidget.cpp +++ b/widgets/iconwidget.cpp @@ -416,7 +416,9 @@ void IconWidget::addIconAction(QAction *action) { int count = d->cornerActions.count(); if (count >= IconWidgetPrivate::LastIconPosition) { +#ifndef NDEBUG kDebug() << "no more room for more actions!"; +#endif // just overlap it with the last item for now. ugly, but there you go. } diff --git a/widgets/signalplotter.cpp b/widgets/signalplotter.cpp index aa132dd57..87df376e6 100644 --- a/widgets/signalplotter.cpp +++ b/widgets/signalplotter.cpp @@ -184,9 +184,13 @@ void SignalPlotter::addSample(const QList& sampleBuf) if (d->samples < 4) { // It might be possible, under some race conditions, for addSample // to be called before d->samples is set. This is just to be safe. +#ifndef NDEBUG kDebug() << "Error - d->samples is only " << d->samples; +#endif updateDataBuffers(); +#ifndef NDEBUG kDebug() << "d->samples is now " << d->samples; +#endif if (d->samples < 4) { return; } @@ -222,14 +226,18 @@ void SignalPlotter::addSample(const QList& sampleBuf) void SignalPlotter::reorderPlots(const QList& newOrder) { if (newOrder.count() != d->plotColors.count()) { +#ifndef NDEBUG kDebug() << "neworder has " << newOrder.count() << " and plot colors is " << d->plotColors.count(); +#endif return; } foreach (QList data, d->plotData) { if (newOrder.count() != data.count()) { +#ifndef NDEBUG kDebug() << "Serious problem in move sample. plotdata[i] has " << data.count() << " and neworder has " << newOrder.count(); +#endif } else { QList newPlot; for (int i = 0; i < newOrder.count(); i++) {