void TagGuesserConfigDlg::slotAddClicked() { m_tagSchemeModel->insertRow(0, QModelIndex()); m_child->lvSchemes->setCurrentIndex(m_tagSchemeModel->index(0, 0, QModelIndex())); m_child->lvSchemes->edit(m_child->lvSchemes->currentIndex()); slotCurrentChanged(m_child->lvSchemes->currentIndex()); }
ResourceAppointmentsView::ResourceAppointmentsView(KoPart *part, KoDocument *doc, QWidget *parent) : ViewBase(part, doc, parent) { debugPlan<<"------------------- ResourceAppointmentsView -----------------------"; setupGui(); QVBoxLayout * l = new QVBoxLayout( this ); l->setMargin( 0 ); m_view = new ResourceAppointmentsTreeView( this ); l->addWidget( m_view ); m_view->setEditTriggers( m_view->editTriggers() | QAbstractItemView::EditKeyPressed ); connect( model(), SIGNAL(executeCommand(KUndo2Command*)), doc, SLOT(addCommand(KUndo2Command*)) ); connect( m_view, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex)) ); connect( m_view, SIGNAL(selectionChanged(QModelIndexList)), this, SLOT(slotSelectionChanged(QModelIndexList)) ); connect( m_view, SIGNAL(contextMenuRequested(QModelIndex,QPoint)), this, SLOT(slotContextMenuRequested(QModelIndex,QPoint)) ); connect( m_view, SIGNAL(headerContextMenuRequested(QPoint)), SLOT(slotHeaderContextMenuRequested(QPoint)) ); }
//----------------------------------- ResourceAllocationEditor::ResourceAllocationEditor(KoPart *part, KoDocument *doc, QWidget *parent) : ViewBase(part, doc, parent) { QVBoxLayout * l = new QVBoxLayout( this ); l->setMargin( 0 ); m_view = new ResourceAllocationTreeView( this ); l->addWidget( m_view ); setupGui(); m_view->setEditTriggers( m_view->editTriggers() | QAbstractItemView::EditKeyPressed ); QList<int> lst1; lst1 << 1 << -1; QList<int> lst2; lst2 << 0; m_view->hideColumns( lst1, lst2 ); m_view->masterView()->setDefaultColumns( QList<int>() << 0 ); QList<int> show; for ( int c = 1; c < model()->columnCount(); ++c ) { show << c; } m_view->slaveView()->setDefaultColumns( show ); connect( model(), SIGNAL(executeCommand(KUndo2Command*)), doc, SLOT(addCommand(KUndo2Command*)) ); connect( m_view, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex)) ); connect( m_view, SIGNAL(selectionChanged(QModelIndexList)), this, SLOT(slotSelectionChanged(QModelIndexList)) ); connect( m_view, SIGNAL(contextMenuRequested(QModelIndex,QPoint)), this, SLOT(slotContextMenuRequested(QModelIndex,QPoint)) ); connect( m_view, SIGNAL(headerContextMenuRequested(QPoint)), SLOT(slotHeaderContextMenuRequested(QPoint)) ); }
void ScriptManager::findScripts() //SLOT { const QStringList allFiles = kapp->dirs()->findAllResources( "data", "amarok/scripts/*", true ); // Add found scripts to listview: { foreach( allFiles ) if( QFileInfo( *it ).isExecutable() ) loadScript( *it ); } // Handle auto-run: KConfig* const config = amaroK::config( "ScriptManager" ); const QStringList runningScripts = config->readListEntry( "Running Scripts" ); { foreach( runningScripts ) if( m_scripts.contains( *it ) ) { debug() << "Auto-running script: " << *it << endl; m_gui->listView->setCurrentItem( m_scripts[*it].li ); slotRunScript(); } } m_gui->listView->setCurrentItem( m_gui->listView->firstChild() ); slotCurrentChanged( m_gui->listView->currentItem() ); }
TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name) : KDialog(parent) { setObjectName( QLatin1String( name ) ); setModal(true); setCaption(i18n("Tag Guesser Configuration")); setButtons(Ok | Cancel); setDefaultButton(Ok); showButtonSeparator(true); m_child = new TagGuesserConfigDlgWidget(this); setMainWidget(m_child); m_child->bMoveUp->setIcon(KIcon( QLatin1String( "arrow-up" ))); m_child->bMoveDown->setIcon(KIcon( QLatin1String( "arrow-down" ))); m_tagSchemeModel = new QStringListModel(m_child->lvSchemes); m_child->lvSchemes->setModel(m_tagSchemeModel); m_child->lvSchemes->setHeaderHidden(true); m_tagSchemeModel->setStringList(TagGuesser::schemeStrings()); connect(m_child->lvSchemes, SIGNAL(clicked(QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex))); connect(m_child->bMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUpClicked())); connect(m_child->bMoveDown, SIGNAL(clicked()), this, SLOT(slotMoveDownClicked())); connect(m_child->bAdd, SIGNAL(clicked()), this, SLOT(slotAddClicked())); connect(m_child->bModify, SIGNAL(clicked()), this, SLOT(slotModifyClicked())); connect(m_child->bRemove, SIGNAL(clicked()), this, SLOT(slotRemoveClicked())); resize( 400, 300 ); }
KLinkItemSelectionModel::KLinkItemSelectionModel(QAbstractItemModel *model, QItemSelectionModel *proxySelector, QObject *parent) : QItemSelectionModel(model, parent), d_ptr(new KLinkItemSelectionModelPrivate(this, model, proxySelector)) { connect(proxySelector, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(sourceSelectionChanged(QItemSelection,QItemSelection))); connect(proxySelector, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(sourceCurrentChanged(QModelIndex))); connect(this, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(slotCurrentChanged(QModelIndex))); }
KLinkItemSelectionModelPrivate(KLinkItemSelectionModel *proxySelectionModel) : q_ptr(proxySelectionModel) { QObject::connect(q_ptr, &QItemSelectionModel::currentChanged, q_ptr, [this](const QModelIndex& idx) { slotCurrentChanged(idx); } ); QObject::connect(q_ptr, &QItemSelectionModel::modelChanged, q_ptr, [this] { reinitializeIndexMapper(); }); }
KLinkItemSelectionModelPrivate(KLinkItemSelectionModel *proxySelectionModel) : q_ptr(proxySelectionModel), m_linkedItemSelectionModel(Q_NULLPTR), m_ignoreCurrentChanged(false), m_indexMapper(Q_NULLPTR) { QObject::connect(q_ptr, &QItemSelectionModel::currentChanged, q_ptr, [this](const QModelIndex& idx) { slotCurrentChanged(idx); } ); QObject::connect(q_ptr, &QItemSelectionModel::modelChanged, q_ptr, [this] { reinitializeIndexMapper(); }); }
void ScriptManager::slotStopScript() { QListViewItem* const li = m_gui->listView->currentItem(); const QString name = li->text( 0 ); // Just a sanity check if( m_scripts.find( name ) == m_scripts.end() ) return; terminateProcess( &m_scripts[name].process ); m_scripts[name].log = QString::null; slotCurrentChanged( m_gui->listView->currentItem() ); li->setPixmap( 0, QPixmap() ); }
void TagGuesserConfigDlg::slotMoveDownClicked() { QModelIndex currentItem = m_child->lvSchemes->currentIndex(); int row = currentItem.row(); m_tagSchemeModel->insertRow(row + 2); // Insert in front of 2 items below QModelIndex newItem = m_tagSchemeModel->index(row + 2, 0); // Copy over, then delete old item currentItem = m_tagSchemeModel->index(row, 0); m_tagSchemeModel->setData(newItem, m_tagSchemeModel->data(currentItem, Qt::DisplayRole), Qt::DisplayRole); m_tagSchemeModel->removeRow(row); newItem = m_tagSchemeModel->index(row + 1, 0); m_child->lvSchemes->setCurrentIndex(newItem); slotCurrentChanged(newItem); }
void TagGuesserConfigDlg::slotMoveUpClicked() { QModelIndex currentItem = m_child->lvSchemes->currentIndex(); int row = currentItem.row(); m_tagSchemeModel->insertRow(row - 1); // Insert in front of item above row++; // Now we're one row down QModelIndex newItem = m_tagSchemeModel->index(row - 2, 0); // Copy over, then delete old item currentItem = m_tagSchemeModel->index(row, 0); m_tagSchemeModel->setData(newItem, m_tagSchemeModel->data(currentItem, Qt::DisplayRole), Qt::DisplayRole); m_tagSchemeModel->removeRow(row); m_child->lvSchemes->setCurrentIndex(newItem); slotCurrentChanged(newItem); }
PrefCardAppearance::PrefCardAppearance(QWidget *parent) : QWidget(parent) { setupUi(this); connect(flipButton, SIGNAL(clicked()), this, SLOT(slotFlipButtonClicked())); connect(kcfg_FrontFont, SIGNAL(fontSelected(const QFont&)), this, SLOT(slotFontChanged(const QFont&))); connect(kcfg_FrontTextColor, SIGNAL(changed(const QColor&)), this, SLOT(slotTextColorChanged(const QColor&))); connect(kcfg_FrontCardColor, SIGNAL(changed(const QColor&)), this, SLOT(slotCardColorChanged(const QColor&))); connect(kcfg_FrontFrameColor, SIGNAL(changed(const QColor&)), this, SLOT(slotFrameColorChanged(const QColor&))); connect(kcfg_BackFont, SIGNAL(fontSelected(const QFont&)), this, SLOT(slotFontChanged(const QFont&))); connect(kcfg_BackTextColor, SIGNAL(changed(const QColor&)), this, SLOT(slotTextColorChanged(const QColor&))); connect(kcfg_BackCardColor, SIGNAL(changed(const QColor&)), this, SLOT(slotCardColorChanged(const QColor&))); connect(kcfg_BackFrameColor, SIGNAL(changed(const QColor&)), this, SLOT(slotFrameColorChanged(const QColor&))); connect(widgetStack, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); widgetStack->setCurrentWidget(frontStackPage); // initialize the buddies, etc. slotCurrentChanged(widgetStack->indexOf(frontStackPage)); }
bool EvaDetailsWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: slotUpdateClick(); break; case 1: slotDetailsUpdated((QStringList)(*((QStringList*)static_QUType_ptr.get(_o+1)))); break; case 2: slotUpdateQQShow(); break; case 3: slotFirstUpdate(); break; case 4: slotShopClicked(); break; case 5: slotAlbumClicked(); break; case 6: slotLinkClicked((const QString&)static_QUType_QString.get(_o+1)); break; case 7: slotBuddyQQShowReady((const unsigned int)(*((const unsigned int*)static_QUType_ptr.get(_o+1)))); break; case 8: slotCurrentChanged((QWidget*)static_QUType_ptr.get(_o+1)); break; case 9: slotDownloadMemo(); break; case 10: slotUpdateMemo((const MemoItem&)*((const MemoItem*)static_QUType_ptr.get(_o+1))); break; case 11: slotUploadMemoReply((const bool)static_QUType_bool.get(_o+1)); break; case 12: slotNoMemoFound(); break; default: return EvaUserUIBase::qt_invoke( _id, _o ); } return TRUE; }
bool EvaScriptManager::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: slotCurrentChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 1: static_QUType_bool.set(_o,slotInstallScript()); break; case 2: static_QUType_bool.set(_o,slotInstallScript((const QString&)static_QUType_QString.get(_o+1))); break; case 3: slotUninstallScript(); break; case 4: static_QUType_bool.set(_o,slotRunScript()); break; case 5: static_QUType_bool.set(_o,slotRunScript((bool)static_QUType_bool.get(_o+1))); break; case 6: slotStopScript(); break; case 7: slotConfigureScript(); break; case 8: slotAboutScript(); break; case 9: slotShowContextMenu((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2))); break; case 10: slotReceivedStdout((KProcess*)static_QUType_ptr.get(_o+1),(char*)static_QUType_charstar.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 11: slotReceivedStderr((KProcess*)static_QUType_ptr.get(_o+1),(char*)static_QUType_charstar.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 12: scriptFinished((KProcess*)static_QUType_ptr.get(_o+1)); break; default: return KDialogBase::qt_invoke( _id, _o ); } return TRUE; }
void ScriptManager::scriptFinished( KProcess* process ) //SLOT { // Look up script entry in our map ScriptMap::Iterator it; ScriptMap::Iterator end( m_scripts.end() ); for( it = m_scripts.begin(); it != end; ++it ) if( it.data().process == process ) break; // Check if there was an error on exit if( process->normalExit() && process->exitStatus() != 0 ) KMessageBox::detailedError( 0, i18n( "The script '%1' exited with error code: %2" ) .arg( it.key() ).arg( process->exitStatus() ) ,it.data().log ); // Destroy script process delete it.data().process; it.data().process = 0; it.data().log = QString::null; it.data().li->setPixmap( 0, QPixmap() ); slotCurrentChanged( m_gui->listView->currentItem() ); }
void TagGuesserConfigDlg::slotRemoveClicked() { m_tagSchemeModel->removeRow(m_child->lvSchemes->currentIndex().row(), QModelIndex()); slotCurrentChanged(m_child->lvSchemes->currentIndex()); }
void ProjectsEditDialog::refresh() { mModel->setRootList( Project::select() ); slotCurrentChanged( mTreeView->current() ); }
void UserEditDialog::refresh() { mModel->setRootList( User::select() ); slotCurrentChanged( mTreeView->current() ); }
GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p, QWidget *parent) : QDialog(parent) , m_parameters(p) , m_filterModel(new QSortFilterProxyModel(this)) , m_model(new GerritModel(p, this)) , m_queryModel(new QStringListModel(this)) , m_treeView(new Utils::TreeView) , m_detailsBrowser(new QTextBrowser) , m_queryLineEdit(new Utils::FancyLineEdit) , m_filterLineEdit(new Utils::FancyLineEdit) , m_repositoryChooser(new Utils::PathChooser) , m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Close)) , m_repositoryChooserLabel(new QLabel(tr("Apply in:") + QLatin1Char(' '), this)) , m_fetchRunning(false) { setWindowTitle(tr("Gerrit %1@%2").arg(p->user, p->host)); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QGroupBox *changesGroup = new QGroupBox(tr("Changes")); QVBoxLayout *changesLayout = new QVBoxLayout(changesGroup); changesLayout->setMargin(layoutSpacing); QHBoxLayout *filterLayout = new QHBoxLayout; QLabel *queryLabel = new QLabel(tr("&Query:")); queryLabel->setBuddy(m_queryLineEdit); m_queryLineEdit->setFixedWidth(400); m_queryLineEdit->setPlaceholderText(tr("Change #, SHA-1, tr:id, owner:email or reviewer:email")); m_queryModel->setStringList(m_parameters->savedQueries); QCompleter *completer = new QCompleter(this); completer->setModel(m_queryModel); m_queryLineEdit->setSpecialCompleter(completer); m_queryLineEdit->setOkColor(Utils::creatorTheme()->color(Utils::Theme::TextColorNormal)); m_queryLineEdit->setErrorColor(Utils::creatorTheme()->color(Utils::Theme::TextColorError)); m_queryLineEdit->setValidationFunction([this](Utils::FancyLineEdit *, QString *) { return m_model->state() != GerritModel::Error; }); filterLayout->addWidget(queryLabel); filterLayout->addWidget(m_queryLineEdit); filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored)); m_filterLineEdit->setFixedWidth(300); m_filterLineEdit->setFiltering(true); filterLayout->addWidget(m_filterLineEdit); connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged, m_filterModel, &QSortFilterProxyModel::setFilterFixedString); connect(m_queryLineEdit, &QLineEdit::returnPressed, this, &GerritDialog::slotRefresh); connect(m_model, &GerritModel::stateChanged, m_queryLineEdit, &Utils::FancyLineEdit::validate); m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); changesLayout->addLayout(filterLayout); changesLayout->addWidget(m_treeView); m_filterModel->setSourceModel(m_model); m_filterModel->setFilterRole(GerritModel::FilterRole); m_filterModel->setSortRole(GerritModel::SortRole); m_treeView->setRootIsDecorated(true); m_treeView->setModel(m_filterModel); m_treeView->setMinimumWidth(600); m_treeView->setUniformRowHeights(true); m_treeView->setRootIsDecorated(false); m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows); m_treeView->setSortingEnabled(true); m_treeView->setActivationMode(Utils::DoubleClickActivation); connect(&m_progressIndicatorTimer, &QTimer::timeout, [this]() { setProgressIndicatorVisible(true); }); m_progressIndicatorTimer.setSingleShot(true); m_progressIndicatorTimer.setInterval(50); // don't show progress for < 50ms tasks m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicator::Large, m_treeView); m_progressIndicator->attachToWidget(m_treeView->viewport()); m_progressIndicator->hide(); connect(m_model, &GerritModel::stateChanged, this, &GerritDialog::manageProgressIndicator); QItemSelectionModel *selectionModel = m_treeView->selectionModel(); connect(selectionModel, &QItemSelectionModel::currentChanged, this, &GerritDialog::slotCurrentChanged); connect(m_treeView, &QAbstractItemView::activated, this, &GerritDialog::slotActivated); QGroupBox *detailsGroup = new QGroupBox(tr("Details")); QVBoxLayout *detailsLayout = new QVBoxLayout(detailsGroup); detailsLayout->setMargin(layoutSpacing); m_detailsBrowser->setOpenExternalLinks(true); m_detailsBrowser->setTextInteractionFlags(Qt::TextBrowserInteraction); detailsLayout->addWidget(m_detailsBrowser); m_repositoryChooser->setExpectedKind(Utils::PathChooser::Directory); m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History")); QHBoxLayout *repoPathLayout = new QHBoxLayout; repoPathLayout->addWidget(m_repositoryChooserLabel); repoPathLayout->addWidget(m_repositoryChooser); detailsLayout->addLayout(repoPathLayout); m_displayButton = addActionButton(tr("&Show"), [this]() { slotFetchDisplay(); }); m_cherryPickButton = addActionButton(tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); }); m_checkoutButton = addActionButton(tr("C&heckout"), [this]() { slotFetchCheckout(); }); m_refreshButton = addActionButton(tr("&Refresh"), [this]() { slotRefresh(); }); connect(m_model, &GerritModel::refreshStateChanged, m_refreshButton, &QWidget::setDisabled); connect(m_model, &GerritModel::refreshStateChanged, this, &GerritDialog::slotRefreshStateChanged); connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); QSplitter *splitter = new QSplitter(Qt::Vertical, this); splitter->addWidget(changesGroup); splitter->addWidget(detailsGroup); splitter->setSizes(QList<int>() << 400 << 200); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(splitter); mainLayout->addWidget(m_buttonBox); slotCurrentChanged(); slotRefresh(); resize(QSize(950, 600)); m_treeView->setFocus(); m_refreshButton->setDefault(true); }
KDirSelectDialog::KDirSelectDialog(const KUrl &startDir, bool localOnly, QWidget *parent) : KDialog( parent ), d( new Private( localOnly, this ) ) { setCaption( i18nc("@title:window","Select Folder") ); setButtons( Ok | Cancel | User1 ); setButtonGuiItem( User1, KGuiItem( i18nc("@action:button","New Folder..."), "folder-new" ) ); setDefaultButton(Ok); button(Ok)->setFocus(); QFrame *page = new QFrame(this); setMainWidget(page); QHBoxLayout *hlay = new QHBoxLayout( page); hlay->setMargin(0); QVBoxLayout *mainLayout = new QVBoxLayout(); d->m_actions=new KActionCollection(this); d->m_actions->addAssociatedWidget(this); d->m_placesView = new KFilePlacesView( page ); d->m_placesView->setModel(new KFilePlacesModel(d->m_placesView)); d->m_placesView->setObjectName( QLatin1String( "speedbar" ) ); d->m_placesView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); d->m_placesView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); connect( d->m_placesView, SIGNAL(urlChanged(KUrl)), SLOT(setCurrentUrl(KUrl)) ); hlay->addWidget( d->m_placesView ); hlay->addLayout( mainLayout ); d->m_treeView = new KFileTreeView(page); d->m_treeView->setDirOnlyMode(true); d->m_treeView->setContextMenuPolicy(Qt::CustomContextMenu); for (int i = 1; i < d->m_treeView->model()->columnCount(); ++i) d->m_treeView->hideColumn(i); d->m_urlCombo = new KHistoryComboBox( page); d->m_urlCombo->setLayoutDirection( Qt::LeftToRight ); d->m_urlCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); d->m_urlCombo->setTrapReturnKey( true ); KUrlCompletion *comp = new KUrlCompletion(); comp->setMode( KUrlCompletion::DirCompletion ); d->m_urlCombo->setCompletionObject( comp, true ); d->m_urlCombo->setAutoDeleteCompletionObject( true ); d->m_urlCombo->setDuplicatesEnabled( false ); d->m_contextMenu = new KMenu( this ); KAction* newFolder = new KAction( i18nc("@action:inmenu","New Folder..."), this); d->m_actions->addAction( newFolder->objectName(), newFolder ); newFolder->setIcon( KIcon( "folder-new" ) ); newFolder->setShortcut( Qt::Key_F10); connect( newFolder, SIGNAL(triggered(bool)), this, SLOT(slotNewFolder()) ); d->m_contextMenu->addAction( newFolder ); d->moveToTrash = new KAction( i18nc( "@action:inmenu","Move to Trash" ), this ); d->m_actions->addAction( d->moveToTrash->objectName(), d->moveToTrash ); d->moveToTrash->setIcon( KIcon( "user-trash" ) ); d->moveToTrash->setShortcut(KShortcut(Qt::Key_Delete)); connect( d->moveToTrash, SIGNAL(triggered(bool)), this, SLOT(slotMoveToTrash()) ); d->m_contextMenu->addAction( d->moveToTrash ); d->deleteAction = new KAction( i18nc("@action:inmenu","Delete"), this ); d->m_actions->addAction( d->deleteAction->objectName(), d->deleteAction ); d->deleteAction->setIcon( KIcon( "edit-delete" ) ); d->deleteAction->setShortcut( KShortcut( Qt::SHIFT + Qt::Key_Delete ) ); connect( d->deleteAction, SIGNAL(triggered(bool)), this, SLOT(slotDelete()) ); d->m_contextMenu->addAction( d->deleteAction ); d->m_contextMenu->addSeparator(); d->showHiddenFoldersAction = new KToggleAction( i18nc("@option:check", "Show Hidden Folders"), this ); d->m_actions->addAction( d->showHiddenFoldersAction->objectName(), d->showHiddenFoldersAction ); d->showHiddenFoldersAction->setShortcut( Qt::Key_F8 ); connect( d->showHiddenFoldersAction, SIGNAL(triggered(bool)), d->m_treeView, SLOT(setShowHiddenFiles(bool)) ); d->m_contextMenu->addAction( d->showHiddenFoldersAction ); d->m_contextMenu->addSeparator(); KAction* propertiesAction = new KAction( i18nc("@action:inmenu","Properties"), this); d->m_actions->addAction(propertiesAction->objectName(), propertiesAction); propertiesAction->setIcon(KIcon("document-properties")); propertiesAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_Return)); connect( propertiesAction, SIGNAL(triggered(bool)), this, SLOT(slotProperties()) ); d->m_contextMenu->addAction( propertiesAction ); d->m_startURL = KFileDialog::getStartUrl( startDir, d->m_recentDirClass ); if ( localOnly && !d->m_startURL.isLocalFile() ) { d->m_startURL = KUrl(); QString docPath = KGlobalSettings::documentPath(); if (QDir(docPath).exists()) d->m_startURL.setPath( docPath ); else d->m_startURL.setPath( QDir::homePath() ); } d->m_startDir = d->m_startURL; d->m_rootUrl = d->m_treeView->rootUrl(); d->readConfig( KGlobal::config(), "DirSelect Dialog" ); mainLayout->addWidget( d->m_treeView, 1 ); mainLayout->addWidget( d->m_urlCombo, 0 ); connect( d->m_treeView, SIGNAL(currentChanged(KUrl)), SLOT(slotCurrentChanged())); connect( d->m_treeView, SIGNAL(activated(QModelIndex)), SLOT(slotExpand(QModelIndex))); connect( d->m_treeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotContextMenuRequested(QPoint))); connect( d->m_urlCombo, SIGNAL(editTextChanged(QString)), SLOT(slotComboTextChanged(QString))); connect( d->m_urlCombo, SIGNAL(activated(QString)), SLOT(slotUrlActivated(QString))); connect( d->m_urlCombo, SIGNAL(returnPressed(QString)), SLOT(slotUrlActivated(QString))); connect(this, SIGNAL(user1Clicked()), this, SLOT(slotNewFolder())); setCurrentUrl(d->m_startURL); }
bool ScriptManager::slotRunScript( bool silent ) { if( !m_gui->runButton->isEnabled() ) return false; QListViewItem* const li = m_gui->listView->currentItem(); const QString name = li->text( 0 ); if( m_scripts[name].type == "lyrics" && lyricsScriptRunning() != QString::null ) { if( !silent ) KMessageBox::sorry( 0, i18n( "Another lyrics script is already running. " "You may only run one lyrics script at a time." ) ); return false; } if( m_scripts[name].type == "transcode" && transcodeScriptRunning() != QString::null ) { if( !silent ) KMessageBox::sorry( 0, i18n( "Another transcode script is already running. " "You may only run one transcode script at a time." ) ); return false; } // Don't start a script twice if( m_scripts[name].process ) return false; AmaroKProcIO* script = new AmaroKProcIO(); script->setComm( static_cast<KProcess::Communication>( KProcess::All ) ); const KURL url = m_scripts[name].url; *script << url.path(); script->setWorkingDirectory( amaroK::saveLocation( "scripts-data/" ) ); connect( script, SIGNAL( receivedStderr( KProcess*, char*, int ) ), SLOT( slotReceivedStderr( KProcess*, char*, int ) ) ); connect( script, SIGNAL( receivedStdout( KProcess*, char*, int ) ), SLOT( slotReceivedStdout( KProcess*, char*, int ) ) ); connect( script, SIGNAL( processExited( KProcess* ) ), SLOT( scriptFinished( KProcess* ) ) ); if( script->start( KProcess::NotifyOnExit ) ) { if( m_scripts[name].type == "score" && !scoreScriptRunning().isNull() ) { stopScript( scoreScriptRunning() ); m_gui->listView->setCurrentItem( li ); } AmarokConfig::setLastScoreScript( name ); } else { if( !silent ) KMessageBox::sorry( 0, i18n( "<p>Could not start the script <i>%1</i>.</p>" "<p>Please make sure that the file has execute (+x) permissions.</p>" ).arg( name ) ); delete script; return false; } li->setPixmap( 0, SmallIcon( amaroK::icon( "play" ) ) ); debug() << "Running script: " << url.path() << endl; m_scripts[name].process = script; slotCurrentChanged( m_gui->listView->currentItem() ); if( m_scripts[name].type == "lyrics" ) emit lyricsScriptChanged(); return true; }
View::View( Part *part, QWidget *parent, KActionCollection *collection ) : QStackedWidget( parent ), m_part( part ), m_scheduleActionGroup( new QActionGroup( this ) ), m_manager( 0 ) { m_readWrite = part->isReadWrite(); debugPlanWork<<m_readWrite; // Add sub views createViews(); // The menu items // ------ Edit actionRemoveSelectedPackages = new QAction(koIcon("edit-delete"), i18n("Remove Packages"), this); collection->addAction("package_remove_selected", actionRemoveSelectedPackages ); connect( actionRemoveSelectedPackages, SIGNAL(triggered(bool)), SLOT(slotRemoveSelectedPackages()) ); actionRemoveCurrentPackage = new QAction(koIcon("edit-delete"), i18n("Remove Package"), this); collection->addAction("package_remove_current", actionRemoveCurrentPackage ); connect( actionRemoveCurrentPackage, SIGNAL(triggered(bool)), SLOT(slotRemoveCurrentPackage()) ); actionViewList = new QAction(koIcon("view-list-tree"), i18n("List"), this); actionViewList->setToolTip( i18nc( "@info:tooltip", "Select task list" ) ); collection->addAction("view_list", actionViewList ); connect( actionViewList, SIGNAL(triggered(bool)), SLOT(slotViewList()) ); actionViewGantt = new QAction(koIcon("view-time-schedule"), i18n("Gantt"), this); actionViewGantt->setToolTip( i18nc( "@info:tooltip", "Select timeline" ) ); collection->addAction("view_gantt", actionViewGantt ); connect( actionViewGantt, SIGNAL(triggered(bool)), SLOT(slotViewGantt()) ); // actionTaskProgress = new QAction(koIcon("document-edit"), i18n("Progress..."), this); // collection->addAction("task_progress", actionTaskProgress ); // connect( actionTaskProgress, SIGNAL(triggered(bool)), SLOT(slotTaskProgress()) ); //------ Settings actionConfigure = new QAction(koIcon("configure"), i18n("Configure PlanWork..."), this); collection->addAction("configure", actionConfigure ); connect( actionConfigure, SIGNAL(triggered(bool)), SLOT(slotConfigure()) ); //------ Popups actionEditDocument = new QAction(koIcon("document-edit"), i18n("Edit..."), this); collection->addAction("edit_document", actionEditDocument ); connect( actionEditDocument, SIGNAL(triggered(bool)), SLOT(slotEditDocument()) ); actionViewDocument = new QAction(koIcon("document-preview"), i18nc( "@verb", "View..."), this); collection->addAction("view_document", actionViewDocument ); connect( actionViewDocument, SIGNAL(triggered(bool)), SLOT(slotViewDocument()) ); // FIXME remove UndoText::removeDocument() when string freeze is lifted actionRemoveDocument = new QAction(koIcon("list-remove"), UndoText::removeDocument().toString(), this); collection->addAction("remove_document", actionRemoveDocument ); connect( actionRemoveDocument, SIGNAL(triggered(bool)), SLOT(slotRemoveDocument()) ); actionSendPackage = new QAction(koIcon("mail-send"), i18n("Send Package..."), this); collection->addAction("edit_sendpackage", actionSendPackage ); connect( actionSendPackage, SIGNAL(triggered(bool)), SLOT(slotSendPackage()) ); actionPackageSettings = new QAction(koIcon("document-properties"), i18n("Package Settings..."), this); collection->addAction("edit_packagesettings", actionPackageSettings ); connect( actionPackageSettings, SIGNAL(triggered(bool)), SLOT(slotPackageSettings()) ); actionTaskCompletion = new QAction(koIcon("document-edit"), i18n("Edit Progress..."), this); collection->addAction("task_progress", actionTaskCompletion ); connect( actionTaskCompletion, SIGNAL(triggered(bool)), SLOT(slotTaskCompletion()) ); actionViewDescription = new QAction(/*koIcon("document_view"),*/ i18n("View Description..."), this); collection->addAction("task_description", actionViewDescription ); connect( actionViewDescription, SIGNAL(triggered(bool)), SLOT(slotTaskDescription()) ); updateReadWrite( m_readWrite ); //debugPlanWork<<" end"; loadContext(); slotCurrentChanged( currentIndex() ); connect( this, SIGNAL(currentChanged(int)), SLOT(slotCurrentChanged(int)) ); slotSelectionChanged(); }
GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p, const QSharedPointer<GerritServer> &s, const QString &repository, QWidget *parent) : QDialog(parent) , m_parameters(p) , m_server(s) , m_filterModel(new QSortFilterProxyModel(this)) , m_ui(new Ui::GerritDialog) , m_model(new GerritModel(p, this)) , m_queryModel(new QStringListModel(this)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->setupUi(this); m_ui->remoteComboBox->setParameters(m_parameters); m_ui->remoteComboBox->setFallbackEnabled(true); m_queryModel->setStringList(m_parameters->savedQueries); QCompleter *completer = new QCompleter(this); completer->setModel(m_queryModel); m_ui->queryLineEdit->setSpecialCompleter(completer); m_ui->queryLineEdit->setOkColor(Utils::creatorTheme()->color(Utils::Theme::TextColorNormal)); m_ui->queryLineEdit->setErrorColor(Utils::creatorTheme()->color(Utils::Theme::TextColorError)); m_ui->queryLineEdit->setValidationFunction([this](Utils::FancyLineEdit *, QString *) { return m_model->state() != GerritModel::Error; }); m_ui->filterLineEdit->setFiltering(true); connect(m_ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged, m_filterModel, &QSortFilterProxyModel::setFilterFixedString); connect(m_ui->queryLineEdit, &QLineEdit::returnPressed, this, &GerritDialog::refresh); connect(m_model, &GerritModel::stateChanged, m_ui->queryLineEdit, &Utils::FancyLineEdit::validate); connect(m_ui->remoteComboBox, &GerritRemoteChooser::remoteChanged, this, &GerritDialog::remoteChanged); m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_filterModel->setSourceModel(m_model); m_filterModel->setFilterRole(GerritModel::FilterRole); m_filterModel->setSortRole(GerritModel::SortRole); m_ui->treeView->setModel(m_filterModel); m_ui->treeView->setActivationMode(Utils::DoubleClickActivation); connect(&m_progressIndicatorTimer, &QTimer::timeout, [this]() { setProgressIndicatorVisible(true); }); m_progressIndicatorTimer.setSingleShot(true); m_progressIndicatorTimer.setInterval(50); // don't show progress for < 50ms tasks m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicatorSize::Large, m_ui->treeView); m_progressIndicator->attachToWidget(m_ui->treeView->viewport()); m_progressIndicator->hide(); connect(m_model, &GerritModel::stateChanged, this, &GerritDialog::manageProgressIndicator); QItemSelectionModel *selectionModel = m_ui->treeView->selectionModel(); connect(selectionModel, &QItemSelectionModel::currentChanged, this, &GerritDialog::slotCurrentChanged); connect(m_ui->treeView, &QAbstractItemView::activated, this, &GerritDialog::slotActivated); m_displayButton = addActionButton(tr("&Show"), [this]() { slotFetchDisplay(); }); m_cherryPickButton = addActionButton(tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); }); m_checkoutButton = addActionButton(tr("C&heckout"), [this]() { slotFetchCheckout(); }); m_refreshButton = addActionButton(tr("&Refresh"), [this]() { refresh(); }); connect(m_model, &GerritModel::refreshStateChanged, m_refreshButton, &QWidget::setDisabled); connect(m_model, &GerritModel::refreshStateChanged, this, &GerritDialog::slotRefreshStateChanged); connect(m_model, &GerritModel::errorText, this, [this](const QString &text) { if (text.contains("returned error: 401")) updateRemotes(true); }, Qt::QueuedConnection); setCurrentPath(repository); slotCurrentChanged(); m_ui->treeView->setFocus(); m_refreshButton->setDefault(true); }