Ignore:
Timestamp:
01/22/10 08:36:35 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
ab6110b
Parents:
8b71fb3
Message:

sanity check for consitency of confId in AppSettings? and the DB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r8b71fb3 rb128673  
    2626    setupUi(this);
    2727
     28    // create "SQLITE" DB instance/connection
     29    // opens DB connection (needed for EventModel)
     30    mSqlEngine = new SqlEngine(this);
     31    mSqlEngine->initialize();
     32
     33    // Sanity check for existence of any Conference in the DB
     34    // it AppSettings::confId() is 0, but there are any Conference(s) in the DB
     35    // set the confId in the AppSettings for the ID of the first conference in the DB
     36    QList<Conference> confs = Conference::getAll();
     37    if(!confs.count()) // no conference(s) in the DB
     38    {
     39        AppSettings::setConfId(0); // no conference in the DB
     40    }
     41    else
     42    {
     43        if(AppSettings::confId() == 0)
     44            AppSettings::setConfId(confs[0].id());
     45    }
     46
    2847    // connect Menu actions
    2948    connect(actionImportSchedule, SIGNAL(triggered()), SLOT(importSchedule()));
    3049    connect(actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    3150    connect(actionAboutApplication, SIGNAL(triggered()), SLOT(aboutApp()));
    32 
    33     // create "SQLITE" DB instance/connection
    34     // opens DB connection (needed for EventModel)
    35     mSqlEngine = new SqlEngine(this);
    36     mSqlEngine->initialize();
    3751
    3852    //update track map
Note: See TracChangeset for help on using the changeset viewer.