AutoFillManager::AutoFillManager(QWidget* parent) : QWidget(parent) , ui(new Ui::AutoFillManager) , m_passwordsShown(false) { ui->setupUi(this); connect(ui->removePass, SIGNAL(clicked()), this, SLOT(removePass())); connect(ui->removeAllPass, SIGNAL(clicked()), this, SLOT(removeAllPass())); connect(ui->editPass, SIGNAL(clicked()), this, SLOT(editPass())); connect(ui->showPasswords, SIGNAL(clicked()), this, SLOT(showPasswords())); connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept())); connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept())); QTimer::singleShot(0, this, SLOT(loadPasswords())); }
void AutoFillManager::importPasswords() { const QString &fileName = QFileDialog::getOpenFileName(this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml"); if (fileName.isEmpty()) { return; } QFile file(fileName); if (!file.open(QFile::ReadOnly)) { ui->importExportLabel->setText(tr("Cannot read file!")); return; } bool status = AutoFill::importPasswords(file.readAll()); file.close(); ui->importExportLabel->setText(status ? tr("Successfully imported") : tr("Error while importing!")); loadPasswords(); }
int main() { printf("PID: %d\n", getpid()); loadPasswords(); while(1) { if(validateUser()) { printf("Welcome\n"); if(fork() == 0) { char *argv[] = {"./sh", (char *) 0 }; execvp("./sh", argv); } else { int pid, status; pid = wait(&status); if(WEXITSTATUS(status) == 123) exit(123); } } else printf("Invalid username or password. Please try again."); } return 0; }
AutoFillManager::AutoFillManager(QWidget* parent) : QWidget(parent) , ui(new Ui::AutoFillManager) , m_passwordManager(mApp->autoFill()->passwordManager()) , m_passwordsShown(false) { ui->setupUi(this); if (isRightToLeft()) { ui->treePass->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter); ui->treePass->headerItem()->setTextAlignment(1, Qt::AlignRight | Qt::AlignVCenter); ui->treePass->headerItem()->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter); ui->treePass->setLayoutDirection(Qt::LeftToRight); ui->treeExcept->setLayoutDirection(Qt::LeftToRight); } connect(ui->removePass, SIGNAL(clicked()), this, SLOT(removePass())); connect(ui->removeAllPass, SIGNAL(clicked()), this, SLOT(removeAllPass())); connect(ui->editPass, SIGNAL(clicked()), this, SLOT(editPass())); connect(ui->showPasswords, SIGNAL(clicked()), this, SLOT(showPasswords())); connect(ui->search, SIGNAL(textChanged(QString)), ui->treePass, SLOT(filterString(QString))); connect(ui->changeBackend, SIGNAL(clicked()), this, SLOT(changePasswordBackend())); connect(ui->backendOptions, SIGNAL(clicked()), this, SLOT(showBackendOptions())); connect(m_passwordManager, SIGNAL(passwordBackendChanged()), this, SLOT(currentPasswordBackendChanged())); connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept())); connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept())); QMenu* menu = new QMenu(this); menu->addAction(tr("Import Passwords from File..."), this, SLOT(importPasswords())); menu->addAction(tr("Export Passwords to File..."), this, SLOT(exportPasswords())); ui->importExport->setMenu(menu); ui->importExport->setPopupMode(QToolButton::InstantPopup); ui->search->setPlaceholderText(tr("Search")); // Password backends ui->currentBackend->setText(QString("<b>%1</b>").arg(m_passwordManager->activeBackend()->name())); ui->backendOptions->setVisible(m_passwordManager->activeBackend()->hasSettings()); // Load passwords QTimer::singleShot(0, this, SLOT(loadPasswords())); }
AutoFillManager::AutoFillManager(QWidget* parent) : QWidget(parent) , ui(new Ui::AutoFillManager) , m_passwordsShown(false) { ui->setupUi(this); connect(ui->removePass, SIGNAL(clicked()), this, SLOT(removePass())); connect(ui->removeAllPass, SIGNAL(clicked()), this, SLOT(removeAllPass())); connect(ui->editPass, SIGNAL(clicked()), this, SLOT(editPass())); connect(ui->showPasswords, SIGNAL(clicked()), this, SLOT(showPasswords())); connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept())); connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept())); QMenu* menu = new QMenu(this); menu->addAction(tr("Import Passwords from File..."), this, SLOT(importPasswords())); menu->addAction(tr("Export Passwords to File..."), this, SLOT(exportPasswords())); ui->importExport->setMenu(menu); ui->importExport->setPopupMode(QToolButton::InstantPopup); QTimer::singleShot(0, this, SLOT(loadPasswords())); }