Exemple #1
0
void IconApplet::showConfigurationInterface()
{
    KPropertiesDialog *dialog = m_dialog.data();
    m_configTarget = m_url;
    if (m_hasDesktopFile) {
        const QFileInfo fi(m_url.toLocalFile());
        if (!fi.isWritable()) {
            const QString suggestedName = fi.baseName();
            m_configTarget = KService::newServicePath(false, suggestedName);
            KIO::Job *job = KIO::file_copy(m_url, m_configTarget);
            job->exec();
        }
    }

    if (dialog) {
        KWindowSystem::setOnDesktop(dialog->winId(), KWindowSystem::currentDesktop());
        dialog->show();
        KWindowSystem::activateWindow(dialog->winId());
    } else {
        dialog = new KPropertiesDialog(m_configTarget, 0 /*no parent widget*/);
        m_dialog = dialog;
        connect(dialog, SIGNAL(applied()), this, SLOT(acceptedPropertiesDialog()));
        connect(dialog, SIGNAL(canceled()), this, SLOT(cancelledPropertiesDialog()));
        dialog->setAttribute(Qt::WA_DeleteOnClose, true);
        dialog->setWindowTitle(i18n("%1 Icon Settings", m_configTarget.fileName()));
        dialog->show();
    }
}
Exemple #2
0
void KDirSelectDialog::Private::slotProperties()
{
    KPropertiesDialog* dialog = 0;
    dialog = new KPropertiesDialog(m_treeView->selectedUrl(), this->m_parent);
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
}
Exemple #3
0
void ServiceButton::properties()
{
    if (!_service)
    {
        return;
    }

    QString path = _service->desktopEntryPath();

    // If the path to the desktop file is relative, try to get the full
    // path from KStdDirs.
    path = locate("apps", path);
    KURL serviceURL;
    serviceURL.setPath(path);

    // the KPropertiesDialog deletes itself, so this isn't a memory leak
    KPropertiesDialog* dialog = new KPropertiesDialog(serviceURL, 0, 0,
                                                      false, false);
    dialog->setFileNameReadOnly(true);
    connect(dialog, SIGNAL(saveAs(const KURL &, KURL &)),
            this, SLOT(slotSaveAs(const KURL &, KURL &)));
    connect(dialog, SIGNAL(propertiesClosed()),
            this, SLOT(slotUpdate()));
    dialog->show();
}
void LauncherApplet::slotShowPreferences()
{
    // Will delete itself...
    KPropertiesDialog *pDlg = new KPropertiesDialog(_fileItem, 0L, 0L, false, false);
    pDlg->setFileNameReadOnly(true);
    connect(pDlg, SIGNAL(applied()), SLOT(slotSettingsChanged()));
    pDlg->show();
}
Exemple #5
0
bool ClientApp::doIt()
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    const int argc = args->count();
    checkArgumentCount(argc, 1, 0);

    if ( !args->isSet( "ninteractive" ) ) {
        s_interactive = false;
        s_jobFlags = KIO::HideProgressInfo;
    }
#if !defined(KIOCLIENT_AS_KDEOPEN)
    if (args->isSet("overwrite")) {
        s_jobFlags |= KIO::Overwrite;
    }
#endif

    kDebug() << "Creating ClientApp";
    int fake_argc = 0;
    char** fake_argv = 0;
    ClientApp app( fake_argc, fake_argv );
    KComponentData componentData("kioclient"); // needed by KIO's internal use of KConfig
    app.setApplicationName(componentData.componentName());
    KGlobal::ref();
    KGlobal::setAllowQuit(true);

    // KIO needs dbus (for uiserver communication)
    extern void qDBusBindToApplication();
    qDBusBindToApplication();
    if (!QDBusConnection::sessionBus().isConnected())
        kFatal(101) << "Session bus not found" ;

#ifdef KIOCLIENT_AS_KDEOPEN
    return app.kde_open(args->url(0), QByteArray(), false);
#elif defined(KIOCLIENT_AS_KDECP)
    checkArgumentCount(argc, 2, 0);
    return app.doCopy(0);
#elif defined(KIOCLIENT_AS_KDEMV)
    checkArgumentCount(argc, 2, 0);
    return app.doMove(0);
#else
    // Normal kioclient mode
    const QByteArray command = args->arg(0).toLocal8Bit();
    if ( command == "openProperties" )
    {
        checkArgumentCount(argc, 2, 2); // openProperties <url>
        KPropertiesDialog * p = new KPropertiesDialog( args->url(1), 0 /*no parent*/ );
        QObject::connect( p, SIGNAL( destroyed() ), &app, SLOT( quit() ));
        QObject::connect( p, SIGNAL( canceled() ), &app, SLOT( slotDialogCanceled() ));
        p->show();
        app.exec();
        return m_ok;
    }
    else if ( command == "cat" )
    {
        checkArgumentCount(argc, 2, 2); // cat <url>
        KIO::TransferJob* job = KIO::get(args->url(1), KIO::NoReload, s_jobFlags);
        if ( !s_interactive )
            job->setUiDelegate( 0 );
        connect(job, SIGNAL(data(KIO::Job*,QByteArray) ), &app, SLOT(slotPrintData(KIO::Job*,QByteArray)));
        connect( job, SIGNAL( result( KJob * ) ), &app, SLOT( slotResult( KJob * ) ) );
        app.exec();
        return m_ok;
    }