- Timestamp:
- 01/27/10 12:36:29 (13 years ago)
- Branches:
- master, qt5
- Children:
- 1bcd66f
- Parents:
- 6bc425e
- Location:
- src/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/eventdialog.cpp
r6bc425e rce59092 3 3 4 4 #include <QScrollBar> 5 6 #ifdef MAEMO 7 #include <alarm.h> 8 #endif 5 9 6 10 DetailsContainer::DetailsContainer(QWidget *aParent) … … 56 60 #endif 57 61 58 Event event = Event::getById( aEventId,AppSettings::confId());62 Event event = Event::getById(mEventId,AppSettings::confId()); 59 63 60 64 title->setText(event.title()); … … 63 67 mDetails.setDescription(event.description()); 64 68 scrollArea->setWidget(&mDetails); 69 70 connect(favouriteButton, SIGNAL(clicked()), SLOT(favouriteClicked())); 71 connect(alarmButton, SIGNAL(clicked()), SLOT(alarmClicked())); 72 73 if(event.isFavourite()) 74 { 75 favouriteButton->setIcon(QIcon(":/icons/favourite-onBig.png")); 76 } 77 78 if(event.hasAlarm()) 79 { 80 alarmButton->setIcon(QIcon(":/icons/alarm-onBig.png")); 81 } 65 82 } 66 83 84 void EventDialog::favouriteClicked() 85 { 86 Event event = Event::getById(mEventId,AppSettings::confId()); 87 88 if(event.isFavourite()) 89 { 90 event.setFavourite(false); 91 favouriteButton->setIcon(QIcon(":/icons/favourite-offBig.png")); 92 } 93 else 94 { 95 event.setFavourite(true); 96 favouriteButton->setIcon(QIcon(":/icons/favourite-onBig.png")); 97 } 98 event.update("favourite"); 99 qDebug() << " FAVOURITE [" << event.id() << "] -> " << event.isFavourite(); 100 // update EVENT_CONFLICT table 101 event.updateConflicts(); 102 // since the Favourite icon has changed, update TreeViews accordingly 103 // all TreeViews have to listen on this signal 104 emit(eventHasChanged(event.id())); 105 } 106 107 void EventDialog::alarmClicked() 108 { 109 Event event = Event::getById(mEventId,AppSettings::confId()); 110 111 if(event.hasAlarm()) 112 { 113 event.setHasAlarm(false); // update DB 114 alarmButton->setIcon(QIcon(":/icons/alarm-offBig.png")); 115 #ifdef MAEMO 116 // remove alarm from the 'alarmd' alrms list 117 Alarm alarm; 118 alarm.deleteAlarm(event.id()); 119 // TODO: test if removing was successfull 120 #endif /* MAEMO */ 121 } 122 else 123 { 124 event.setHasAlarm(true); 125 alarmButton->setIcon(QIcon(":/icons/alarm-onBig.png")); 126 #ifdef MAEMO 127 // add alarm to the 'alarmd' 128 Alarm alarm; 129 int cookie = alarm.addAlarm(event.id(),QDateTime::currentDateTime().addSecs(10)); 130 qDebug() << "cookie: " << cookie; 131 #endif /* MAEMO */ 132 } 133 event.update("alarm"); 134 qDebug() << " ALARM [" << event.id() << "] -> " << event.hasAlarm(); 135 // since the Alarm icon has changed, update TreeView accordingly 136 // all TreeViews have to listen on this signal 137 emit(eventHasChanged(event.id())); 138 } 139 -
src/gui/eventdialog.h
r6bc425e rce59092 20 20 }; 21 21 22 23 22 class EventDialog : public QDialog, Ui::EventDialog 24 23 { 24 Q_OBJECT 25 25 public: 26 26 EventDialog(const int &aEventId, QWidget *aParent = NULL); 27 27 ~EventDialog() {} 28 private slots: 29 void favouriteClicked(); 30 void alarmClicked(); 31 signals: 32 void eventHasChanged(int aEventId); // emited when user changes some event details, eg. sets it Favourite 28 33 private: 29 34 int mEventId; -
src/gui/eventdialog.ui
r6bc425e rce59092 62 62 <y>0</y> 63 63 <width>418</width> 64 <height>29 6</height>64 <height>294</height> 65 65 </rect> 66 66 </property> … … 70 70 <item> 71 71 <layout class="QHBoxLayout" name="horizontalLayout" > 72 <item> 73 <widget class="QToolButton" name="alarmButton" > 74 <property name="text" > 75 <string>...</string> 76 </property> 77 <property name="icon" > 78 <iconset resource="../icons.qrc" > 79 <normaloff>:/icons/alarm-offBig.png</normaloff>:/icons/alarm-offBig.png</iconset> 80 </property> 81 </widget> 82 </item> 83 <item> 84 <widget class="QToolButton" name="favouriteButton" > 85 <property name="text" > 86 <string>...</string> 87 </property> 88 <property name="icon" > 89 <iconset resource="../icons.qrc" > 90 <normaloff>:/icons/favourite-offBig.png</normaloff>:/icons/favourite-offBig.png</iconset> 91 </property> 92 </widget> 93 </item> 72 94 <item> 73 95 <spacer name="horizontalSpacer" > … … 96 118 </layout> 97 119 </widget> 98 <resources/> 120 <resources> 121 <include location="../icons.qrc" /> 122 </resources> 99 123 <connections> 100 124 <connection> -
src/gui/tabcontainer.cpp
r6bc425e rce59092 137 137 138 138 EventDialog dialog(static_cast<Event*>(aIndex.internalPointer())->id(),this); 139 connect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); 139 140 dialog.exec(); 141 disconnect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int))); 140 142 } 141 143
Note: See TracChangeset
for help on using the changeset viewer.