modifications to import-schedule dialog
authorpavelpa <pavelpa@localhost>
Thu, 21 Jan 2010 22:28:04 +0000 (22:28 +0000)
committerpavelpa <pavelpa@localhost>
Thu, 21 Jan 2010 22:28:04 +0000 (22:28 +0000)
 - closed automatically after parsing/importing schedule

src/gui/importscheduledialog.cpp
src/gui/importscheduledialog.ui
src/sql/schedulexmlparser.cpp
src/sql/schedulexmlparser.h

index c42d18d..a87f36f 100644 (file)
@@ -15,7 +15,9 @@ ImportScheduleDialog::ImportScheduleDialog(SqlEngine *aSqlEngine, QWidget *aPare
     setupUi(this);
 
     mXmlParser = new ScheduleXmlParser(this);
-    connect(mXmlParser, SIGNAL(progressStatus(int)), this, SLOT(showParsingProgress(int)));
+    connect(mXmlParser, SIGNAL(progressStatus(int)), SLOT(showParsingProgress(int)));
+    connect(mXmlParser, SIGNAL(parsingSchedule(const QString &)), SLOT(setWindowTitle(const QString &)));
+
     connect(import, SIGNAL(clicked()), SLOT(importSchedule()));
     connect(search, SIGNAL(clicked()), SLOT(searchSchedule()));
     progressBar->hide();
@@ -39,7 +41,6 @@ void ImportScheduleDialog::showParsingProgress(int progress)
 void ImportScheduleDialog::searchSchedule()
 {
     mScheduleFileName = QFileDialog::getOpenFileName(this, tr("Select Conference Schedule"), QDir::homePath(), tr("Schedule Files (*.xml)"));
-    fileName->setText(mScheduleFileName);
     if(QFile::exists(mScheduleFileName))
         import->setEnabled(true);
     else
@@ -63,6 +64,7 @@ void ImportScheduleDialog::importSchedule()
     {
         progressBar->show();
         mXmlParser->parseData(data,mSqlEngine);
+        close();
     }
 }
 
index d7771a5..cea270f 100644 (file)
@@ -5,47 +5,22 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>408</width>
-    <height>118</height>
+    <width>330</width>
+    <height>74</height>
    </rect>
   </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle" >
    <string>Import schedule</string>
   </property>
   <layout class="QGridLayout" name="gridLayout" >
    <item row="0" column="0" >
     <layout class="QVBoxLayout" name="verticalLayout" >
-     <item>
-      <layout class="QHBoxLayout" name="horizontalLayout" >
-       <item>
-        <widget class="QLabel" name="fileName" >
-         <property name="text" >
-          <string>Select conference schedule file</string>
-         </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>
-       <item>
-        <widget class="QPushButton" name="search" >
-         <property name="text" >
-          <string>Search</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
      <item>
       <widget class="QProgressBar" name="progressBar" >
        <property name="value" >
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_2" >
+       <item>
+        <widget class="QPushButton" name="search" >
+         <property name="text" >
+          <string>Search</string>
+         </property>
+        </widget>
+       </item>
        <item>
         <spacer name="horizontalSpacer_2" >
          <property name="orientation" >
index 88c4686..01ddeb5 100644 (file)
@@ -40,6 +40,7 @@ void ScheduleXmlParser::parseData(const QByteArray &aData, SqlEngine *aDBEngine)
             conference["timeslot_duration"] = conferenceElement.firstChildElement("timeslot_duration").text(); // time
             aDBEngine->addConferenceToDB(conference);
             confId = conference["id"].toInt();
+            emit(parsingSchedule(conference["title"]));
         }
 
         // we need to get count of all events in order to emit 'progressStatus' signal
index 13df2a9..f5ecfb5 100644 (file)
@@ -16,6 +16,7 @@ class ScheduleXmlParser : public QObject
 \r
     signals:\r
         void progressStatus(int aStatus);\r
+        void parsingSchedule(const QString &aTitle);\r
 };\r
 \r
 #endif /* SCHEDULEXMLPARSER_H_ */\r