Commit 0122c605 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent d8ae0a0e
......@@ -37,7 +37,7 @@ KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList &args)
: KCModule(parent, args),
_cfg(KSharedConfig::openConfig(QStringLiteral("kwalletrc"), KConfig::NoGlobals))
{
KAboutData *about = new KAboutData(QStringLiteral("kcmkwallet5"),
auto about = new KAboutData(QStringLiteral("kcmkwallet5"),
i18n("KDE Wallet Control Module"),
QStringLiteral(KWALLETMANAGER_VERSION_STRING),
QString(),
......@@ -49,7 +49,7 @@ KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList &args)
setAboutData(about);
setNeedsAuthorization(true);
QVBoxLayout *vbox = new QVBoxLayout(this);
auto vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
_wcw = new WalletConfigWidget(this);
vbox->addWidget(_wcw);
......@@ -229,7 +229,7 @@ void KWalletConfig::load()
const QStringList apps = aa.readEntry(*i, QStringList());
const QStringList denyapps = ad.readEntry(*i, QStringList());
denykeys.removeAll(walletName);
QTreeWidgetItem *twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << walletName);
auto twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << walletName);
for (QStringList::const_iterator j = apps.begin(), end = apps.end(); j != end; ++j) {
new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Allow"));
......@@ -240,7 +240,7 @@ void KWalletConfig::load()
}
for (QStringList::const_iterator i = denykeys.constBegin(), denykeysEnd = denykeys.constEnd(); i != denykeysEnd; ++i) {
const QStringList denyapps = ad.readEntry(*i, QStringList());
QTreeWidgetItem *twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << *i);
auto twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << *i);
for (QStringList::const_iterator j = denyapps.begin(), denyappsEnd = denyapps.end(); j != denyappsEnd; ++j) {
new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Deny"));
}
......@@ -363,7 +363,7 @@ void KWalletConfig::customContextMenuRequested(const QPoint &pos)
{
QTreeWidgetItem *item = _wcw->_accessList->itemAt(pos);
if (item && item->parent()) {
QMenu *m = new QMenu(this);
auto m = new QMenu(this);
m->setTitle(item->parent()->text(0));
m->addAction(i18n("&Delete"), this, &KWalletConfig::deleteEntry, Qt::Key_Delete);
m->exec(_wcw->_accessList->mapToGlobal(pos));
......
......@@ -64,7 +64,7 @@ void KWalletFolderItem::refreshItemsCount()
KWalletContainerItem *KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type)
{
for (int i = 0; i < childCount(); ++i) {
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
auto ci = dynamic_cast<KWalletContainerItem *>(child(i));
if (!ci) {
continue;
}
......@@ -83,7 +83,7 @@ bool KWalletFolderItem::contains(const QString &key)
QTreeWidgetItem *KWalletFolderItem::getItem(const QString &key)
{
for (int i = 0; i < childCount(); ++i) {
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
auto ci = dynamic_cast<KWalletContainerItem *>(child(i));
if (!ci) {
continue;
}
......@@ -137,7 +137,7 @@ bool KWalletContainerItem::contains(const QString &key)
QTreeWidgetItem *KWalletContainerItem::getItem(const QString &key)
{
for (int i = 0; i < childCount(); ++i) {
KWalletEntryItem *entryItem = dynamic_cast<KWalletEntryItem *>(child(i));
auto entryItem = dynamic_cast<KWalletEntryItem *>(child(i));
if (entryItem && entryItem->name() == key) {
return entryItem;
}
......@@ -320,7 +320,7 @@ void KWalletItem::processDropEvent(QDropEvent *e)
//delete the folder from the source if we were moving
if (el) {
KWalletFolderItem *fi =
auto fi =
dynamic_cast<KWalletFolderItem *>(el->currentItem());
if (fi) {
el->_wallet->removeFolder(fi->name());
......@@ -472,7 +472,7 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item)
//delete source if we were moving, i.e., we are dragging
//from kwalletmanager and Control is not pressed
if (ok && el && proposedAction != Qt::CopyAction && sel) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(sel);
auto fi = dynamic_cast<KWalletFolderItem *>(sel);
if (fi) {
el->_wallet->removeFolder(fi->name());
delete sel;
......@@ -491,7 +491,7 @@ void KWalletEntryList::setWallet(KWallet::Wallet *w)
bool KWalletEntryList::existsFolder(const QString &name)
{
for (int i = 0; i < topLevelItemCount(); ++i) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
auto fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
if (!fi) {
continue;
}
......@@ -506,11 +506,11 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const
{
QMimeData *sd = nullptr;
if (i->type() == KWalletEntryItemClass) {
const KWalletEntryItem *ei = dynamic_cast<const KWalletEntryItem *>(i);
const auto ei = dynamic_cast<const KWalletEntryItem *>(i);
if (!ei) {
return nullptr;
}
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(ei->parent());
auto ci = dynamic_cast<KWalletContainerItem *>(ei->parent());
if (!ci) {
return nullptr;
}
......@@ -527,7 +527,7 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const
ds << value;
sd->setData(QStringLiteral("application/x-kwallet-entry"), a);
} else if (i->type() == KWalletFolderItemClass) {
const KWalletFolderItem *fi = dynamic_cast<const KWalletFolderItem *>(i);
const auto fi = dynamic_cast<const KWalletFolderItem *>(i);
if (!fi) {
return nullptr;
}
......@@ -568,7 +568,7 @@ void KWalletEntryList::mouseMoveEvent(QMouseEvent *e)
QMimeData *mimeData = itemMimeData(item);
if (mimeData) {
QDrag *drag = new QDrag(this);
auto drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setHotSpot(QPoint(0, 0));
drag->exec();
......@@ -606,7 +606,7 @@ void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e)
KWalletFolderItem *KWalletEntryList::getFolder(const QString &name)
{
for (int i = 0; i < topLevelItemCount(); ++i) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
auto fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
if (!fi) {
continue;
}
......@@ -651,7 +651,7 @@ void KWalletEntryList::refreshItemsCount()
QTreeWidgetItemIterator it(this);
while (*it) {
QTreeWidgetItem *item = *it++;
KWalletFolderItem *fi = dynamic_cast< KWalletFolderItem * >(item);
auto fi = dynamic_cast< KWalletFolderItem * >(item);
if (fi) {
fi->refreshItemsCount();
}
......@@ -669,9 +669,9 @@ public:
bool eventFilter(QObject * /*watched*/, QEvent *event) override
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return) {
QListWidget *p = static_cast<QListWidget *>(parent());
auto p = static_cast<QListWidget *>(parent());
QMetaObject::invokeMethod(p, "executed", Q_ARG(QListWidgetItem *, p->currentItem()));
return true;
}
......
......@@ -23,13 +23,13 @@ void AuthorizedApplicationsTable::setModel(QAbstractItemModel *model)
{
Q_ASSERT(_wallet != nullptr);
AuthorizedAppModel *appModel = qobject_cast<AuthorizedAppModel *>(model);
auto appModel = qobject_cast<AuthorizedAppModel *>(model);
Q_ASSERT(appModel != nullptr);
QTableView::setModel(model);
const int numberRow(model->rowCount());
for (int row = 0; row < numberRow; row++) {
RevokeAuthButton *btn = new RevokeAuthButton(model->index(row, 0).data().toString(), _wallet);
auto btn = new RevokeAuthButton(model->index(row, 0).data().toString(), _wallet);
btn->setFixedHeight(btn->sizeHint().height());
setRowHeight(row, btn->height());
setIndexWidget(model->index(row, 1), btn);
......
......@@ -25,13 +25,13 @@ void ConnectedApplicationsTable::setModel(QAbstractItemModel *model)
{
Q_ASSERT(_wallet != nullptr);
ConnectedAppModel *appModel = qobject_cast<ConnectedAppModel *>(model);
auto appModel = qobject_cast<ConnectedAppModel *>(model);
Q_ASSERT(appModel != nullptr);
QTableView::setModel(model);
const int numberRow(model->rowCount());
for (int row = 0; row < numberRow; row++) {
DisconnectAppButton *btn = new DisconnectAppButton(model->index(row, 0).data().toString(), _wallet);
auto btn = new DisconnectAppButton(model->index(row, 0).data().toString(), _wallet);
btn->setFixedHeight(btn->sizeHint().height());
setRowHeight(row, btn->height());
setIndexWidget(model->index(row, 1), btn);
......
......@@ -28,7 +28,7 @@ void ConnectedAppModel::refresh()
// for un unknown reason, kwalletd returs empty strings so lets avoid inserting them
// FIXME: find out why kwalletd returns empty strings here
if (!appName.isEmpty()) {
QStandardItem *item = new QStandardItem(appName);
auto item = new QStandardItem(appName);
item->setEditable(false);
setItem(row, 0, item);
// this item will be hidden by the disconnect button, see below setIndexWidget call
......
......@@ -78,7 +78,7 @@ KWalletEditor::KWalletEditor(QWidget *parent, const QString &name)
_saveChanges->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
_hasUnsavedChanges = false;
QVBoxLayout *box = new QVBoxLayout(_entryListFrame);
auto box = new QVBoxLayout(_entryListFrame);
box->setContentsMargins(0, 0, 0, 0);
_entryList = new KWalletEntryList(_entryListFrame, QStringLiteral("Wallet Entry List"));
_entryList->setContextMenuPolicy(Qt::CustomContextMenu);
......@@ -317,7 +317,7 @@ void KWalletEditor::updateFolderList(bool checkEntries)
QStack<QTreeWidgetItem *> trash;
for (int i = 0; i < _entryList->topLevelItemCount(); ++i) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(_entryList->topLevelItem(i));
auto fi = dynamic_cast<KWalletFolderItem *>(_entryList->topLevelItem(i));
if (!fi) {
continue;
}
......@@ -339,12 +339,12 @@ void KWalletEditor::updateFolderList(bool checkEntries)
_w->setFolder(*i);
const QStringList entries = _w->entryList();
KWalletFolderItem *item = new KWalletFolderItem(_w, _entryList, *i, entries.count());
auto item = new KWalletFolderItem(_w, _entryList, *i, entries.count());
KWalletContainerItem *pi = new KWalletContainerItem(item, i18n("Passwords"), KWallet::Wallet::Password);
KWalletContainerItem *mi = new KWalletContainerItem(item, i18n("Maps"), KWallet::Wallet::Map);
KWalletContainerItem *bi = new KWalletContainerItem(item, i18n("Binary Data"), KWallet::Wallet::Stream);
KWalletContainerItem *ui = new KWalletContainerItem(item, i18n("Unknown"), KWallet::Wallet::Unknown);
auto pi = new KWalletContainerItem(item, i18n("Passwords"), KWallet::Wallet::Password);
auto mi = new KWalletContainerItem(item, i18n("Maps"), KWallet::Wallet::Map);
auto bi = new KWalletContainerItem(item, i18n("Binary Data"), KWallet::Wallet::Stream);
auto ui = new KWalletContainerItem(item, i18n("Unknown"), KWallet::Wallet::Unknown);
for (QStringList::const_iterator j = entries.begin(); j != entries.end(); ++j) {
switch (_w->entryType(*j)) {
......@@ -379,7 +379,7 @@ void KWalletEditor::deleteFolder()
if (_w) {
QTreeWidgetItem *i = _entryList->currentItem();
if (i) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(i);
auto fi = dynamic_cast<KWalletFolderItem *>(i);
if (!fi) {
return;
}
......@@ -439,7 +439,7 @@ void KWalletEditor::saveEntry()
_undoChanges->setEnabled(false);
_hasUnsavedChanges = false;
if (item && _w && item->parent()) {
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(item->parent());
auto ci = dynamic_cast<KWalletContainerItem *>(item->parent());
if (ci) {
if (ci->entryType() == KWallet::Wallet::Password) {
rc = _w->writePassword(item->text(0), _passwordValue->toPlainText());
......@@ -789,16 +789,16 @@ void KWalletEditor::newEntry()
p = item->parent();
}
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(p->parent());
auto fi = dynamic_cast<KWalletFolderItem *>(p->parent());
if (!fi) {
KMessageBox::error(this, i18n("An unexpected error occurred trying to add the new entry"));
return;
}
_w->setFolder(fi->name());
KWalletEntryItem *ni = new KWalletEntryItem(_w, p, n);
auto ni = new KWalletEntryItem(_w, p, n);
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(p);
auto ci = dynamic_cast<KWalletContainerItem *>(p);
if (!ci) {
KMessageBox::error(this, i18n("An unexpected error occurred trying to add the new entry"));
delete ni;
......@@ -834,7 +834,7 @@ void KWalletEditor::renameEntry()
void KWalletEditor::listItemChanged(QTreeWidgetItem *item, int column)
{
if (item && column == 0) {
KWalletEntryItem *i = dynamic_cast<KWalletEntryItem *>(item);
auto i = dynamic_cast<KWalletEntryItem *>(item);
if (!i) {
return;
}
......@@ -850,7 +850,7 @@ void KWalletEditor::listItemChanged(QTreeWidgetItem *item, int column)
if (_w->renameEntry(i->name(), t) == 0) {
i->setName(t);
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(item->parent());
auto ci = dynamic_cast<KWalletContainerItem *>(item->parent());
if (!ci) {
KMessageBox::error(this, i18n("An unexpected error occurred trying to rename the entry"));
return;
......@@ -874,7 +874,7 @@ void KWalletEditor::deleteEntry()
if (_w && item) {
int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure you wish to delete the item '%1'?", item->text(0)), QString(), KStandardGuiItem::del());
if (rc == KMessageBox::Continue) {
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(item->parent()->parent());
auto fi = dynamic_cast<KWalletFolderItem *>(item->parent()->parent());
if (!fi) {
KMessageBox::error(this, i18n("An unexpected error occurred trying to delete the entry"));
return;
......@@ -1007,7 +1007,7 @@ void KWalletEditor::importWallet()
for (pe = pwd.constBegin(); pe != pwd.constEnd(); ++pe) {
bool hasEntry = _w->hasEntry(pe.key());
if (hasEntry && mp == Prompt) {
KBetterThanKDialogBase *bd = new KBetterThanKDialogBase(this);
auto bd = new KBetterThanKDialogBase(this);
bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?", f->toHtmlEscaped(), pe.key().toHtmlEscaped()));
mp = static_cast<MergePlan>(bd->exec());
delete bd;
......@@ -1041,7 +1041,7 @@ void KWalletEditor::importWallet()
}
bool hasEntry = _w->hasEntry(ee.key());
if (hasEntry && mp == Prompt) {
KBetterThanKDialogBase *bd = new KBetterThanKDialogBase(this);
auto bd = new KBetterThanKDialogBase(this);
bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?", f->toHtmlEscaped(), ee.key().toHtmlEscaped()));
mp = static_cast<MergePlan>(bd->exec());
delete bd;
......@@ -1123,7 +1123,7 @@ void KWalletEditor::importXML()
QString ename = e.attribute(QStringLiteral("name"));
bool hasEntry = _w->hasEntry(ename);
if (hasEntry && mp == Prompt) {
KBetterThanKDialogBase *bd = new KBetterThanKDialogBase(this);
auto bd = new KBetterThanKDialogBase(this);
bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?", fname.toHtmlEscaped(), ename.toHtmlEscaped()));
mp = static_cast<MergePlan>(bd->exec());
delete bd;
......
......@@ -297,7 +297,7 @@ void KWalletManager::possiblyRescan(const QString &app, const QString &oldOwner,
void KWalletManager::createWallet()
{
QString txt = i18n("Please choose a name for the new wallet:");
QRegExpValidator validator(QRegExp(QLatin1String("^[\\w\\^\\&\\'\\@\\{\\}\\[\\]\\,\\$\\=\\!\\-\\#\\(\\)\\%\\.\\+\\_\\s]+$")), this);
QRegExpValidator validator(QRegExp(QLatin1String(R"(^[\w\^\&\'\@\{\}\[\]\,\$\=\!\-\#\(\)\%\.\+\_\s]+$)")), this);
if (!KWallet::Wallet::isEnabled()) {
// FIXME: KMessageBox::warningYesNo(this, i1_8n("KWallet is not enabled. Do you want to enable it?"), QString(), i18n("Enable"), i18n("Keep Disabled"));
......@@ -308,11 +308,11 @@ void KWalletManager::createWallet()
nameDialog.setWindowTitle(i18n("New Wallet"));
nameDialog.setLayout(new QVBoxLayout);
nameDialog.layout()->addWidget(new QLabel(txt));
QLineEdit *lineEdit = new QLineEdit;
auto lineEdit = new QLineEdit;
lineEdit->setValidator(&validator);
nameDialog.layout()->addWidget(lineEdit);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, &QDialogButtonBox::accepted, &nameDialog, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, &nameDialog, &QDialog::reject);
nameDialog.layout()->addWidget(buttonBox);
......@@ -382,7 +382,7 @@ void KWalletManager::shuttingDown()
void KWalletManager::setupWallet()
{
auto *job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), {QStringLiteral("kwalletconfig5")});
auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), {QStringLiteral("kwalletconfig5")});
job->start();
}
......
......@@ -62,7 +62,7 @@ void KWalletManagerWidget::updateWalletDisplay(const QString &selectWallet /* =
for (QStringList::const_iterator i = wl.begin(); i != wl.end(); ++i) {
const QString &name = *i;
if (!_walletPages.contains(name)) {
KWalletManagerWidgetItem *wi = new KWalletManagerWidgetItem(this, name);
auto wi = new KWalletManagerWidgetItem(this, name);
addPage(wi);
_walletPages.insert(*i, wi);
}
......@@ -106,7 +106,7 @@ bool KWalletManagerWidget::openWallet(const QString &name)
QString KWalletManagerWidget::activeWalletName() const
{
KWalletManagerWidgetItem *page = qobject_cast<KWalletManagerWidgetItem *>(currentPage());
auto page = qobject_cast<KWalletManagerWidgetItem *>(currentPage());
if (page) {
return page->walletName();
} else {
......
......@@ -41,7 +41,7 @@ private Q_SLOTS:
private:
bool shouldIgnoreDropEvent(const QDropEvent *e, QUrl *u) const;
typedef QHash<QString, KWalletManagerWidgetItem *> WalletPagesHash;
using WalletPagesHash = QHash<QString, KWalletManagerWidgetItem *>;
WalletPagesHash _walletPages;
};
......
......@@ -19,7 +19,7 @@ KWalletPopup::KWalletPopup(const QString &wallet, QWidget *parent, const QString
{
addSection(wallet);
setObjectName(name);
KActionCollection *ac = new KActionCollection(this/*, "kwallet context actions"*/);
auto ac = new KActionCollection(this/*, "kwallet context actions"*/);
ac->setObjectName(QStringLiteral("kwallet context actions"));
QAction *act;
......@@ -41,7 +41,7 @@ KWalletPopup::KWalletPopup(const QString &wallet, QWidget *parent, const QString
const QStringList ul = KWallet::Wallet::users(wallet);
if (!ul.isEmpty()) {
QMenu *pm = new QMenu(this);
auto pm = new QMenu(this);
pm->setObjectName(QStringLiteral("Disconnect Apps"));
int id = 7000;
for (QStringList::const_iterator it = ul.begin(), end(ul.end()); it != end; ++it) {
......@@ -100,7 +100,7 @@ void KWalletPopup::createWallet()
void KWalletPopup::disconnectApp()
{
QAction *a = qobject_cast<QAction *>(sender());
auto a = qobject_cast<QAction *>(sender());
Q_ASSERT(a);
if (a) {
KWallet::Wallet::disconnectApplication(_walletName, a->data().toString());
......
......@@ -78,14 +78,14 @@ public:
return QItemDelegate::createEditor(parentWidget, option, index);
}
KWMapEditor *mapEditor = static_cast<KWMapEditor *>(parent());
auto mapEditor = static_cast<KWMapEditor *>(parent());
return new InlineEditor(mapEditor);
}
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
{
if (dynamic_cast<InlineEditor *>(editor)) {
KWMapEditor *mapEditor = static_cast<KWMapEditor *>(parent());
auto mapEditor = static_cast<KWMapEditor *>(parent());
const QRect geo = mapEditor->visualRect(index);
editor->move(mapEditor->mapToGlobal(geo.topLeft()));
editor->resize(geo.width(), geo.height() * 3);
......@@ -96,9 +96,9 @@ public:
void setEditorData(QWidget *editor, const QModelIndex &index) const override
{
InlineEditor *e = dynamic_cast<InlineEditor *>(editor);
auto e = dynamic_cast<InlineEditor *>(editor);
if (e) {
KWMapEditor *mapEditor = static_cast<KWMapEditor *>(parent());
auto mapEditor = static_cast<KWMapEditor *>(parent());
e->setText(mapEditor->item(index.row(), index.column())->text());
} else {
QItemDelegate::setEditorData(editor, index);
......@@ -107,9 +107,9 @@ public:
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
{
InlineEditor *e = dynamic_cast<InlineEditor *>(editor);
auto e = dynamic_cast<InlineEditor *>(editor);
if (e) {
KWMapEditor *mapEditor = static_cast<KWMapEditor *>(parent());
auto mapEditor = static_cast<KWMapEditor *>(parent());
mapEditor->item(index.row(), index.column())->setText(e->toPlainText());
} else {
QItemDelegate::setModelData(editor, model, index);
......@@ -142,7 +142,7 @@ void KWMapEditor::reload()
if ((row = rowCount()) < _map.count()) {
setRowCount(_map.count());
for (int x = row; x < rowCount(); ++x) {
QToolButton *b = new QToolButton(this);
auto b = new QToolButton(this);
b->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
b->setToolTip(i18n("Delete Entry"));
connect(b, &QToolButton::clicked, this, &KWMapEditor::erase);
......@@ -193,7 +193,7 @@ void KWMapEditor::addEntry()
{
int x = rowCount();
insertRow(x);
QToolButton *b = new QToolButton(this);
auto b = new QToolButton(this);
b->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
b->setToolTip(i18n("Delete Entry"));
connect(b, &QToolButton::clicked, this, &KWMapEditor::erase);
......@@ -214,7 +214,7 @@ void KWMapEditor::contextMenu(const QPoint &pos)
{
QTableWidgetItem *twi = itemAt(pos);
_contextRow = row(twi);
QMenu *m = new QMenu(this);
auto m = new QMenu(this);
m->addAction(i18n("&New Entry"), this, &KWMapEditor::addEntry);
m->addAction(_copyAct);
m->exec(mapToGlobal(pos));
......
......@@ -27,7 +27,7 @@ class KActionCollection;
class RegisterCreateActionsMethod
{
public:
typedef void (*CreateActionsMethod)(KActionCollection *);
using CreateActionsMethod = void (*)(KActionCollection *);
explicit RegisterCreateActionsMethod(CreateActionsMethod method);
......
......@@ -145,7 +145,7 @@ void WalletControlWidget::updateWalletDisplay()
void WalletControlWidget::onDisconnectApplication()
{
QAction *a = qobject_cast<QAction *>(sender());
auto a = qobject_cast<QAction *>(sender());
Q_ASSERT(a);
if (a) {
KWallet::Wallet::disconnectApplication(_walletName, a->data().toString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment