void KCookiesManagement::save()
{
  // If delete all cookies was requested!
  if(mDeleteAllFlag)
  {
    QDBusInterface kded("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer", QDBusConnection::sessionBus());
    QDBusReply<void> reply = kded.call( "deleteAllCookies" );
    if (!reply.isValid())
    {
      QString caption = i18n ("D-Bus Communication Error");
      QString message = i18n ("Unable to delete all the cookies as requested.");
      KMessageBox::sorry (this, message, caption);
      return;
    }
    mDeleteAllFlag = false; // deleted[Cookies|Domains] have been cleared yet
  }

  // Certain groups of cookies were deleted...
  QMutableStringListIterator it (mDeletedDomains);
  while (it.hasNext())
  {    
    QDBusInterface kded("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer", QDBusConnection::sessionBus());
    QDBusReply<void> reply = kded.call( "deleteCookiesFromDomain",( it.next() ) );
    if (!reply.isValid())
    {
      QString caption = i18n ("D-Bus Communication Error");
      QString message = i18n ("Unable to delete cookies as requested.");
      KMessageBox::sorry (this, message, caption);
      return;
    }
    it.remove();
  }

  // Individual cookies were deleted...
  bool success = true; // Maybe we can go on...
  QMutableHashIterator<QString, CookiePropList> cookiesDom(mDeletedCookies);
  while(cookiesDom.hasNext())
  {
    cookiesDom.next();
    CookiePropList list = cookiesDom.value();
    foreach(CookieProp *cookie, list)
    {
      QDBusInterface kded("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer", QDBusConnection::sessionBus());
      QDBusReply<void> reply = kded.call( "deleteCookie", cookie->domain,
                                          cookie->host, cookie->path,
                                          cookie->name );
      if (!reply.isValid())
      {
        success = false;
        break;
      }

      list.removeOne(cookie);
    }

    if (!success)
      break;

    mDeletedCookies.remove(cookiesDom.key());
  }
Beispiel #2
0
int main(int argc, char *argv[])
{
   KLocalizedString description = ki18n("HTTP Cookie Daemon");

   const char version[] = "1.0";

   KCmdLineArgs::init(argc, argv, "kcookiejar", "kdelibs4", ki18n("HTTP cookie daemon"), version, description);

   KCmdLineOptions options;
   options.add("shutdown", ki18n("Shut down cookie jar"));
   options.add("remove <domain>", ki18n("Remove cookies for domain"));
   options.add("remove-all", ki18n("Remove all cookies"));
   options.add("reload-config", ki18n("Reload configuration file"));

   KCmdLineArgs::addCmdLineOptions( options );

   KComponentData a("kio4");

   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

   org::kde::KCookieServer *kcookiejar = new org::kde::KCookieServer("org.kde.kded", "/modules/kcookiejar", QDBusConnection::sessionBus());
   if (args->isSet("remove-all"))
   {
      kcookiejar->deleteAllCookies();
   }
   if (args->isSet("remove"))
   {
      QString domain = args->getOption("remove");
      kcookiejar->deleteCookiesFromDomain(domain);
   }
   if (args->isSet("shutdown"))
   {
      org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus());
      kded.unloadModule("kcookiejar");
   }
   else if(args->isSet("reload-config"))
   {
      kcookiejar->reloadPolicy();
   }
   else
   {
      org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus());
      kded.loadModule("kcookiejar");
   }
   delete kcookiejar;

   return 0;
}
Beispiel #3
0
void KSaveIOConfig::updateProxyScout(QWidget * parent)
{
  // Inform the proxyscout kded module about changes if we cannot update,
  // ioslaves inform the end user...
  QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/proxyscout"), QStringLiteral("org.kde.KPAC.ProxyScout"));
  QDBusReply<void> reply = kded.call(QStringLiteral("reset"));
  if (!reply.isValid())
  {
    KMessageBox::information (parent,
                              i18n("You have to restart KDE for these changes to take effect."),
                              i18nc("@title:window", "Update Failed"));
  }
}
Beispiel #4
0
void KSaveIOConfig::updateProxyScout( QWidget * parent )
{
  // Inform the proxyscout kded module about changes
  // if we cannot update, ioslaves inform the end user...
    QDBusInterface kded("org.kde.kded", "/modules/proxyscout", "org.kde.KPAC.ProxyScout");
    QDBusReply<void> reply = kded.call( "reset" );
  if (!reply.isValid())
  {
    QString caption = i18nc("@title:window", "Update Failed");
    QString message = i18n("You have to restart KDE "
                           "for these changes to take effect.");
    KMessageBox::information (parent, message, caption);
    return;
  }
}
Beispiel #5
0
void ManagerModule::save()
{
	KCModule::save();

	//Well... reloadBackends is buggy with HAL, it seems to be linked
	//to a bug in the unmaintained Qt3 DBUS binding ;-/
	//DCOPRef mediamanager( "kded", "mediamanager" );
	//DCOPReply reply = mediamanager.call( "reloadBackends" );
	
	// So we use this hack instead...
	DCOPRef kded( "kded", "kded" );
	kded.call( "unloadModule", "mediamanager" );
	kded.call( "loadModule", "mediamanager" );

	KDirNotify_stub notifier( "*", "*" );
	notifier.FilesAdded( "media:/" );
}
Beispiel #6
0
RecentDocuments::RecentDocuments(const QByteArray& pool, const QByteArray& app):
        ForwardingSlaveBase("recentdocuments", pool, app)
{
    QDBusInterface kded("org.kde.kded5", "/kded", "org.kde.kded5");
    kded.call("loadModule", "recentdocumentsnotifier");
}