MCPcopy Create free account
hub / github.com/KDE/kdevelop / KSaveSelectDialog

Method KSaveSelectDialog

kdevplatform/shell/savedialog.cpp:44–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42};
43
44KSaveSelectDialog::KSaveSelectDialog( const QList<IDocument*>& files, QWidget * parent )
45 : QDialog( parent )
46{
47 setWindowTitle( i18nc("@title:window", "Save Modified Files?") );
48
49 KDevelop::restoreAndAutoSaveGeometry(*this, QStringLiteral("SaveSelectDialog"));
50
51 auto mainLayout = new QVBoxLayout(this);
52 mainLayout->addWidget(new QLabel( i18n("The following files have been modified. Save them?"), this ));
53
54 m_listWidget = new QListWidget(this);
55 mainLayout->addWidget(m_listWidget);
56// m_listWidget->addColumn( "" );
57// m_listWidget->header()->hide();
58// m_listWidget->setSectionResizeMode( QListView::LastColumn );
59
60 for (IDocument* doc : files) {
61 new DocumentItem( doc, m_listWidget );
62 }
63
64 auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Save|QDialogButtonBox::Cancel);
65 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Save);
66 okButton->setDefault(true);
67 okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
68 connect(buttonBox, &QDialogButtonBox::accepted, this, &KSaveSelectDialog::save);
69 connect(buttonBox, &QDialogButtonBox::rejected, this, &KSaveSelectDialog::reject);
70 auto user1Button = buttonBox->addButton(i18nc("@action:button", "Save &None" ), QDialogButtonBox::ActionRole);
71 user1Button->setToolTip(i18nc("@info:tooltip", "Discard all modifications" ));
72 connect(user1Button, &QPushButton::clicked, this, &KSaveSelectDialog::accept);
73 mainLayout->addWidget(buttonBox);
74}
75
76KSaveSelectDialog::~KSaveSelectDialog()
77{

Callers

nothing calls this directly

Calls 4

buttonMethod · 0.80
setToolTipMethod · 0.80
addWidgetMethod · 0.45

Tested by

no test coverage detected