void ProgressListDelegate::slotClearClicked()
{
    const QModelIndex index = focusedIndex();
    JobView *jobView = index.model()->data(index, JobView::JobViewRole).value<JobView*>();
    if (jobView) {
        jobView->terminate(QString());
    }
}
void ProgressListDelegate::slotCancelClicked()
{
    const QModelIndex index = focusedIndex();
    JobView *jobView = index.model()->data(index, JobView::JobViewRole).value<JobView*>();
    if (jobView) {
        jobView->requestCancel();
    }
}
QDBusObjectPath KuiserverEngine::requestView(const QString &appName,
                                             const QString &appIconName, int capabilities)
{
    JobView *jobView = new JobView(this);
    jobView->setAppName(appName);
    jobView->setAppIconName(appIconName);
    jobView->setCapabilities(capabilities);
    connect(jobView, SIGNAL(becameUnused(QString)), this, SLOT(removeSource(QString)));

    m_pendingJobs << jobView;
    m_pendingJobsTimer.start();

    return jobView->objectPath();
}
Esempio n. 4
0
QDBusObjectPath JobViewServer::requestView(const QString &appName, const QString &appIconName, int capabilities) {
  QString objectPath = QString("/JobViewServer/JobView_%1").arg(++lastID);
  JobView* jobview = new JobView(objectPath, appName, appIconName, capabilities);
  Plasma::Meter* meter = new Plasma::Meter();
  meter->setMeterType(Plasma::Meter::BarMeterHorizontal);
  meter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  activeMeters.insert(jobview->objectPath(), meter);
  activeJobViews.insert(jobview->objectPath(), jobview);
  meterLayout->addItem(meter);
  jobViewLayout->addItem(jobview);
  connect(jobview, SIGNAL(progressChanged(uint)), this, SLOT(updateMeter(uint)));
  connect(jobview, SIGNAL(terminated()), this, SLOT(jobViewTerminated()));
  updateStatusIndicators();
  return QDBusObjectPath(objectPath);
}
void ProgressListDelegate::slotPauseResumeClicked()
{
    const QModelIndex index = focusedIndex();
    JobView *jobView = index.model()->data(index, JobView::JobViewRole).value<JobView*>();
    JobView::JobState state = (JobView::JobState) index.model()->data(index, JobView::State).toInt();
    if (jobView) {
        switch (state) {
        case JobView::Running:
            jobView->requestSuspend();
            break;
        case JobView::Suspended:
            jobView->requestResume();
            break;
        default:
            Q_ASSERT(0); // this point should have never been reached
            break;
        }
    }
}
Esempio n. 6
0
/**
 * Initialize this object.
 */
PakooView::PakooView( QWidget *parent )
    : DCOPObject("pakooIface"), QWidget(parent)
{
    m_backend = new PortageBackend();

    // Overall layout

    QHBoxLayout* topLayout = new QHBoxLayout( this );
    topLayout->setAutoAdd( true );

    m_hSplitter = new QSplitter( this );
    m_hSplitter->setOpaqueResize( true );

    QToolBox* toolBox = new QToolBox( m_hSplitter, "toolBox" );

    m_vSplitter = new QSplitter( m_hSplitter );
    m_vSplitter->setOrientation( QSplitter::Vertical );
    m_vSplitter->setOpaqueResize( true );


    // Adding the individual widgets

    m_treeView = new PackageTreeView( this, "treeView", m_backend );

    int sectionIndex = toolBox->addItem( m_treeView, TREEVIEWTEXT );
    m_sectionIndexes[sectionIndex] = BrowseSection;

    sectionIndex = toolBox->addItem(
                       new QLabel("Action View", 0, "tempactionlabel"), ACTIONVIEWTEXT );
    m_sectionIndexes[sectionIndex] = ActionSection;
    toolBox->setCurrentIndex( 1 );

    sectionIndex = toolBox->addItem(
                       new QLabel("Config View", 0, "tempconfiglabel"), CONFIGVIEWTEXT );
    m_sectionIndexes[sectionIndex] = ConfigSection;

    m_viewAreas = new QWidgetStack( m_vSplitter, "viewArea" );
    m_packageView = new PackageView( m_viewAreas, "packageView", m_backend );
    m_actionArea = new QWidgetStack( m_viewAreas, "actionArea" );
    JobView* jobView = new JobView( new EmergeProcess(), "title", m_actionArea, "jobView" );
    jobView->start();
    m_configArea = new QWidgetStack( m_viewAreas, "configArea" );
    new QLabel( "Config View", m_viewAreas, "configView" );
    m_viewAreas->raiseWidget( m_actionArea );

    m_packageInfoView = new PackageInfoView( m_vSplitter, "packageInfoView" );

    m_hSplitter->setResizeMode( toolBox, QSplitter::KeepSize );
    m_vSplitter->setResizeMode( m_packageInfoView->view(), QSplitter::KeepSize );

    m_vSplitter->setSizes( PakooConfig::vSplitterSizes() );
    m_hSplitter->setSizes( PakooConfig::hSplitterSizes() );


    //
    // Here comes the big connection creator
    //

    // Connect the QToolBox signals so the right side follows the left one
    connect(
        toolBox, SIGNAL( currentChanged(int) ),
        this,      SLOT( showSection(int) )
    );

    // Connect the package displaying widgets to work together
    connect(
        m_treeView,            SIGNAL( packageListChanged(PackageList&) ),
        m_packageView->listView, SLOT( setPackageList(PackageList&) )
    );
    connect(
        m_treeView,            SIGNAL( selectionChanged(PackageSelector&) ),
        m_packageView->listView, SLOT( setPackageSelector(PackageSelector&) )
    );
    connect(
        m_packageView->listView, SIGNAL( selectionChanged(Package*) ),
        m_packageInfoView, SLOT( displayPackage(Package*) )
    );
    connect(
        m_packageView->listView, SIGNAL(selectionChanged(Package*, PackageVersion*)),
        m_packageInfoView, SLOT(displayPackage(Package*, PackageVersion*))
    );

    // Connect the convenience method for copying text,
    // like pointed out by Scott Wheeler on the kde-core mailing list
    KStdAction::copy( KApplication::kApplication(), SLOT(copy()), NULL );

    // Connect the package list view with the status bar,
    // so the latter one is updated properly
    //TODO: adapt
    /*connect(
    	m_packageView->listView, SIGNAL(loadingPackageInfo(int,int)),
    	this, SLOT(handleLoadingPackageInfo(int,int))
    );
    connect(
    	m_packageView->listView, SIGNAL(finishedLoadingPackageDetails(PackageList&)),
    	this, SLOT(handleFinishedLoadingPackageDetails(PackageList&))
    );*/
}