Beispiel #1
0
DCOPRef KWordDocIface::frameSet( int num )
{
    if( num>= (int)doc->frameSetCount())
        return DCOPRef();
    return DCOPRef( kapp->dcopClient()->appId(),
            doc->frameSet( num)->dcopObject()->objId() );
}
Beispiel #2
0
DCOPRef KateAppDCOPIface::mainWindow (uint n)
{
  KateMainWindow *win = m_app->mainWindow(n);

  if (win)
    return DCOPRef (win->dcopObject ());

  return DCOPRef ();
}
Beispiel #3
0
DCOPRef KateAppDCOPIface::activeMainWindow ()
{
  KateMainWindow *win = m_app->activeMainWindow();

  if (win)
    return DCOPRef (win->dcopObject ());

  return DCOPRef ();
}
bool KCookiesManagement::cookieDetails(CookieProp *cookie)
{
    QValueList< int > fields;
    fields << 4 << 5 << 7;

    DCOPReply reply = DCOPRef("kded", "kcookiejar")
                          .call("findCookies", DCOPArg(fields, "QValueList<int>"), cookie->domain, cookie->host, cookie->path, cookie->name);
    if(!reply.isValid())
        return false;

    QStringList fieldVal = reply;

    QStringList::Iterator c = fieldVal.begin();
    cookie->value = *c++;
    unsigned tmp = (*c++).toUInt();

    if(tmp == 0)
        cookie->expireDate = i18n("End of session");
    else
    {
        QDateTime expDate;
        expDate.setTime_t(tmp);
        cookie->expireDate = KGlobal::locale()->formatDateTime(expDate);
    }

    tmp = (*c).toUInt();
    cookie->secure = i18n(tmp ? "Yes" : "No");
    cookie->allLoaded = true;
    return true;
}
void KCookiesManagement::getCookies(QListViewItem *cookieDom)
{
    CookieListViewItem *ckd = static_cast< CookieListViewItem * >(cookieDom);
    if(ckd->cookiesLoaded())
        return;

    QValueList< int > fields;
    fields << 0 << 1 << 2 << 3;

    DCOPReply reply = DCOPRef("kded", "kcookiejar")
                          .call("findCookies", DCOPArg(fields, "QValueList<int>"), ckd->domain(), QString::null, QString::null, QString::null);
    if(reply.isValid())
    {
        QStringList fieldVal = reply;
        QStringList::Iterator fIt = fieldVal.begin();

        while(fIt != fieldVal.end())
        {
            CookieProp *details = new CookieProp;
            details->domain = *fIt++;
            details->path = *fIt++;
            details->name = *fIt++;
            details->host = *fIt++;
            details->allLoaded = false;
            new CookieListViewItem(cookieDom, details);
        }

        static_cast< CookieListViewItem * >(cookieDom)->setCookiesLoaded();
    }
}
void KCookiesManagement::getDomains()
{
    DCOPReply reply = DCOPRef("kded", "kcookiejar").call("findDomains");

    if(!reply.isValid())
    {
        QString caption = i18n("Information Lookup Failure");
        QString message = i18n(
            "Unable to retrieve information about the "
            "cookies stored on your computer.");
        KMessageBox::sorry(this, message, caption);
        return;
    }

    QStringList domains = reply;

    if(dlg->lvCookies->childCount())
    {
        reset();
        dlg->lvCookies->setCurrentItem(0L);
    }

    CookieListViewItem *dom;
    for(QStringList::Iterator dIt = domains.begin(); dIt != domains.end(); dIt++)
    {
        dom = new CookieListViewItem(dlg->lvCookies, *dIt);
        dom->setExpandable(true);
    }

    // are ther any cookies?
    dlg->pbDeleteAll->setEnabled(dlg->lvCookies->childCount());
}
Beispiel #7
0
void KSaveIOConfig::updateProxyScout( TQWidget * parent )
{
  // Inform the proxyscout kded module about changes
  // if we cannot update, ioslaves inform the end user...
  if (!DCOPRef("kded", "proxyscout").send("reset"))
  {
    TQString caption = i18n("Update Failed");
    TQString message = i18n("You have to restart TDE "
                           "for these changes to take effect.");
    KMessageBox::information (parent, message, caption);
    return;
  }
}
Beispiel #8
0
void KSaveIOConfig::updateRunningIOSlaves (TQWidget *parent)
{
  // Inform all running io-slaves about the changes...
  // if we cannot update, ioslaves inform the end user...
  if (!DCOPRef("*", "TDEIO::Scheduler").send("reparseSlaveConfiguration", TQString()))
  {
    TQString caption = i18n("Update Failed");
    TQString message = i18n("You have to restart the running applications "
                           "for these changes to take effect.");
    KMessageBox::information (parent, message, caption);
    return;
  }
}
Beispiel #9
0
QString KProtocolManager::proxyForURL(const KURL &url)
{
    QString proxy;
    ProxyType pt = proxyType();

    switch(pt)
    {
        case PACProxy:
        case WPADProxy:
            if(!url.host().isEmpty())
            {
                KURL u(url);
                QString p = u.protocol().lower();

                // webdav is a KDE specific protocol. Look up proxy
                // information using HTTP instead...
                if(p == "webdav")
                {
                    p = "http";
                    u.setProtocol(p);
                }
                else if(p == "webdavs")
                {
                    p = "https";
                    u.setProtocol(p);
                }

                if(p.startsWith("http") || p == "ftp" || p == "gopher")
                    DCOPRef("kded", "proxyscout").call("proxyForURL", u).get(proxy);
            }
            break;
        case EnvVarProxy:
            proxy = QString::fromLocal8Bit(getenv(proxyFor(url.protocol()).local8Bit())).stripWhiteSpace();
            break;
        case ManualProxy:
            proxy = proxyFor(url.protocol());
            break;
        case NoProxy:
        default:
            break;
    }

    return (proxy.isEmpty() ? QString::fromLatin1("DIRECT") : proxy);
}
Beispiel #10
0
void sendUserTime(const char *app)
{
#if defined Q_WS_X11
    static unsigned long time = 0;
    if(time == 0)
    {
        Display *dpy = XOpenDisplay(NULL);
        if(dpy != NULL)
        {
            Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0);
            XSelectInput(dpy, w, PropertyChangeMask);
            unsigned char data[1];
            XChangeProperty(dpy, w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1);
            XEvent ev;
            XWindowEvent(dpy, w, PropertyChangeMask, &ev);
            time = ev.xproperty.time;
            XDestroyWindow(dpy, w);
        }
    }
    DCOPRef(app, "MainApplication-Interface").call("updateUserTimestamp", time);
