예제 #1
0
void EditEntryWidget::cancel()
{
    if (m_history) {
        m_entry = Q_NULLPTR;
        m_database = Q_NULLPTR;
        m_entryAttributes->clear();
        m_entryAttachments->clear();
        Q_EMIT editFinished(false);
        return;
    }

    if (!m_entry->iconUuid().isNull() &&
            !m_database->metadata()->containsCustomIcon(m_entry->iconUuid())) {
        m_entry->setIcon(Entry::DefaultIconNumber);
    }

    m_entry = 0;
    m_database = 0;
    m_entryAttributes->clear();
    m_entryAttachments->clear();
    m_autoTypeAssoc->clear();
    m_historyModel->clear();

    Q_EMIT editFinished(false);
}
REPerimeterPoint::REPerimeterPoint(Ui::RNDFEdit* ui, rndf::RoadNetwork* rn) :
  REElement<rndf::PerimeterPoint> (ui, rn) {

  connect(ui_->ppLat, SIGNAL(editFinished()), this, SLOT(on_ppLat_editFinished()));
  connect(ui_->ppLon, SIGNAL(editFinished()), this, SLOT(on_ppLon_editFinished()));
  connect(ui_->ppUtmX, SIGNAL(editFinished()), this, SLOT(on_ppUtmX_editFinished()));
  connect(ui_->ppUtmY, SIGNAL(editFinished()), this, SLOT(on_ppUtmY_editFinished()));
//  connect(ui_->ppCheckPoint, SIGNAL(stateChanged(int)), this, SLOT(on_ppCheckPoint_stateChanged(int)));
//  connect(ui_->ppStopPoint, SIGNAL(stateChanged(int)), this, SLOT(on_ppStopPoint_stateChanged(int)));
}
예제 #3
0
void SettingsWidget::saveSettings()
{
    config()->set("RememberLastDatabases", m_generalUi->rememberLastDatabasesCheckBox->isChecked());
    config()->set("OpenPreviousDatabasesOnStartup",
                  m_generalUi->openPreviousDatabasesOnStartupCheckBox->isChecked());
    config()->set("ModifiedOnExpandedStateChanges",
                  m_generalUi->modifiedExpandedChangedCheckBox->isChecked());
    config()->set("AutoSaveAfterEveryChange",
                  m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked());
    config()->set("AutoSaveOnExit", m_generalUi->autoSaveOnExitCheckBox->isChecked());
    config()->set("MinimizeOnCopy", m_generalUi->minimizeOnCopyCheckBox->isChecked());
    config()->set("MinimizeToTray", m_generalUi->minimizeToTrayCheckBox->isChecked());
    config()->set("UseGroupIconOnEntryCreation",
                  m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
    config()->set("AutoTypeEntryTitleMatch",
                  m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
    int currentLangIndex = m_generalUi->languageComboBox->currentIndex();
    config()->set("GUI/Language", m_generalUi->languageComboBox->itemData(currentLangIndex).toString());
    if (autoType()->isAvailable()) {
        config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key());
        config()->set("GlobalAutoTypeModifiers",
                      static_cast<int>(m_generalUi->autoTypeShortcutWidget->modifiers()));
    }
    config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked());
    config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value());

    config()->set("security/lockdatabaseidle", m_secUi->lockDatabaseIdleCheckBox->isChecked());
    config()->set("security/lockdatabaseidlesec", m_secUi->lockDatabaseIdleSpinBox->value());

    config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());

    config()->set("security/autotypeask", m_secUi->autoTypeAskCheckBox->isChecked());

    Q_EMIT editFinished(true);
}
예제 #4
0
QWidget *QVariantDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option , const QModelIndex & index ) const
{
	QWidget* editor = 0;
	Property* p = static_cast<Property*>(index.internalPointer());
	switch(p->value().type())
	{
	case QVariant::Color:
	case QVariant::Int:
	case QMetaType::Float:	
	case QVariant::Double:	
    case QVariant::UserType:
		editor = p->createEditor(parent, option);
		if (editor)	
		{
			if (editor->metaObject()->indexOfSignal("editFinished()") != -1)
			{
				connect(editor, SIGNAL(editFinished()), m_finishedMapper, SLOT(map()));
				m_finishedMapper->setMapping(editor, editor);
			}
			break; // if no editor could be created take default case
		}
	default:
        if( !editor) editor = QItemDelegate::createEditor(parent, option, index);
	}
	parseEditorHints(editor, p->editorHints());
	return editor;
}
SelectPositionPage::SelectPositionPage(QWidget *parent) :
    Page(parent)
{
    addTitle(trUtf8("Choisir une position\n(2 / 5)"));

    CarteScene *scene = CarteScene::readSceneFile("data/xml/map_montreal.osm");
    CarteWidget::setScene(scene);

    mapWidget = new CarteWidget(this);
    addWidget(mapWidget);

    QPushButton *btnPrevious = new QPushButton(this);
    btnPrevious->setIcon(QIcon(":/icones/data/icons/arrow_left.png"));
    btnNext = new QPushButton(this);
    btnNext->setIcon(QIcon(":/icones/data/icons/arrow_right.png"));
    QPushButton *btnMenu = new QPushButton(trUtf8("Menu"), this);
    btnNext->setEnabled(false);

    addBottomButtons(btnPrevious, btnMenu, btnNext);

    connect(mapWidget, SIGNAL(editFinished()), this, SLOT(enableNextButton()));
    connect(btnPrevious, SIGNAL(clicked()), SIGNAL(Previous()));
    connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
    connect(btnNext, SIGNAL(clicked()), SIGNAL(Next()));
}
예제 #6
0
void DatabaseOpenWidget::openDatabase()
{
    KeePass2Reader reader;
    CompositeKey masterKey = databaseKey();
    if (masterKey.isEmpty()) {
        return;
    }

    QFile file(m_filename);
    if (!file.open(QIODevice::ReadOnly)) {
        // TODO: error message
        return;
    }
    if (m_db) {
        delete m_db;
    }
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    m_db = reader.readDatabase(&file, masterKey);
    QApplication::restoreOverrideCursor();

    if (m_db) {
        Q_EMIT editFinished(true);
    }
    else {
        MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
                            .append(reader.errorString()));
        m_ui->editPassword->clear();
    }
}
예제 #7
0
MsgEdit::MsgEdit(QWidget *parent, UserWnd *userWnd)
        : QMainWindow(parent, NULL, 0)
{
    m_userWnd	= userWnd;
    m_msg		= NULL;
    m_bTyping	= false;
    m_type		= NO_TYPE;
    m_flags		= 0;
    m_retry.msg = NULL;
    m_bReceived = false;
    m_processor = NULL;
    m_recvProcessor = NULL;
    m_cmd.param = NULL;

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    m_frame = new QFrame(this);
    setCentralWidget(m_frame);
    m_layout = new QVBoxLayout(m_frame);

    m_edit = new MsgTextEdit(this, m_frame);
    m_edit->setBackground(QColor(CorePlugin::m_plugin->getEditBackground() & 0xFFFFFF));
    m_edit->setForeground(QColor(CorePlugin::m_plugin->getEditForeground() & 0xFFFFFF), true);
    m_edit->setFont(CorePlugin::m_plugin->editFont);
    m_edit->setCtrlMode(!CorePlugin::m_plugin->getSendOnEnter());
	setFocusProxy(m_edit);

    QStyleSheet *style = new QStyleSheet(m_edit);
    QStyleSheetItem *style_p = style->item("p");
    // Disable top and bottom margins for P tags. This will make sure
    // paragraphs have no more spacing than regular lines, thus matching
    // RTFs defaut look for paragraphs.
    style_p->setMargin(QStyleSheetItem::MarginTop, 0);
    style_p->setMargin(QStyleSheetItem::MarginBottom, 0);
    m_edit->setStyleSheet(style);

    connect(m_edit, SIGNAL(lostFocus()), this, SLOT(editLostFocus()));
    connect(m_edit, SIGNAL(textChanged()), this, SLOT(editTextChanged()));
    connect(m_edit, SIGNAL(ctrlEnterPressed()), this, SLOT(editEnterPressed()));
    connect(m_edit, SIGNAL(colorsChanged()), this, SLOT(colorsChanged()));
    connect(m_edit, SIGNAL(finished()), this, SLOT(editFinished()));
    connect(m_edit, SIGNAL(fontSelected(const QFont&)), this, SLOT(editFontChanged(const QFont&)));

    QFontMetrics fm(m_edit->font());
    m_edit->setMinimumSize(QSize(fm.maxWidth(), fm.height() + 10));
    m_layout->addWidget(m_edit);

    BarShow b;
    b.bar_id = ToolBarMsgEdit;
    b.parent = this;
    Event e(EventShowBar, &b);
    m_bar = (CToolBar*)(e.process());
    m_bar->setParam(this);

    if (CorePlugin::m_plugin->getContainerMode() == 0)
        showCloseSend(false);

    setDockEnabled(m_bar, Left, false);
    setDockEnabled(m_bar, Right, false);
}
예제 #8
0
void DatabaseOpenWidget::openDatabase()
{
    KeePass2Reader reader;
    CompositeKey masterKey = databaseKey();
    if (masterKey.isEmpty()) {
        return;
    }

    QFile file(m_filename);
    if (!file.open(QIODevice::ReadOnly)) {
        // TODO: error message
        return;
    }
    if (m_db) {
        delete m_db;
    }
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    m_db = reader.readDatabase(&file, masterKey);
    QApplication::restoreOverrideCursor();

    if (m_db) {
        Q_EMIT editFinished(true);
        // this is a c++11 equivalent foreach construct
        // if c++11 is not available another iteration loop style is needed!
        for (auto widget : qApp->topLevelWidgets()) {
            if(widget->inherits("QMainWindow"))
                static_cast<MainWindow*>(widget)->configuredMinimizeWindow();
        }
    }
    else {
        MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
                            .append(reader.errorString()));
        m_ui->editPassword->clear();
    }
}
예제 #9
0
void EditGroupWidget::save()
{
    m_group->setName(m_mainUi->editName->text());
    m_group->setNotes(m_mainUi->editNotes->toPlainText());
    m_group->setExpires(m_mainUi->expireCheck->isChecked());
    m_group->setExpiryTime(m_mainUi->expireDatePicker->dateTime().toUTC());

    m_group->setSearchingEnabled(triStateFromIndex(m_mainUi->searchComboBox->currentIndex()));
    m_group->setAutoTypeEnabled(triStateFromIndex(m_mainUi->autotypeComboBox->currentIndex()));

    IconStruct iconStruct = m_editGroupWidgetIcons->save();

    if (iconStruct.number < 0) {
        m_group->setIcon(Group::DefaultIconNumber);
    }
    else if (iconStruct.uuid.isNull()) {
        m_group->setIcon(iconStruct.number);
    }
    else {
        m_group->setIcon(iconStruct.uuid);
    }

    m_group = Q_NULLPTR;
    m_database = Q_NULLPTR;
    Q_EMIT editFinished(true);
}
예제 #10
0
void ShaderComboBox::currentChanged(int index)
{
    if (itemData(index).isValid() && itemData(index) == QVariant((int)QVariant::UserType))
    {
            QString newShader = HordeFileDialog::getResourceFile( H3DResTypes::Shader, m_resourcePath, this, tr("Select shader to import"));
            if (!newShader.isEmpty())
            {
                    int index2 = findText(newShader);
                    if (index2 == -1)
                    {
                            blockSignals(true);
                            removeItem(index);
                            addItem(newShader);
                            addItem(tr("Import from Repository"), QVariant(QVariant::UserType));
                            blockSignals(false);
                            QHordeSceneEditorSettings settings;
                            setItemData( count() - 1, settings.value( "ImportEntryColor", QColor( 132, 255, 136 ) ), Qt::BackgroundColorRole );
                            index2 = findText(newShader);
                    }
                    setCurrentIndex(index2);
                    return;
            }
            else
                    setCurrentIndex(findText(m_init));
                    return;
    }
    if (m_init != currentText())
    {
            emit shaderChanged();
            emit editFinished();
    }
}
예제 #11
0
MsgContacts::MsgContacts(MsgEdit *parent, Message *msg)
        : QObject(parent)
{
    m_client = msg->client();
    m_edit = parent;
    m_list = new UserList(m_edit->m_frame);
    m_edit->m_layout->addWidget(m_list);
    m_edit->m_edit->setTextFormat(QTextEdit::PlainText);
    connect(m_list, SIGNAL(selectChanged()), this, SLOT(changed()));
    ContactsMessage *m = static_cast<ContactsMessage*>(msg);
    QString contacts = m->getContacts();
    while (contacts.length()){
        QString item = getToken(contacts, ';');
        QString url = getToken(item, ',');
        QString proto = getToken(url, ':');
        if (proto == "sim"){
            unsigned contact_id = atol(url.latin1());
            if (getContacts()->contact(contact_id))
                m_list->selected.push_back(contact_id);
        }
    }
    changed();
    connect(m_edit, SIGNAL(finished()), this, SLOT(editFinished()));
    connect(m_list, SIGNAL(finished()), this, SLOT(listFinished()));
}
예제 #12
0
void PipelineComboBox::currentChanged(int index)
{
	if (itemData(index).isValid() && itemData(index) == QVariant((int)QVariant::UserType))
	{		
		QString newPipeline = HordeFileDialog::getResourceFile( H3DResTypes::Pipeline, m_resourcePath, this, tr("Select pipeline to import"));
		if (!newPipeline.isEmpty())
		{
			if (findText(newPipeline) == -1)
			{
				removeItem(index);
				addItem(newPipeline);
				addItem(tr("Import from Repository"), QVariant(QVariant::UserType));
			}
			setCurrentIndex(findText(newPipeline));
			return;
		}
		else
			setCurrentIndex(findText(m_init));
			return;
	}
	if (m_init != currentText())
	{
		emit pipelineChanged();
		emit editFinished();
	}
}
예제 #13
0
void EditEntryWidget::cancel()
{
    if (m_history) {
        clear();
        Q_EMIT editFinished(false);
        return;
    }

    if (!m_entry->iconUuid().isNull() &&
            !m_database->metadata()->containsCustomIcon(m_entry->iconUuid())) {
        m_entry->setIcon(Entry::DefaultIconNumber);
    }

    clear();

    Q_EMIT editFinished(false);
}
예제 #14
0
void LkInputTableView::inputFinished(int result){

    if(result == QInputDialog::Accepted) {
        int value = m_dialog->intValue();
        m_dialog->setIntValue(0);
        emit editFinished(value);
    }

}
예제 #15
0
void SettingsWidget::reject()
{
    // register the old key again as it might have changed
    if (m_globalAutoTypeKey > 0 && m_globalAutoTypeModifiers > 0) {
        autoType()->registerGlobalShortcut(m_globalAutoTypeKey, m_globalAutoTypeModifiers);
    }

    Q_EMIT editFinished(false);
}
예제 #16
0
파일: tabbar.cpp 프로젝트: abenea/fubar
bool TabBar::eventFilter(QObject *obj, QEvent *event)
{
    bool result = QObject::eventFilter(obj, event);

    if (obj == this) {
        if (event->type() == QEvent::MouseButtonPress) {
            //see if the user is trying to move away from the editing by clicking another tab
            QMouseEvent* me = static_cast<QMouseEvent*>(event);
            int clickedTabId = tabAt(me->pos());
             if (renamingIndex_ != -1 && renamingIndex_ != clickedTabId)
                 editFinished();
            return false;
        }
        if (event->type() == QEvent::MouseButtonDblClick) {
            //perhaps we need to start a new name editing action...
            QMouseEvent* me = static_cast<QMouseEvent*>(event);
            if (me->button() != Qt::LeftButton)
                return result;
            int clickedTabId = tabAt(me->pos());
            if (clickedTabId == -1)
                return result;
            if (!isTabEnabled(clickedTabId))
                return result;
            triggerRename(clickedTabId);
            return true; //no further handling of this event is required
        }
    }

    //handle some events on the line edit to make it behave itself nicely as a rename editor
    if (obj == lineEdit_) {
        if (event->type() == QEvent::KeyPress) {
            QKeyEvent* ke = static_cast<QKeyEvent*>(event);
            if (ke->key() == Qt::Key_Escape) {
                lineEdit_->deleteLater();
                lineEdit_ = nullptr;
                return true; //no further handling of this event is required
            } else if (ke->key() == Qt::Key_Return) {
                editFinished();
            }
        }
    }

    return result;
}
예제 #17
0
void CroppingLabel::editingFinished()
{
    hideTextEdit();
    QString newText = textEdit->text().trimmed().remove(QRegExp("[\\t\\n\\v\\f\\r\\x0000]"));

    if (origText != newText)
        emit editFinished(textEdit->text());

    emit editRemoved();
}
예제 #18
0
void EditGroupWidget::cancel()
{
    if (!m_group->iconUuid().isNull() &&
            !m_database->metadata()->containsCustomIcon(m_group->iconUuid())) {
        m_group->setIcon(Entry::DefaultIconNumber);
    }

    m_group = Q_NULLPTR;
    m_database = Q_NULLPTR;
    Q_EMIT editFinished(false);
}
예제 #19
0
void BoolEdit::onButtonClicked(bool yesButton)
{
    // Update GUI
    mYesButton->setChecked(yesButton);
    mNoButton->setChecked(!yesButton);

    // Update value, submit if necessary
    mValue = yesButton;
    if(mAutoSubmit){
        editFinished(yesButton);
    }
}
예제 #20
0
void FormatDialog::dialogFinished(const int &ret)
{

    if (ret == KDialog::Accepted) {
        if (!m_oldFormat.isEmpty()) {
            emit editFinished(m_oldFormat, formatEdit->text(), commandEdit->text());
        } else {
            emit addFinished(formatEdit->text(), commandEdit->text());
        }
    }

}
예제 #21
0
void FrmCell::onEditLeave(const bool bFinished, const bool bDiscarded)
{
    if (bFinished){

        if (!bDiscarded){
            emit applyChanges2FrameDetails();
            return;
        }else{
            editFinished();
        }

    }
    toolButton->setEnabled(!bFinished);
}
void DatabaseRepairWidget::openDatabase()
{
    CompositeKey masterKey;

    if (m_ui->checkPassword->isChecked()) {
        masterKey.addKey(PasswordKey(m_ui->editPassword->text()));
    }

    if (m_ui->checkKeyFile->isChecked()) {
        FileKey key;
        QString keyFilename = m_ui->comboKeyFile->currentText();
        QString errorMsg;
        if (!key.load(keyFilename, &errorMsg)) {
            MessageBox::warning(this, tr("Error"), tr("Can't open key file").append(":\n").append(errorMsg));
            Q_EMIT editFinished(false);
        }
        masterKey.addKey(key);
    }

    KeePass2Repair repair;

    QFile file(m_filename);
    if (!file.open(QIODevice::ReadOnly)) {
        // TODO: error message
        Q_EMIT editFinished(false);
        return;
    }
    if (m_db) {
        delete m_db;
    }
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    KeePass2Repair::RepairResult repairResult = repair.repairDatabase(&file, masterKey);
    QApplication::restoreOverrideCursor();

    switch (repairResult) {
    case KeePass2Repair::NothingTodo:
        MessageBox::information(this, tr("Error"), tr("Database opened fine. Nothing to do."));
        Q_EMIT editFinished(false);
        return;
    case KeePass2Repair::UnableToOpen:
        MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
                            .append(repair.errorString()));
        Q_EMIT editFinished(false);
        return;
    case KeePass2Repair::RepairSuccess:
        m_db = repair.database();
        MessageBox::warning(this, tr("Success"), tr("The database has been successfully repaired\nYou can now save it."));
        Q_EMIT editFinished(true);
        return;
    case KeePass2Repair::RepairFailed:
        MessageBox::warning(this, tr("Error"), tr("Unable to repair the database."));
        Q_EMIT editFinished(false);
        return;
    }
}
void FrmMinorStrata::onEditLeave(const bool bFinished, const bool bDiscarded)
{
    if (bFinished){

        if (!bDiscarded && m_sample->bLogBook){
            //apply changes to temp frame
            emit applyChanges2FrameDetails();
            return;
        }else{
            editFinished();
        }

    }

    toolButton->setEnabled(!bFinished);
}
예제 #24
0
int FrmCatch::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = PreviewTab::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: createRecord(); break;
        case 1: previewRow((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break;
        case 2: onItemSelection(); break;
        case 3: onEditLeave((*reinterpret_cast< const bool(*)>(_a[1])),(*reinterpret_cast< const bool(*)>(_a[2]))); break;
        case 4: editFinished(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
void ChangeMasterKeyWidget::generateKey()
{
    m_key.clear();

    if (m_ui->passwordGroup->isChecked()) {
        if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) {
            if (m_ui->enterPasswordEdit->text().isEmpty()) {
                if (MessageBox::question(this, tr("Question"),
                                         tr("Do you really want to use an empty string as password?"),
                                         QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
                    return;
                }
            }
            m_key.addKey(PasswordKey(m_ui->enterPasswordEdit->text()));
        }
        else {
            MessageBox::warning(this, tr("Error"), tr("Different passwords supplied."));
            m_ui->enterPasswordEdit->setText("");
            m_ui->repeatPasswordEdit->setText("");
            return;
        }
    }
    if (m_ui->keyFileGroup->isChecked()) {
        FileKey fileKey;
        QString errorMsg;
        if (!fileKey.load(m_ui->keyFileCombo->currentText(), &errorMsg)) {
            MessageBox::critical(this, tr("Failed to set key file"),
                                 tr("Failed to set %1 as the Key file:\n%2")
                                 .arg(m_ui->keyFileCombo->currentText(), errorMsg));
            return;
        }
        m_key.addKey(fileKey);
    }

    if (m_ui->challengeResponseGroup->isChecked()) {
        int i = m_ui->challengeResponseCombo->currentIndex();
        i = m_ui->challengeResponseCombo->itemData(i).toInt();
        YkChallengeResponseKey key(i);

        m_key.addChallengeResponseKey(key);
    }

    Q_EMIT editFinished(true);
}
예제 #26
0
void SettingsWidget::saveSettings()
{
    config()->set("RememberLastDatabases", m_generalUi->rememberLastDatabasesCheckBox->isChecked());
    config()->set("AutoReopenLastDatabases", m_generalUi->rememberLastDatabasesCheckBox->isChecked()
                                          && m_generalUi->autoReopenLastDatabases->isChecked());
    config()->set("ModifiedOnExpandedStateChanges", m_generalUi->modifiedExpandedChangedCheckBox->isChecked());
    config()->set("AutoSaveAfterEveryChange", m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked());
    config()->set("AutoSaveOnExit", m_generalUi->autoSaveOnExitCheckBox->isChecked());
    config()->set("ReloadBehavior", m_generalUi->reloadBehavior->currentIndex());
    config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key());
    config()->set("GlobalAutoTypeModifiers", static_cast<int>(m_generalUi->autoTypeShortcutWidget->modifiers()));
    config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked());
    config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value());

    Q_FOREACH (const ExtraPage& page, m_extraPages)
        page.saveSettings();

    Q_EMIT editFinished(true);
}
void DatabaseOpenWidget::openDatabase()
{
  KeePass2Reader reader;
  CompositeKey   masterKey = databaseKey();
  if (m_db) {
    delete m_db;
  }
  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
  m_db = reader.readDatabase(m_filename, masterKey);
  QApplication::restoreOverrideCursor();

  if (m_db) {
    // signal switched focus to opened database view
    Q_EMIT editFinished(true);
  }
  else {
        MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n")
                            .append(reader.errorString()));
    m_ui->editPassword->clear();
  }
}
예제 #28
0
void EditGroupWidget::cancel()
{
    if (!m_group->iconUuid().isNull() && !m_db->metadata()->containsCustomIcon(m_group->iconUuid())) {
        m_group->setIcon(Entry::DefaultIconNumber);
    }

    if (isModified()) {
        auto result = MessageBox::question(this,
                                           QString(),
                                           tr("Entry has unsaved changes"),
                                           MessageBox::Cancel | MessageBox::Save | MessageBox::Discard,
                                           MessageBox::Cancel);
        if (result == MessageBox::Save) {
            apply();
            setModified(false);
        }
    }

    clear();
    emit editFinished(false);
}
예제 #29
0
void FrmCatch::onEditLeave(const bool bFinished, const bool bDiscarded)
{
    if (bFinished) {
        editFinished();
    }
}
예제 #30
0
void EditEntryWidget::saveEntry()
{
    if (m_history) {
        m_entry = Q_NULLPTR;
        m_database = Q_NULLPTR;
        m_entryAttributes->clear();
        m_entryAttachments->clear();
        Q_EMIT editFinished(false);
        return;
    }

    if (!passwordsEqual()) {
        QMessageBox::warning(this, tr("Error"), tr("Different passwords supplied."));
        return;
    }

    if (m_advancedUi->attributesView->currentIndex().isValid()) {
        QString key = m_attributesModel->keyByIndex(m_advancedUi->attributesView->currentIndex());
        m_entryAttributes->set(key, m_advancedUi->attributesEdit->toPlainText(),
                               m_entryAttributes->isProtected(key));
    }

    m_currentAttribute = QPersistentModelIndex();

    // must stand before beginUpdate()
    // we don't want to create a new history item, if only the history has changed
    m_entry->removeHistoryItems(m_historyModel->deletedEntries());

    if (!m_create) {
        m_entry->beginUpdate();
    }

    m_entry->setTitle(m_mainUi->titleEdit->text());
    m_entry->setUsername(m_mainUi->usernameEdit->text());
    m_entry->setUrl(m_mainUi->urlEdit->text());
    m_entry->setPassword(m_mainUi->passwordEdit->text());
    m_entry->setExpires(m_mainUi->expireCheck->isChecked());
    m_entry->setExpiryTime(m_mainUi->expireDatePicker->dateTime().toUTC());

    m_entry->setNotes(m_mainUi->notesEdit->toPlainText());

    m_entry->attributes()->copyCustomKeysFrom(m_entryAttributes);
    m_entry->attachments()->copyDataFrom(m_entryAttachments);

    IconStruct iconStruct = m_iconsWidget->save();

    if (iconStruct.number < 0) {
        m_entry->setIcon(Entry::DefaultIconNumber);
    }
    else if (iconStruct.uuid.isNull()) {
        m_entry->setIcon(iconStruct.number);
    }
    else {
        m_entry->setIcon(iconStruct.uuid);
    }

    m_entry->setAutoTypeEnabled(m_autoTypeUi->enableButton->isChecked());
    if (m_autoTypeUi->inheritSequenceButton->isChecked()) {
        m_entry->setDefaultAutoTypeSequence(QString());
    }
    else {
        m_entry->setDefaultAutoTypeSequence(m_autoTypeUi->sequenceEdit->text());
    }

    m_autoTypeAssoc->removeEmpty();
    m_entry->autoTypeAssociations()->copyDataFrom(m_autoTypeAssoc);

    if (!m_create) {
        m_entry->endUpdate();
    }


    m_entry = Q_NULLPTR;
    m_database = Q_NULLPTR;
    m_entryAttributes->clear();
    m_entryAttachments->clear();
    m_autoTypeAssoc->clear();
    m_historyModel->clear();

    Q_EMIT editFinished(true);
}