int RecurrenceActions::questionSelectedAllCancel( const QString &message, const QString &caption, const KGuiItem &actionSelected, const KGuiItem &actionAll, QWidget *parent ) { KDialog *dialog = new KDialog( parent ); dialog->setCaption( caption ); dialog->setButtons( KDialog::Yes | KDialog::Ok | KDialog::Cancel ); dialog->setObjectName( "RecurrenceActions::questionSelectedAllCancel" ); dialog->setDefaultButton( KDialog::Yes ); dialog->setButtonGuiItem( KDialog::Yes, actionSelected ); dialog->setButtonGuiItem( KDialog::Ok, actionAll ); bool checkboxResult = false; int result = KMessageBox::createKMessageBox( dialog, QMessageBox::Question, message, QStringList(), QString(), &checkboxResult, KMessageBox::Notify ); switch (result) { case KDialog::Yes: return SelectedOccurrence; case QDialog::Accepted: // See kdialog.h, 'Ok' doesn't return KDialog:Ok return AllOccurrences; default: return NoOccurrence; } return NoOccurrence; }
bool KNewFileMenuPrivate::checkSourceExists(const QString& src) { if (!QFile::exists(src)) { kWarning(1203) << src << "doesn't exist" ; KDialog* dialog = new KDialog(m_parentWidget); dialog->setCaption( i18n("Sorry") ); dialog->setButtons( KDialog::Ok ); dialog->setObjectName( "sorry" ); dialog->setModal(q->isModal()); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setDefaultButton( KDialog::Ok ); dialog->setEscapeButton( KDialog::Ok ); KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, i18n("<qt>The template file <b>%1</b> does not exist.</qt>", src), QStringList(), QString(), 0, KMessageBox::NoExec, QString()); dialog->show(); return false; } return true; }
void ExtendedAboutDialog::Private::_k_showLicense( const QString &number ) { KDialog *dialog = new KDialog(q); dialog->setCaption(i18n("License Agreement")); dialog->setButtons(KDialog::Close); dialog->setDefaultButton(KDialog::Close); const QFont font = KGlobalSettings::fixedFont(); QFontMetrics metrics(font); const QString licenseText = aboutData->licenses().at(number.toInt()).text(); KTextBrowser *licenseBrowser = new KTextBrowser; licenseBrowser->setFont(font); licenseBrowser->setLineWrapMode(QTextEdit::NoWrap); licenseBrowser->setText(licenseText); dialog->setMainWidget(licenseBrowser); // try to set up the dialog such that the full width of the // document is visible without horizontal scroll-bars being required const qreal idealWidth = licenseBrowser->document()->idealWidth() + (2 * dialog->marginHint()) + licenseBrowser->verticalScrollBar()->width() * 2; // try to allow enough height for a reasonable number of lines to be shown const int idealHeight = metrics.height() * 30; dialog->setInitialSize(dialog->sizeHint().expandedTo(QSize((int)idealWidth,idealHeight))); dialog->show(); }
void FacebookContact::slotUserInfo() { KDialog infoDialog; infoDialog.setButtons( KDialog::Close); infoDialog.setDefaultButton(KDialog::Close); Ui::FacebookInfo info; info.setupUi(infoDialog.mainWidget()); info.m_displayName->setText(nickName()); info.m_personalMessage->setPlainText(statusMessage().message()); QVariant picture(property(Kopete::Global::Properties::self()->photo()).value()); info.m_photo->setPixmap(picture.value<QPixmap>()); infoDialog.setCaption(nickName()); infoDialog.exec(); }
void NotifyCollection::displayCollection( QWidget *p ) const { //KMessageBox::information(p,collection(),i18n("Collected Notes")); KDialog *dlg = new KDialog( p ); dlg->setCaption( i18n( "Collected Notes" ) ); dlg->setButtons( KDialog::Close ); dlg->setDefaultButton( KDialog::Close ); dlg->setModal( false ); KTextEdit *text = new KTextEdit( dlg ); text->setReadOnly( true ); text->setText( collection() ); dlg->setMainWidget( text ); dlg->setMinimumWidth( 300 ); dlg->setMinimumHeight( 300 ); dlg->show(); }
// static void MessageBox::make( QWidget * parent, QMessageBox::Icon icon, const QString & text, const Job * job, const QString & caption, KMessageBox::Options options ) { KDialog * dialog = new KDialog( parent ); dialog->setCaption( caption ); dialog->setButtons( showAuditLogButton( job ) ? ( KDialog::Yes | KDialog::No ) : KDialog::Yes ); dialog->setDefaultButton( KDialog::Yes ); dialog->setEscapeButton( KDialog::Yes ); dialog->setObjectName( "error" ); dialog->setModal( true ); dialog->showButtonSeparator( true ); dialog->setButtonGuiItem( KDialog::Yes, KStandardGuiItem::ok() ); if ( GpgME::hasFeature( GpgME::AuditLogFeature ) ) dialog->setButtonGuiItem( KDialog::No, KGuiItem_showAuditLog() ); if ( options & KMessageBox::PlainCaption ) dialog->setPlainCaption( caption ); if ( KDialog::No == KMessageBox::createKMessageBox( dialog, icon, text, QStringList(), QString::null, 0, options ) ) auditLog( 0, job ); }
void RKErrorDialog::reportableErrorMessage (QWidget* parent_widget, const QString& user_message, const QString &details, const QString& caption, const QString& message_code) { RK_TRACE (APP); if (!parent_widget) parent_widget = RKWardMainWindow::getMain (); // adjusted from KMessageBox::detailedError KDialog *dialog = new KDialog (parent_widget, Qt::Dialog); dialog->setCaption (caption); if (details.isEmpty ()) dialog->setButtons (KDialog::Ok | KDialog::No); else dialog->setButtons (KDialog::Ok | KDialog::No | KDialog::Details); dialog->setButtonText (KDialog::No, i18n ("Report As Bug")); dialog->setObjectName ("error"); dialog->setDefaultButton (KDialog::Ok); dialog->setEscapeButton (KDialog::Ok); KMessageBox::Options options = KMessageBox::Notify | KMessageBox::AllowLink; dialog->setModal (true); int ret = KMessageBox::createKMessageBox (dialog, QMessageBox::Critical, user_message, QStringList(), QString(), 0, options, details); if (ret == KDialog::No) { reportBug (parent_widget, (message_code.isEmpty () ? QString () : i18n ("Message code: %1\n", message_code)) + user_message); } }
// **** keyboard selection dialog ********************************************* int KNHelper::selectDialog(QWidget *parent, const QString &caption, const QStringList &options, int initialValue) { KDialog *dlg = new KDialog( parent ); dlg->setCaption( caption ); dlg->setButtons( KDialog::Ok|KDialog::Cancel ); dlg->setDefaultButton( KDialog::Ok ); QFrame *page = new QFrame( dlg ); dlg->setMainWidget( page ); QHBoxLayout *pageL = new QHBoxLayout(page); pageL->setSpacing(5); pageL->setMargin(8); QListWidget *list = new QListWidget( page ); pageL->addWidget(list); QString s; for ( QStringList::ConstIterator it = options.begin(); it != options.end(); ++it ) { s = (*it); // remove accelerators s.replace( QRegExp( "&" ), "" ); // krazy:exclude=doublequote_chars list->addItem( s ); } list->setCurrentRow( initialValue ); list->setFocus(); QObject::connect( list, SIGNAL( itemActivated( QListWidgetItem* ) ), dlg, SLOT( accept() ) ); restoreWindowSize("selectBox", dlg, QSize(247,174)); int ret; if (dlg->exec()) ret = list->currentRow(); else ret = -1; saveWindowSize("selectBox", dlg->size()); delete dlg; return ret; }
void ParagraphBulletsNumbers::customCharButtonPressed() { KDialog *dialog = new KDialog(this); dialog->setModal(true); dialog->setButtons(KDialog::Ok | KDialog::Cancel); dialog->setDefaultButton(KDialog::Ok); KCharSelect *kcs = new KCharSelect(dialog, 0, KCharSelect::SearchLine | KCharSelect::FontCombo | KCharSelect::BlockCombos | KCharSelect::CharacterTable | KCharSelect::DetailBrowser); dialog->setMainWidget(kcs); if (dialog->exec() == KDialog::Accepted) { QChar character = kcs->currentChar(); widget.customCharacter->setText(character); // also switch to the custom list style. foreach(int row, m_mapping.keys()) { if (m_mapping[row] == KoListStyle::CustomCharItem) { widget.listTypes->setCurrentRow(row); break; } } }
bool Item::mouseDoubleClickEvent( const EventInfo & eventInfo ) { Q_UNUSED(eventInfo); Property * property = 0l; Variant::Type::Value type = Variant::Type::None; const VariantDataMap::iterator variantDataEnd = m_variantData.end(); for ( VariantDataMap::iterator it = m_variantData.begin(); it != variantDataEnd; ++it ) { Property * current = *it; if ( current->type() == Variant::Type::Multiline || current->type() == Variant::Type::RichText ) { property = current; type = current->type(); break; } } if ( !property ) return false; if ( type == Variant::Type::Multiline ) { //KDialog * dlg = new KDialog( 0l, "", true, property->editorCaption(), KDialog::Ok|KDialog::Cancel|KDialog::User1, KDialog::Ok, // false, KStandardGuiItem::clear() ); KDialog * dlg = new KDialog( 0 ); dlg->setModal(true); dlg->setCaption( property->editorCaption() ); dlg->setButtons(KDialog::Ok|KDialog::Cancel|KDialog::User1); dlg->setDefaultButton(KDialog::Ok); dlg->showButtonSeparator(false); dlg->setButtonText(KDialog::User1, KStandardGuiItem::clear().text()); //QFrame *frame = dlg->makeMainWidget(); QFrame *frame = new QFrame(dlg); dlg->setMainWidget(frame); QVBoxLayout *layout = new QVBoxLayout( frame ); layout->setMargin(0); layout->setSpacing(dlg->spacingHint()); KTextEdit *textEdit = new KTextEdit( frame ); //textEdit->setTextFormat( Qt::PlainText ); // 2018.12.02 textEdit->setAcceptRichText(false); textEdit->setText( property->value().toString() ); layout->addWidget( textEdit, 10 ); textEdit->setFocus(); connect( dlg, SIGNAL( user1Clicked() ), textEdit, SLOT( clear() ) ); dlg->setMinimumWidth( 600 ); if ( dlg->exec() == KDialog::Accepted ) { property->setValue( textEdit->toPlainText() ); dataChanged(); p_itemDocument->setModified(true); } delete dlg; } else { // Is rich text RichTextEditorDlg * dlg = new RichTextEditorDlg( 0l, property->editorCaption() ); dlg->setText( property->value().toString() ); if ( dlg->exec() == KDialog::Accepted ) { property->setValue( dlg->text() ); dataChanged(); p_itemDocument->setModified(true); } delete dlg; } return true; }