Changeset View
Changeset View
Standalone View
Standalone View
src/mainwindow.cpp
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | #ifdef __APPLE__ | ||||
| // extra treatment for mac os | // extra treatment for mac os | ||||
| // see http://doc.qt.io/qt-5/qkeysequence.html#qt_set_sequence_auto_mnemonic | // see http://doc.qt.io/qt-5/qkeysequence.html#qt_set_sequence_auto_mnemonic | ||||
| qt_set_sequence_auto_mnemonic(true); | qt_set_sequence_auto_mnemonic(true); | ||||
| #endif | #endif | ||||
| ui->setupUi(this); | ui->setupUi(this); | ||||
| m_clipboardHelper = new ClipboardHelper(this); | m_clipboardHelper = new ClipboardHelper(this); | ||||
| ui->mainLayout->setContentsMargins( | |||||
| style()->pixelMetric(QStyle::PM_LayoutLeftMargin), | |||||
| style()->pixelMetric(QStyle::PM_LayoutTopMargin), | |||||
| style()->pixelMetric(QStyle::PM_LayoutRightMargin), | |||||
| style()->pixelMetric(QStyle::PM_LayoutBottomMargin) | |||||
| ); | |||||
| m_errorMessage = new KMessageWidget(); | m_errorMessage = new KMessageWidget(); | ||||
| m_errorMessage->setMessageType(KMessageWidget::Error); | m_errorMessage->setMessageType(KMessageWidget::Error); | ||||
| m_errorMessage->setPosition(KMessageWidget::Position::Header); | |||||
| m_errorMessage->hide(); | m_errorMessage->hide(); | ||||
| ui->messagesArea->addWidget(m_errorMessage); | ui->messagesArea->addWidget(m_errorMessage); | ||||
| connect(m_pass.get(), &Pass::errorString, this, [this](auto str) { | connect(m_pass.get(), &Pass::errorString, this, [this](auto str) { | ||||
| m_errorMessage->setText(str); | m_errorMessage->setText(str); | ||||
| m_errorMessage->animatedShow(); | m_errorMessage->animatedShow(); | ||||
| setUiElementsEnabled(true); | setUiElementsEnabled(true); | ||||
| }); | }); | ||||
| connect(m_pass.get(), &Pass::critical, this, &MainWindow::critical); | connect(m_pass.get(), &Pass::critical, this, &MainWindow::critical); | ||||
| connect(m_pass.get(), &Pass::finishedShow, this, &MainWindow::passShowHandler); | connect(m_pass.get(), &Pass::finishedShow, this, &MainWindow::passShowHandler); | ||||
| connect(m_pass.get(), &Pass::finishedInsert, this, [this]() { | connect(m_pass.get(), &Pass::finishedInsert, this, [this]() { | ||||
| this->selectTreeItem(this->getCurrentTreeViewIndex()); | this->selectTreeItem(this->getCurrentTreeViewIndex()); | ||||
| }); | }); | ||||
| connect(m_pass.get(), &Pass::startReencryptPath, this, &MainWindow::startReencryptPath); | connect(m_pass.get(), &Pass::startReencryptPath, this, &MainWindow::startReencryptPath); | ||||
| connect(m_pass.get(), &Pass::endReencryptPath, this, &MainWindow::endReencryptPath); | connect(m_pass.get(), &Pass::endReencryptPath, this, &MainWindow::endReencryptPath); | ||||
| { | { | ||||
| m_notInitialized = new KMessageWidget(i18n("Password store not initialized")); | m_notInitialized = new KMessageWidget(i18n("Password store not initialized")); | ||||
| m_notInitialized->setPosition(KMessageWidget::Position::Header); | |||||
| m_notInitialized->setCloseButtonVisible(false); | m_notInitialized->setCloseButtonVisible(false); | ||||
| QAction* action = new QAction(i18n("Initialize with users")); | QAction* action = new QAction(i18n("Initialize with users")); | ||||
| connect(action, &QAction::triggered, this, [this](){this->userDialog();}); | connect(action, &QAction::triggered, this, [this](){this->userDialog();}); | ||||
| m_notInitialized->addAction(action); | m_notInitialized->addAction(action); | ||||
| m_notInitialized->setMessageType(KMessageWidget::Error); | m_notInitialized->setMessageType(KMessageWidget::Error); | ||||
| ui->messagesArea->addWidget(m_notInitialized); | ui->messagesArea->addWidget(m_notInitialized); | ||||
| m_notInitialized->hide(); | m_notInitialized->hide(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 894 Lines • Show Last 20 Lines | |||||