void ProfileList::updateAction(QAction* action , Profile::Ptr info) { Q_ASSERT(action); Q_ASSERT(info); action->setText(info->name()); action->setIcon(KIcon(info->icon())); }
void ManageProfilesDialog::updateItemsForProfile(const Profile::Ptr profile, QList<QStandardItem*>& items) const { // Profile Name items[ProfileNameColumn]->setText(profile->name()); if (!profile->icon().isEmpty()) items[ProfileNameColumn]->setIcon(KIcon(profile->icon())); items[ProfileNameColumn]->setData(QVariant::fromValue(profile), ProfileKeyRole); items[ProfileNameColumn]->setToolTip(i18nc("@info:tooltip", "Click to rename profile")); // Favorite Status const bool isFavorite = ProfileManager::instance()->findFavorites().contains(profile); if (isFavorite) items[FavoriteStatusColumn]->setData(KIcon("dialog-ok-apply"), Qt::DecorationRole); else items[FavoriteStatusColumn]->setData(KIcon(), Qt::DecorationRole); items[FavoriteStatusColumn]->setData(QVariant::fromValue(profile), ProfileKeyRole); items[FavoriteStatusColumn]->setToolTip(i18nc("@info:tooltip", "Click to toggle status")); // Shortcut QString shortcut = ProfileManager::instance()->shortcut(profile).toString(); items[ShortcutColumn]->setText(shortcut); items[ShortcutColumn]->setData(QVariant::fromValue(profile), ShortcutRole); items[ShortcutColumn]->setToolTip(i18nc("@info:tooltip", "Double click to change shortcut")); }
void EditProfileDialog::setupGeneralPage(const Profile::Ptr info) { // basic profile options _ui->profileNameEdit->setText( info->name() ); ShellCommand command( info->command() , info->arguments() ); _ui->commandEdit->setText( command.fullCommand() ); KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion); exeCompletion->setParent(this); exeCompletion->setDir(QString()); _ui->commandEdit->setCompletionObject( exeCompletion ); _ui->initialDirEdit->setText( info->defaultWorkingDirectory() ); KUrlCompletion* dirCompletion = new KUrlCompletion(KUrlCompletion::DirCompletion); dirCompletion->setParent(this); _ui->initialDirEdit->setCompletionObject( dirCompletion ); _ui->initialDirEdit->setClearButtonShown(true); _ui->dirSelectButton->setIcon( KIcon("folder-open") ); _ui->iconSelectButton->setIcon( KIcon(info->icon()) ); _ui->startInSameDirButton->setChecked(info->property<bool>(Profile::StartInCurrentSessionDir)); // window options _ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) ); // signals and slots connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) ); connect( _ui->iconSelectButton , SIGNAL(clicked()) , this , SLOT(selectIcon()) ); connect( _ui->startInSameDirButton , SIGNAL(toggled(bool)) , this , SLOT(startInSameDir(bool))); connect( _ui->profileNameEdit , SIGNAL(textChanged(const QString&)) , this , SLOT(profileNameChanged(const QString&)) ); connect( _ui->initialDirEdit , SIGNAL(textChanged(const QString&)) , this , SLOT(initialDirChanged(const QString&)) ); connect(_ui->commandEdit , SIGNAL(textChanged(const QString&)) , this , SLOT(commandChanged(const QString&)) ); connect(_ui->showMenuBarButton , SIGNAL(toggled(bool)) , this , SLOT(showMenuBar(bool)) ); connect(_ui->environmentEditButton , SIGNAL(clicked()) , this , SLOT(showEnvironmentEditor()) ); }