Subversion Repositories svn1

Rev

Rev 380 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 380 Rev 393
Line 83... Line 83...
83
    {
83
    {
84
        fileName.append(".cnf");
84
        fileName.append(".cnf");
85
    }
85
    }
86
    if (cnfFile.isEmpty())
86
    if (cnfFile.isEmpty())
87
    {
87
    {
88
        fileName = QFileDialog::getOpenFileName(0, "Select Config File",
88
        fileName = QFileDialog::getSaveFileName(0, "Select or Create new config file",
89
                                                         filepath,
89
                                                filepath,
90
                                                         "Data (*.cnf);;All (*.*)",
90
                                                "Data (*.cnf);;All (*.*)",
91
                                                         0,
91
                                                0,
92
                                                         0
-
 
93
                                                         );
92
                                                QFileDialog::DontConfirmOverwrite);
94
    }
93
    }
95
 
94
 
96
    //  No file selected
95
    //  No file selected
97
    //  Just exit
96
    //  Just exit
98
    if (fileName.isEmpty())
97
    if (fileName.isEmpty())
Line 111... Line 110...
111
 
110
 
112
    strncpy(filepath, qPrintable(info.absolutePath()), sizeof(filepath)-3);
111
    strncpy(filepath, qPrintable(info.absolutePath()), sizeof(filepath)-3);
113
    strcat(filepath, "/");
112
    strcat(filepath, "/");
114
    qDebug("FilePath:%s", filepath );
113
    qDebug("FilePath:%s", filepath );
115
 
114
 
-
 
115
    // Create new config if none found
-
 
116
    if (!info.exists()) {
116
    if ( !open_read_config() )
117
        write_config();
117
    {
118
    }
-
 
119
 
118
        if (QMessageBox::Cancel == QMessageBox::question ( 0,
120
    if ( info.exists() ) {
119
                                                       "Config Load Error",
-
 
120
                                                       "Cannot load or read configuration file.\n"
-
 
121
                                                       "If you continue a new configuration will be created\n"
-
 
122
                                                       "If you cancel then the application will terminate.",
-
 
123
                                                       QMessageBox::Ok | QMessageBox::Cancel
-
 
-
 
121
 
124
                                                       ) )
122
        if ( !open_read_config() )
125
        {
123
        {
-
 
124
            if (QMessageBox::Cancel == QMessageBox::question ( 0,
-
 
125
                                                           "Config Load Error",
-
 
126
                                                           "Cannot load or read configuration file.\n"
-
 
127
                                                           "If you continue a new configuration will be created\n"
-
 
128
                                                           "If you cancel then the application will terminate.",
-
 
129
                                                           QMessageBox::Ok | QMessageBox::Cancel
-
 
130
                                                           ) )
-
 
131
            {
126
            qDebug("Cancel to bad config");
132
                qDebug("Cancel to bad config");
127
            exit(2);
133
                exit(2);
-
 
134
            }
128
        }
135
        }
129
    }
136
    }
130
}
137
}
131
 
138
 
132
 
139