connect(nowTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &)));
// event search button clicked
connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked()));
+ connect(searchAgainButton, SIGNAL(clicked()), SLOT(searchAgainClicked()));
// event conference map button clicked
connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
//
}
searchTreeView->hide();
- searchDayNavigator->hide();
+ searchVerticalWidget->hide();
+ searchHead->show();
// open dialog for given Event ID
// this is used in case Alarm Dialog request application to start
searchTreeView->reset();
int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,AppSettings::confId());
if( eventsCount ){
- searchDayNavigator->show();
+ searchVerticalWidget->show();
+ searchAgainButton->show();
searchTreeView->show();
+ searchHead->hide();
}
else{
searchTreeView->hide();
- searchDayNavigator->hide();
+ searchVerticalWidget->hide();
+ searchHead->show();
}
}
updateSearchView( Conference::getById(AppSettings::confId()).start() );
}
+void MainWindow::searchAgainClicked()
+{
+ searchHead->show();
+ searchAgainButton->hide();
+}
+
void MainWindow::conferenceMapClicked()
{
void displayMap(const QModelIndex &aIndex);
void displayWarning(const QModelIndex &aIndex);
void searchClicked();
+ void searchAgainClicked();
void conferenceMapClicked();
void tabHasChanged(int aIndex);
void eventHasChanged(int aEventId);
</item>
</layout>
</widget>
- <widget class="QWidget" name="searchTab" >
- <attribute name="title" >
+ <widget class="QWidget" name="searchTab">
+ <attribute name="title">
<string>Search</string>
</attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
- <layout class="QFormLayout" name="searchHeadLayout" >
- <property name="fieldGrowthPolicy" >
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <item row="0" column="0" >
- <widget class="QCheckBox" name="searchTitle" >
- <property name="text" >
- <string>Title</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QLineEdit" name="searchEdit" >
- <property name="enabled" >
- <bool>true</bool>
- </property>
- <property name="toolTip" >
- <string>type a keyword to search</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="searchButton" >
- <property name="text" >
- <string>Search</string>
- </property>
- <property name="checkable" >
- <bool>false</bool>
- </property>
- <property name="autoDefault" >
- <bool>false</bool>
- </property>
- <property name="default" >
- <bool>true</bool>
- </property>
- <property name="flat" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <widget class="QCheckBox" name="searchAbstract" >
- <property name="text" >
- <string>Abstract</string>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QWidget" name="searchVerticalWidget" native="true">
+ <layout class="QVBoxLayout" name="searchDayNavigatorVerticalLayout">
+ <item>
+ <widget class="QToolButton" name="searchAgainButton">
+ <property name="text">
+ <string>Search again</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextOnly</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="DayNavigatorWidget" name="searchDayNavigator" native="true">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
- <layout class="QHBoxLayout" name="searchDayNavigatorHorizontalLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <spacer name="horizontalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
+ <widget class="QWidget" name="searchHead" native="true">
+ <layout class="QFormLayout" name="searchHeadLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="searchTitle">
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="searchEdit">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>type a keyword to search</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="searchButton">
+ <property name="text">
+ <string>Search</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="searchAbstract">
+ <property name="text">
+ <string>Abstract</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
- <widget class="DayNavigatorWidget" native="1" name="searchDayNavigator" >
- <property name="maximumSize" >
+ <widget class="TreeView" name="searchTreeView">
+ <property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</property>
</widget>
</item>
- <item>
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</item>
- <item>
- <widget class="TreeView" name="searchTreeView" >
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="conferenceTab" >
QString strQuery = QString("SELECT %1 FROM EVENT INNER JOIN SEARCH_EVENT USING (xid_conference, id) ").arg(columnsForSelect());
strQuery += QString("WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BY %1").arg(orderBy);
qDebug() << strQuery;
+ QList<Event> list;
QSqlQuery query;
- query.prepare( strQuery );
- query.bindValue(":conf", conferenceId);
- query.bindValue(":start", convertToDb(date, QVariant::DateTime));
- query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
-
- return load(query);
+ try{
+ if( !query.prepare( strQuery ) ){
+ qDebug() << "QSqlQuery.prepare error";
+ throw OrmSqlException( query.lastError().text() );
+ }
+
+ query.bindValue(":conf", conferenceId);
+ query.bindValue(":start", convertToDb(date, QVariant::DateTime));
+ query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
+
+ list = load(query);
+ }
+ catch(OrmException &e)
+ {
+ qDebug() << "getSearchResultByDate error: " << e.text();
+ }
+ catch(...){
+ qDebug() << "getSearchResultByDate failed ...";
+ }
+ return list;
}
QString mText;
};
-class OrmNoObjectException : OrmException
+class OrmNoObjectException : public OrmException
{
public:
OrmNoObjectException() : OrmException("No object exception"){};
~OrmNoObjectException(){};
};
-class OrmSqlException : OrmException
+class OrmSqlException : public OrmException
{
public:
OrmSqlException(const QString& text) : OrmException( QString("Sql error: ") + text ) {};
query.exec("CREATE TABLE CONFERENCE ( \
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , \
- title VARCHAR NOT NULL , \
+ title VARCHAR UNIQUE NOT NULL , \
subtitle VARCHAR, \
venue VARCHAR, \
city VARCHAR NOT NULL , \
query.exec("CREATE TABLE ROOM ( \
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , \
- name VARCHAR NOT NULL , \
+ name VARCHAR UNIQUE NOT NULL , \
picture VARCHAR NOT NULL)");
query.exec("CREATE TABLE PERSON ( \
id INTEGER PRIMARY KEY NOT NULL , \
- name VARCHAR NOT NULL)");
+ name VARCHAR UNIQUE NOT NULL)");
query.exec("CREATE TABLE EVENT ( \
xid_conference INTEGER NOT NULL, \
xid_conference INTEGER NOT NULL , \
xid_event INTEGER NOT NULL , \
xid_person INTEGER NOT NULL, \
- FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id), \
+ FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), \
+ FOREIGN KEY(xid_event) REFERENCES EVENT(id), \
FOREIGN KEY(xid_person) REFERENCES PERSON(id))");
query.exec("CREATE TABLE EVENT_ROOM ( \
xid_conference INTEGER NOT NULL , \
xid_event INTEGER NOT NULL , \
xid_room INTEGER NOT NULL, \
- FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id), \
+ FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), \
+ FOREIGN KEY(xid_event) REFERENCES EVENT(id), \
FOREIGN KEY(xid_room) REFERENCES ROOM(id))");
query.exec("CREATE TABLE LINK ( \
xid_event INTEGER NOT NULL, \
name VARCHAR, \
url VARCHAR NOT NULL, \
- FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id))");
+ FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), \
+ FOREIGN KEY(xid_event) REFERENCES EVENT(id)");
}
else
{
// DROP
execQuery( db, "DROP TABLE IF EXISTS SEARCH_EVENT;");
// CREATE
- execQuery( db, "CREATE TABLE SEARCH_EVENT ( xid_conference INTEGER NOT NULL, id INTEGER NOT NULL );");
+ execQuery( db, "CREATE TEMP TABLE SEARCH_EVENT ( xid_conference INTEGER NOT NULL, id INTEGER NOT NULL );");
// INSERT
QString query = QString("INSERT INTO SEARCH_EVENT ( xid_conference, id) "
"SELECT xid_conference, id FROM EVENT "