Exemplo n.º 1
0
void MainWindow::createKhollo() {
    //Try to load directory preferences
    Preferences pref;
    QString pref_path = pref.dir();

    //Get file name
    QString filename = QFileDialog::getSaveFileName(this, "Enregistrer sous...",
                                                    pref_path + QDir::separator() + "kholloscope",  "KSCOPE (*.kscope)");

    if(filename == "") {
        updateWindow();
        return;
    }

    record(false);
    //Save directory in preferences
    QString dirpath = QFileInfo(filename).absoluteDir().absolutePath();
    pref.setDir(dirpath);

    if(kscopemanager.createFile(filename))
        QMessageBox::information(NULL, "Succès", "Votre kholloscope a été créé.<br />Vous pouvez dès maintenant l'utiliser. :p");

    updateWindow();
    record(QSqlDatabase::database().isOpen());
    return;
}
Exemplo n.º 2
0
void MainWindow::openKhollo() {
    //Try to load directory preferences
    Preferences pref;
    QString pref_path = pref.dir();

    //Get file name
    QString fileDB = QFileDialog::getOpenFileName(this, "Ouvrir un fichier", pref_path + QDir::separator(), "KSCOPE (*.kscope)");

    if(fileDB == "") {
        updateWindow();
        return;
    }

    QString suffix = QFileInfo(fileDB).suffix().toUpper();
    // Check the file suffix
    if(suffix == "KSCOPE")
        openKhollo(fileDB); // Try to open the file
    else
        QMessageBox::critical(this, "Fichier non pris en charge", "Erreur : Fichier " + QFileInfo(fileDB).suffix().toUpper() + " non pris en charge.");

    return;
}