Subversion Repositories svn1

Rev

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

Rev 198 Rev 199
Line 7... Line 7...
7
#include "ui_qmeditaddendum.h"
7
#include "ui_qmeditaddendum.h"
8
#include    "consts.h"
8
#include    "consts.h"
9
#include    "structs.h"
9
#include    "structs.h"
10
#include    "proto.h"
10
#include    "proto.h"
11
 
11
 
12
QmEditAddendum::QmEditAddendum(const QString &name,QWidget *parent) :
12
QmEditAddendum::QmEditAddendum(const char *name,QWidget *parent) :
13
    QDialog(parent),
13
    QDialog(parent),
14
    ui(new Ui::QmEditAddendum)
14
    ui(new Ui::QmEditAddendum)
15
{
15
{
16
    ui->setupUi(this);
16
    ui->setupUi(this);
17
    connect(ui->buttonBox,SIGNAL(accepted()), this, SLOT(save()));
17
    connect(ui->buttonBox,SIGNAL(accepted()), this, SLOT(save()));
18
    connect(ui->buttonBox,SIGNAL(rejected()), this, SLOT(reject()));
18
    connect(ui->buttonBox,SIGNAL(rejected()), this, SLOT(reject()));
19
 
19
 
20
    //  Attempt to open the file name specified
20
    //  Attempt to open the file name specified
21
    qDebug("Edit: %s", qPrintable(name));
21
    qDebug("Edit: %s", name);
22
    setWindowTitle(name);
22
    setWindowTitle(name);
23
 
23
 
24
    QString addendumFileName(filepath);
-
 
25
    addendumFileName.append(name);
-
 
26
    file.setFileName(addendumFileName);
24
    file.setFileName(name);
27
    qDebug("Try:%s", qPrintable(addendumFileName));
-
 
28
    if ( !file.exists())
-
 
29
    {
-
 
30
        addendumFileName = QCoreApplication::applicationDirPath ();
-
 
31
        addendumFileName.append("/");
-
 
32
        addendumFileName.append(name);
-
 
33
        file.setFileName(addendumFileName);
-
 
34
        qDebug("Try:%s", qPrintable(addendumFileName));
-
 
35
        if ( !file.exists())
-
 
36
        {
-
 
37
             addendumFileName = QDir::currentPath ();
-
 
38
             addendumFileName.append(name);
-
 
39
             file.setFileName(addendumFileName);
-
 
40
             qDebug("Try:%s", qPrintable(addendumFileName));
-
 
41
             if ( !file.exists())
-
 
42
             {
-
 
43
                 qDebug("File not found");
-
 
44
             }
-
 
45
        }
-
 
46
 
-
 
47
    }
-
 
48
 
-
 
49
    if (!file.open(QFile::ReadOnly | QFile::Text)) {
25
    if (!file.open(QFile::ReadOnly | QFile::Text)) {
50
        QMessageBox::warning(this, tr("Application"),
26
        QMessageBox::warning(this, tr("Application"),
51
                             tr("Cannot read file %1:\n%2.")
27
                             tr("Cannot read file %1:\n%2.")
52
                             .arg(name)
28
                             .arg(name)
53
                             .arg(file.errorString()));
29
                             .arg(file.errorString()));