#else
// ...
#endif
}
void KCookiesManagement::save()
{
    // If delete all cookies was requested!
    if(m_bDeleteAll)
    {
        if(!DCOPRef("kded", "kcookiejar").send("deleteAllCookies"))
        {
            QString caption = i18n("DCOP Communication Error");
            QString message = i18n("Unable to delete all the cookies as requested.");
            KMessageBox::sorry(this, message, caption);
            return;
        }
        m_bDeleteAll = false; // deleted[Cookies|Domains] have been cleared yet
    }

    // Certain groups of cookies were deleted...
    QStringList::Iterator dIt = deletedDomains.begin();
    while(dIt != deletedDomains.end())
    {
        QByteArray call;
        QByteArray reply;
        QCString replyType;
        QDataStream callStream(call, IO_WriteOnly);
        callStream << *dIt;

        if(!DCOPRef("kded", "kcookiejar").send("deleteCookiesFromDomain", (*dIt)))
        {
            QString caption = i18n("DCOP Communication Error");
            QString message = i18n("Unable to delete cookies as requested.");
            KMessageBox::sorry(this, message, caption);
            return;
        }

        dIt = deletedDomains.remove(dIt);
    }

    // Individual cookies were deleted...
    bool success = true; // Maybe we can go on...
    QDictIterator< CookiePropList > cookiesDom(deletedCookies);

    while(cookiesDom.current())
    {
        CookiePropList *list = cookiesDom.current();
        QPtrListIterator< CookieProp > cookie(*list);

        while(*cookie)
        {
            if(!DCOPRef("kded", "kcookiejar").send("deleteCookie", (*cookie)->domain, (*cookie)->host, (*cookie)->path, (*cookie)->name))
            {
                success = false;
                break;
            }

            list->removeRef(*cookie);
        }

        if(!success)
            break;

        deletedCookies.remove(cookiesDom.currentKey());
    }

    emit changed(false);
}
Beispiel #12
0
int main(int argc, char **argv)
{
   KLocale::setMainCatalogue("kdelibs");
   const char *description = I18N_NOOP("KDE Menu query tool.\n"
   "This tool can be used to find in which menu a specific application is shown.\n"
   "The --highlight option can be used to visually indicate to the user where\n"
   "in the KDE menu a specific application is located.");
   
   KAboutData d(appName, I18N_NOOP("kde-menu"), appVersion,
                description,
                KAboutData::License_GPL, "(c) 2003 Waldo Bastian");
   d.addAuthor("Waldo Bastian", I18N_NOOP("Author"), "*****@*****.**");

   KCmdLineArgs::init(argc, argv, &d);
   KCmdLineArgs::addCmdLineOptions(options);

//   KApplication k(false, false);
   KApplication k(false);
   k.disableSessionManagement();

   // this program is in kdelibs so it uses kdelibs as catalog
   KLocale::setMainCatalogue("kdelibs");

   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
   if (args->count() != 1)
      KCmdLineArgs::usage(i18n("You must specify an application-id such as 'kde-konsole.desktop'"));

   utf8 = args->isSet("utf8");

   bPrintMenuId = args->isSet("print-menu-id");
   bPrintMenuName = args->isSet("print-menu-name");
   bHighlight = args->isSet("highlight");

   if (!bPrintMenuId && !bPrintMenuName && !bHighlight)
      KCmdLineArgs::usage(i18n("You must specify at least one of --print-menu-id, --print-menu-name or --highlight"));

   if (args->isSet("cache-update"))
   {
      QStringList args;
      args.append("--incremental");
      args.append("--checkstamps");
      QString command = "kbuildsycoca";
      QCString _launcher = KApplication::launcher();
      if (!DCOPRef(_launcher, _launcher).call("kdeinit_exec_wait", command, args).isValid())
      {
         qWarning("Can't talk to klauncher!");
         command = KGlobal::dirs()->findExe(command);
         command += " " + args.join(" ");
         system(command.local8Bit());
      }
   }

   QString menuId = QFile::decodeName(args->arg(0));
   KService::Ptr s = KService::serviceByMenuId(menuId);
   
   if (!s)
      error(1, i18n("No menu item '%1'.").arg(menuId));

   findMenuEntry(KServiceGroup::root(), "", menuId);

   error(2, i18n("Menu item '%1' not found in menu.").arg(menuId));
   return 2;
}
Beispiel #13
0
DCOPRef KateAppDCOPIface::documentManager ()
{
  return DCOPRef (m_app->documentManager()->dcopObject ());
}
Beispiel #14
0
static QString wallpaperForDesktop(int desktop)
{
    return DCOPRef("kdesktop", "KBackgroundIface").call("currentWallpaper", desktop);
}
Beispiel #15
0
void KProtocolManager::badProxy(const QString &proxy)
{
    DCOPRef("kded", "proxyscout").send("blackListProxy", proxy);
}
Beispiel #16
0
DCOPRef DocumentIface::viewToRef( View * view )
{
	return DCOPRef(); //  view->dcopObject() ); TODO
}
Beispiel #17
0
DCOPRef KMainWindowInterface::action(const QCString &name)
{
    return DCOPRef(kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId(name));
}
Beispiel #18
0
	/** are extentions available -> browser extension
	 * / TextEditor ? */
	DCOPRef queryExtension( const QCString& extension )
	{ printf("query Extension : %s\n", (const char * ) extension ); return DCOPRef(); } 
DCOPRef DocManagerIface::docToRef( Document * document )
{
	if (document)
		return DCOPRef(document->dcopObject());
	return DCOPRef();
}