Changeset f5b68a4 for src/gui


Ignore:
Timestamp:
04/15/10 14:06:07 (12 years ago)
Author:
kirilma <kirilma@…>
Branches:
master, qt5
Children:
d97bcab
Parents:
d06ae27
Message:

add buttons for refreshm new url and delete and partly implement corresponding actions

also changed Online -> Refresh
delete action is not implemented yet

Location:
src/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gui/importschedulewidget.cpp

    rd06ae27 rf5b68a4  
    5454    cancel->hide();
    5555    connect(online, SIGNAL(clicked()), SLOT(downloadSchedule()));
     56
     57    connect(changeUrl, SIGNAL(clicked()), SLOT(on_changeUrl()));
     58    connect(newConfFromUrl, SIGNAL(clicked()), SLOT(on_newFromUrl()));
     59    connect(delConf, SIGNAL(clicked()), SLOT(on_delete()));
    5660
    5761    mNetworkAccessManager = new QNetworkAccessManager(this);
     
    119123void ImportScheduleWidget::downloadSchedule()
    120124{
    121     QNetworkRequest request;
    122125
    123126    // TODO: make a nicer GUI
     
    131134    // 4. allow getting the new conference by URL
    132135
    133     QString url_default;
    134     try {
    135         url_default = Conference::getById(Conference::activeConference()).getUrl();
    136     } catch (OrmException& e) {
    137         qWarning() << "failed to get default URL:" << e.text();
     136    // FIXME: it will throw
     137    // GUI should not show this button if there is no active conf
     138    importFromNetwork(Conference::getById(Conference::activeConference()).getUrl());
     139}
     140
     141void ImportScheduleWidget::on_changeUrl()
     142{
     143    // FIXME: it will throw
     144    // GUI should not show this button if there is no active conf
     145    Conference active_conference = Conference::getById(Conference::activeConference());
     146    bool ok = false;
     147    QString new_url =
     148        QInputDialog::getText(this, "URL request", "Enter the new URL for conference schedule"
     149                                , QLineEdit::Normal
     150                                , active_conference.getUrl()
     151                                , &ok);
     152    if (ok) {
     153        active_conference.setUrl(new_url);
     154    }
     155}
     156
     157void ImportScheduleWidget::on_newFromUrl()
     158{
     159    bool ok = false;
     160    QString url = QInputDialog::getText(this, "URL request", "Put the schedule URL", QLineEdit::Normal, "", &ok);
     161    if (ok) {
     162        importFromNetwork(url);
    138163    }
    139164
    140     bool ok = false;
    141     QString url = QInputDialog::getText(this, "URL request", "Put proper schedule URL or let it try with it", QLineEdit::Normal, url_default, &ok);
    142     if (!ok) { // cancel pressed
    143         return;
    144     }
     165}
     166
     167void ImportScheduleWidget::on_delete()
     168{
     169    // TODO: implement
     170}
     171
     172void ImportScheduleWidget::importFromNetwork(const QString& url)
     173{
     174    QNetworkRequest request;
    145175    request.setUrl(QUrl(url));
    146176
  • src/gui/importschedulewidget.h

    rd06ae27 rf5b68a4  
    3939        void networkQueryFinished(QNetworkReply *aReply);
    4040        void downloadSchedule();
     41        void on_changeUrl();
     42        void on_delete();
     43        void on_newFromUrl();
    4144    signals:
    4245        void scheduleImported(int confId);
    4346    private:
     47        void importFromNetwork(const QString& url);
    4448        void importData(const QByteArray &aData, const QString& url);
    4549    private:
  • src/gui/importschedulewidget.ui

    rd06ae27 rf5b68a4  
    77    <x>0</x>
    88    <y>0</y>
    9     <width>699</width>
     9    <width>710</width>
    1010    <height>79</height>
    1111   </rect>
     
    3737     </item>
    3838     <item>
     39      <widget class="QPushButton" name="changeUrl">
     40       <property name="text">
     41        <string>Change Url</string>
     42       </property>
     43      </widget>
     44     </item>
     45     <item>
    3946      <widget class="QPushButton" name="online">
     47       <property name="enabled">
     48        <bool>true</bool>
     49       </property>
     50       <property name="minimumSize">
     51        <size>
     52         <width>10</width>
     53         <height>0</height>
     54        </size>
     55       </property>
    4056       <property name="text">
    41         <string>Online</string>
     57        <string>Reresh</string>
     58       </property>
     59      </widget>
     60     </item>
     61     <item>
     62      <widget class="QPushButton" name="newConfFromUrl">
     63       <property name="text">
     64        <string>From Url</string>
    4265       </property>
    4366      </widget>
     
    5275       </property>
    5376       <property name="text">
    54         <string>Browse</string>
     77        <string>From File</string>
     78       </property>
     79      </widget>
     80     </item>
     81     <item>
     82      <widget class="QPushButton" name="delConf">
     83       <property name="text">
     84        <string>Delete</string>
    5585       </property>
    5686      </widget>
Note: See TracChangeset for help on using the changeset viewer.