Esempio n. 1
0
void FontSettingsPage::openCopyColorSchemeDialog()
{
    QInputDialog *dialog = new QInputDialog(d_ptr->m_ui->copyButton->window());
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->setInputMode(QInputDialog::TextInput);
    dialog->setWindowTitle(tr("Copy Color Scheme"));
    dialog->setLabelText(tr("Color scheme name:"));
    dialog->setTextValue(tr("%1 (copy)").arg(d_ptr->m_value.colorScheme().displayName()));

    connect(dialog, &QInputDialog::textValueSelected, this, &FontSettingsPage::copyColorScheme);
    dialog->open();
}
Esempio n. 2
0
void FolderWizardTargetPage::slotAddRemoteFolder()
{
    QTreeWidgetItem *current = _ui.folderTreeWidget->currentItem();

    QString parent('/');
    if (current) {
        parent = current->data(0, Qt::UserRole).toString();
    }

    QInputDialog *dlg = new QInputDialog(this);

    dlg->setWindowTitle(tr("Add Remote Folder"));
    dlg->setLabelText(tr("Enter the name of the new folder:"));
    dlg->setTextValue(parent);
    dlg->open(this, SLOT(slotCreateRemoteFolder(QString)));
    dlg->setAttribute(Qt::WA_DeleteOnClose);
}
Esempio n. 3
0
void PlaylistWindow::on_tabWidget_tabBarDoubleClicked(int index)
{
    auto widget = reinterpret_cast<QDrawnPlaylist *>(ui->tabWidget->widget(index));
    QUuid tabUuid = widget->uuid();
    if (tabUuid.isNull())
        return;
    QInputDialog *qid = new QInputDialog(this);
    qid->setAttribute(Qt::WA_DeleteOnClose);
    qid->setWindowModality(Qt::ApplicationModal);
    qid->setWindowTitle(tr("Enter playlist name"));
    qid->setTextValue(ui->tabWidget->tabText(index));
    connect(qid, &QInputDialog::accepted, [=]() {
        int tabIndex = ui->tabWidget->indexOf(widget);
        if (tabIndex < 0)
            return;
        auto pl = PlaylistCollection::getSingleton()->playlistOf(tabUuid);
        if (!pl)
            return;
        pl->setTitle(qid->textValue());
        ui->tabWidget->setTabText(tabIndex, qid->textValue());
    });
    qid->show();
}
Esempio n. 4
0
/**
 * Decrypts a text using cipher text and cipher key
 * Chooses between a permanent or a individual password using the preferences
 */
void MainWindow::on_actionDecrypt_triggered()
{
    if (passwordUsed)
    {
        query.prepare("SELECT `Password` FROM `password`;");
        query.exec();
        QString passwordBase;
        while ( query.next() ) {
            passwordBase = query.value(0).toString();
        }
        QByteArray passwordTemp = QByteArray::fromBase64( passwordBase.toUtf8() );
        password = QString(passwordTemp);

        Regex regex;
        QRegExp rePassword( regex.getPassword() );

        if ( !password.isEmpty() && password.contains(rePassword) )
        {
            decrypted = decrypt(password);
            ui->textEdit_mainWindow_surface->setHtml( QString(decrypted) );
        } else
        {
            QMessageBox::critical(this, tr("Error"), tr("An error has ocurred. Please revise your entries and note the following:\n"
                                                        "A Password must contain at least one upper case letter.\n"
                                                        "A Password must contain at least one lower case letter.\n"
                                                        "A Password must contain at least one numeric digit."));
            qDebug() << "Data could not be decrypted because the password requirements were not met.";
        }
    } else
    {
        bool ok = false;

        QInputDialog* inputDialog = new QInputDialog();
        inputDialog->setAttribute(Qt::WA_DeleteOnClose, true);

        inputDialog->setOptions(QInputDialog::NoButtons);

        password = inputDialog->getText(NULL ,tr("Decryption"),
                                                  tr("Password:"******"", &ok);

        if (ok)
        {
            Regex regex;
            QRegExp rePassword( regex.getPassword() );

            if ( !password.isEmpty() && password.contains(rePassword) )
            {
                decrypted = decrypt(password);
                ui->textEdit_mainWindow_surface->setHtml( QString(decrypted) );
            } else
            {
                QMessageBox::critical(this, tr("Error"), tr("An error has ocurred. Please revise your entries and note the following:\n"
                                                            "A Password must contain at least one upper case letter.\n"
                                                            "A Password must contain at least one lower case letter.\n"
                                                            "A Password must contain at least one numeric digit."));
                qDebug() << "Data could not be decrypted because the password requirements were not met.";
            }
        } else
        {

            inputDialog->reject();
        }
        inputDialog->close();
    }
}