diff options
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/gui/historyform.cpp | 170 | ||||
-rw-r--r-- | src/gui/historyform.h | 16 | ||||
-rw-r--r-- | src/gui/historyform.ui | 859 | ||||
-rw-r--r-- | src/gui/historylistview.cpp | 91 | ||||
-rw-r--r-- | src/gui/historylistview.h | 52 | ||||
-rw-r--r-- | src/sys_settings.cpp | 2 | ||||
-rw-r--r-- | src/userintf.h | 2 |
9 files changed, 589 insertions, 606 deletions
@@ -6,7 +6,6 @@ either of Qt4 and Qt5. Remaining .ui/cpp/h files: - * historyform * mphoneform * selectnicform * selectprofileform diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index b1e8926..5d83504 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -51,7 +51,6 @@ qt4_wrap_cpp(twinkle_MOC logviewform.h numberconversionform.h getprofilenameform.h - historylistview.h address_finder.h qt_translator.h core_strings.h @@ -114,7 +113,6 @@ set(TWINKLE_GUI-SRCS dtmfform.cpp getprofilenameform.cpp gui.cpp - historylistview.cpp logviewform.cpp main.cpp messageformview.cpp diff --git a/src/gui/historyform.cpp b/src/gui/historyform.cpp index 690faf0..eb8a469 100644 --- a/src/gui/historyform.cpp +++ b/src/gui/historyform.cpp @@ -25,10 +25,16 @@ #include "util.h" #include "gui.h" #include "q3listview.h" -#include "historylistview.h" #include "qicon.h" #include "audits/memman.h" #include "historyform.h" + +#define HISTCOL_TIMESTAMP 0 +#define HISTCOL_DIRECTION 1 +#define HISTCOL_FROMTO 2 +#define HISTCOL_SUBJECT 3 +#define HISTCOL_STATUS 4 + /* * Constructs a HistoryForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. @@ -65,11 +71,16 @@ void HistoryForm::languageChange() void HistoryForm::init() { - historyListView->setSorting(HISTCOL_TIMESTAMP, false); - historyListView->setColumnWidthMode(HISTCOL_FROMTO, Q3ListView::Manual); - historyListView->setColumnWidth(HISTCOL_FROMTO, 200); - historyListView->setColumnWidthMode(HISTCOL_SUBJECT, Q3ListView::Manual); - historyListView->setColumnWidth(HISTCOL_SUBJECT, 200); + + m_model = new QStandardItemModel(historyListView); + historyListView->setModel(m_model); + m_model->setColumnCount(5); + + m_model->setHorizontalHeaderLabels(QStringList() << tr("Time") << tr("In/Out") << tr("From/To") << tr("Subject") << tr("Status")); + historyListView->sortByColumn(HISTCOL_TIMESTAMP, Qt::DescendingOrder); + + historyListView->setColumnWidth(HISTCOL_FROMTO, 200); + historyListView->setColumnWidth(HISTCOL_SUBJECT, 200); inCheckBox->setChecked(true); outCheckBox->setChecked(true); @@ -81,17 +92,20 @@ void HistoryForm::init() QIcon inviteIcon(QPixmap(":/icons/images/invite.png")); QIcon deleteIcon(QPixmap(":/icons/images/editdelete.png")); - histPopupMenu = new Q3PopupMenu(this); - MEMMAN_NEW(histPopupMenu); + histPopupMenu = new QMenu(this); itemCall = histPopupMenu->insertItem(inviteIcon, tr("Call..."), this, SLOT(call())); histPopupMenu->insertItem(deleteIcon, tr("Delete"), this, SLOT(deleteEntry())); + + m_pixmapIn = QPixmap(":/icons/images/1leftarrow-yellow.png"); + m_pixmapOut = QPixmap(":/icons/images/1rightarrow.png"); + + m_pixmapOk = QPixmap(":/icons/images/ok.png"); + m_pixmapCancel = QPixmap(":/icons/images/cancel.png"); } void HistoryForm::destroy() { - MEMMAN_DELETE(histPopupMenu); - delete histPopupMenu; } void HistoryForm::loadHistory() @@ -107,23 +121,28 @@ void HistoryForm::loadHistory() unsigned long numberOfCalls = 0; unsigned long totalCallDuration = 0; unsigned long totalConversationDuration = 0; - historyListView->clear(); - list<t_call_record> history; - call_history->get_history(history); - for (list<t_call_record>::iterator i = history.begin(); i != history.end(); i++) { - if (i->direction == t_call_record::DIR_IN && !inCheckBox->isChecked()) { + + std::list<t_call_record> history; + + call_history->get_history(history); + m_history = QList<t_call_record>::fromStdList(history); + + for (int x = 0; x < m_history.size(); x++) { + const t_call_record* cr = &m_history[x]; + + if (cr->direction == t_call_record::DIR_IN && !inCheckBox->isChecked()) { continue; } - if (i->direction == t_call_record::DIR_OUT && !outCheckBox->isChecked()) { + if (cr->direction == t_call_record::DIR_OUT && !outCheckBox->isChecked()) { continue; } - if (i->invite_resp_code < 300 && !successCheckBox->isChecked()) { + if (cr->invite_resp_code < 300 && !successCheckBox->isChecked()) { continue; } - if (i->invite_resp_code >= 300 && !missedCheckBox->isChecked()) { + if (cr->invite_resp_code >= 300 && !missedCheckBox->isChecked()) { continue; } - if (!profile_name_list.contains(i->user_profile.c_str()) && + if (!profile_name_list.contains(cr->user_profile.c_str()) && profileCheckBox->isChecked()) { continue; @@ -132,12 +151,12 @@ void HistoryForm::loadHistory() numberOfCalls++; // Calculate total duration - totalCallDuration += i->time_end - i->time_start; - if (i->time_answer != 0) { - totalConversationDuration += i->time_end - i->time_answer; + totalCallDuration += cr->time_end - cr->time_start; + if (cr->time_answer != 0) { + totalConversationDuration += cr->time_end - cr->time_answer; } - t_user *user_config = phone->ref_user_profile(i->user_profile); + t_user *user_config = phone->ref_user_profile(cr->user_profile); // If the user profile is not active, then use the // first user profile for formatting @@ -145,8 +164,58 @@ void HistoryForm::loadHistory() user_config = phone->ref_users().front(); } - new HistoryListViewItem(historyListView, - *i, user_config, timeLastViewed); + m_model->setRowCount(numberOfCalls); + + for (int j = 0; j < 5; j++) + { + QModelIndex index = m_model->index(m_model->rowCount()-1, j); + + m_model->setData(index, QVariant(x), Qt::UserRole); + switch (j) + { + case HISTCOL_TIMESTAMP: + { + QString time = QString::fromStdString(time2str(cr->time_start, "%d %b %Y %H:%M:%S")); + m_model->setData(index, time); + break; + } + case HISTCOL_DIRECTION: + { + m_model->setData(index, QString::fromStdString(cr->get_direction())); + + m_model->setData(index, (cr->direction == t_call_record::DIR_IN ? + m_pixmapIn : m_pixmapOut), Qt::DecorationRole); + + break; + } + case HISTCOL_FROMTO: + { + std::string address; + + address = (cr->direction == t_call_record::DIR_IN ? + ui->format_sip_address(user_config, + cr->from_display, cr->from_uri) : + ui->format_sip_address(user_config, + cr->to_display, cr->to_uri)); + + m_model->setData(index, QString::fromStdString(address)); + + m_model->setData(index, (cr->invite_resp_code < 300 ? + m_pixmapOk : m_pixmapCancel), Qt::DecorationRole); + break; + } + case HISTCOL_SUBJECT: + { + m_model->setData(index, QString::fromStdString(cr->subject)); + break; + } + case HISTCOL_STATUS: + { + m_model->setData(index, QString::fromStdString(cr->invite_resp_reason)); + break; + } + } + } } numberCallsValueTextLabel->setText(QString().setNum(numberOfCalls)); @@ -161,13 +230,9 @@ void HistoryForm::loadHistory() totalDurationValueTextLabel->setText(durationText); // Make the first entry the selected entry. - Q3ListViewItem *first = historyListView->firstChild(); - if (first) { - historyListView->setSelected(first, true); - showCallDetails(first); - } else { - cdrTextEdit->clear(); - } + historyListView->selectRow(0); + + // showCallDetails(first); } // Update history when triggered by a call back function on the user @@ -208,11 +273,12 @@ void HistoryForm::closeEvent( QCloseEvent *e ) QDialog::closeEvent(e); } -void HistoryForm::showCallDetails(Q3ListViewItem *item) +void HistoryForm::showCallDetails(QModelIndex index) { QString s; - t_call_record cr = ((HistoryListViewItem *)item)->get_call_record(); + int x = m_model->data(index, Qt::UserRole).toInt(); + const t_call_record& cr = m_history[x]; cdrTextEdit->clear(); t_user *user_config = phone->ref_user_profile(cr.user_profile); @@ -307,14 +373,15 @@ void HistoryForm::showCallDetails(Q3ListViewItem *item) cdrTextEdit->setText(s); } -void HistoryForm::popupMenu(Q3ListViewItem *item, const QPoint &pos) +void HistoryForm::popupMenu(QPoint pos) { - if (!item) return; - - HistoryListViewItem *histItem = dynamic_cast<HistoryListViewItem *>(item); - if (!histItem) return; + if (!historyListView->selectionModel()->hasSelection()) + return; + + QModelIndex index = historyListView->selectionModel()->currentIndex(); + int x = m_model->data(index, Qt::UserRole).toInt(); - t_call_record cr = histItem->get_call_record(); + const t_call_record& cr = m_history[x]; // An anonymous caller cannot be called bool canCall = !(cr.direction == t_call_record::DIR_IN && @@ -324,12 +391,10 @@ void HistoryForm::popupMenu(Q3ListViewItem *item, const QPoint &pos) histPopupMenu->popup(pos); } -void HistoryForm::call(Q3ListViewItem *item) +void HistoryForm::call(QModelIndex index) { - if (!item) return; - - HistoryListViewItem *histItem = (HistoryListViewItem *)item; - t_call_record cr = histItem->get_call_record(); + int i = m_model->data(index, Qt::UserRole).toInt(); + const t_call_record& cr = m_history[i]; t_user *user_config = phone->ref_user_profile(cr.user_profile); // If the user profile is not active, then use the first profile @@ -368,26 +433,27 @@ void HistoryForm::call(Q3ListViewItem *item) { hide_user = true; } - emit call(user_config, item->text(HISTCOL_FROMTO), subject, hide_user); + emit call(user_config, m_model->data(m_model->index(index.row(), HISTCOL_FROMTO)).toString(), subject, hide_user); } } void HistoryForm::call(void) { - Q3ListViewItem *item = historyListView->currentItem(); - if (item) call(item); + QModelIndex index = historyListView->selectionModel()->currentIndex(); + if (index.isValid()) call(index); } void HistoryForm::deleteEntry(void) { - Q3ListViewItem *item = historyListView->currentItem(); - HistoryListViewItem *histItem = dynamic_cast<HistoryListViewItem *>(item); - if (!histItem) return; + QModelIndex index = historyListView->selectionModel()->currentIndex(); + int i = m_model->data(index, Qt::UserRole).toInt(); + m_model->removeRow(index.row()); - call_history->delete_call_record(histItem->get_call_record().get_id()); + call_history->delete_call_record(m_history[i].get_id()); } void HistoryForm::clearHistory() { call_history->clear(); + m_model->setRowCount(0); } diff --git a/src/gui/historyform.h b/src/gui/historyform.h index 6de4fc5..d6b06c0 100644 --- a/src/gui/historyform.h +++ b/src/gui/historyform.h @@ -1,7 +1,9 @@ #ifndef HISTORYFORM_H #define HISTORYFORM_H #include "phone.h" -#include <Qt3Support/Q3PopupMenu> +#include <QMenu> +#include <QStandardItemModel> +#include <QPixmap> #include "user.h" #include "ui_historyform.h" @@ -18,9 +20,9 @@ public slots: virtual void update(); virtual void show(); virtual void closeEvent( QCloseEvent * e ); - virtual void showCallDetails( Q3ListViewItem * item ); - virtual void popupMenu( Q3ListViewItem * item, const QPoint & pos ); - virtual void call( Q3ListViewItem * item ); + virtual void showCallDetails( QModelIndex item ); + virtual void popupMenu( QPoint pos ); + virtual void call( QModelIndex index ); virtual void call( void ); virtual void deleteEntry( void ); virtual void clearHistory(); @@ -33,8 +35,12 @@ protected slots: private: time_t timeLastViewed; - Q3PopupMenu *histPopupMenu; + QMenu *histPopupMenu; + QStandardItemModel *m_model; int itemCall; + QPixmap m_pixmapIn, m_pixmapOut; + QPixmap m_pixmapOk, m_pixmapCancel; + QList<t_call_record> m_history; void init(); void destroy(); diff --git a/src/gui/historyform.ui b/src/gui/historyform.ui index 68d4edd..c77b3f8 100644 --- a/src/gui/historyform.ui +++ b/src/gui/historyform.ui @@ -1,408 +1,465 @@ <?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0" stdsetdef="1"> - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>HistoryForm</class> - <widget class="QDialog" name="HistoryForm"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>872</width> - <height>647</height> - </rect> - </property> - <property name="windowTitle"> - <string>Twinkle - Call History</string> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="Q3ListView" name="historyListView"> - <property name="allColumnsShowFocus"> - <bool>true</bool> +<ui version="4.0"> + <class>HistoryForm</class> + <widget class="QDialog" name="HistoryForm"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>866</width> + <height>641</height> + </rect> + </property> + <property name="contextMenuPolicy"> + <enum>Qt::CustomContextMenu</enum> + </property> + <property name="windowTitle"> + <string>Twinkle - Call History</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QTableView" name="historyListView"> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + </widget> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout"> + <item> + <widget class="QGroupBox" name="cdrGroupBox"> + <property name="title"> + <string>Call details</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QTextEdit" name="cdrTextEdit"> + <property name="whatsThis"> + <string>Details of the selected call record.</string> </property> - <property name="showSortIndicator"> - <bool>true</bool> + <property name="autoFormatting"> + <set>QTextEdit::AutoAll</set> </property> - <property name="resizeMode"> - <enum>Q3ListView::LastColumn</enum> + <property name="readOnly"> + <bool>true</bool> </property> - <column> - <property name="text"> - <string>Time</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>In/Out</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>From/To</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Subject</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Status</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - </widget> - </item> - <item row="1" column="0"> - <layout class="QHBoxLayout"> - <item> - <widget class="Q3GroupBox" name="cdrGroupBox"> - <property name="title"> - <string>Call details</string> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="Q3TextEdit" name="cdrTextEdit"> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="wordWrap"> - <enum>Q3TextEdit::NoWrap</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="autoFormatting"> - <set>Q3TextEdit::AutoAll</set> - </property> - <property name="whatsThis" stdset="0"> - <string>Details of the selected call record.</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Q3GroupBox" name="viewGroupBox"> - <property name="title"> - <string>View</string> - </property> - <layout class="QVBoxLayout"> - <item> - <widget class="QCheckBox" name="inCheckBox"> - <property name="text"> - <string>&Incoming calls</string> - </property> - <property name="shortcut"> - <string>Alt+I</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Check this option to show incoming calls.</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="outCheckBox"> - <property name="text"> - <string>&Outgoing calls</string> - </property> - <property name="shortcut"> - <string>Alt+O</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Check this option to show outgoing calls.</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="successCheckBox"> - <property name="text"> - <string>&Answered calls</string> - </property> - <property name="shortcut"> - <string>Alt+A</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Check this option to show answered calls.</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="missedCheckBox"> - <property name="text"> - <string>&Missed calls</string> - </property> - <property name="shortcut"> - <string>Alt+M</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Check this option to show missed calls.</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="profileCheckBox"> - <property name="text"> - <string>Current &user profiles only</string> - </property> - <property name="shortcut"> - <string>Alt+U</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Check this option to show only calls associated with this user profile.</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item row="3" column="0"> - <layout class="QHBoxLayout"> - <item> - <widget class="QPushButton" name="clearPushButton"> - <property name="text"> - <string>C&lear</string> - </property> - <property name="shortcut"> - <string>Alt+L</string> - </property> - <property name="whatsThis" stdset="0"> - <string><p>Clear the complete call history.</p> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="viewGroupBox"> + <property name="title"> + <string>View</string> + </property> + <layout class="QVBoxLayout"> + <item> + <widget class="QCheckBox" name="inCheckBox"> + <property name="whatsThis"> + <string>Check this option to show incoming calls.</string> + </property> + <property name="text"> + <string>&Incoming calls</string> + </property> + <property name="shortcut"> + <string>Alt+I</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="outCheckBox"> + <property name="whatsThis"> + <string>Check this option to show outgoing calls.</string> + </property> + <property name="text"> + <string>&Outgoing calls</string> + </property> + <property name="shortcut"> + <string>Alt+O</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="successCheckBox"> + <property name="whatsThis"> + <string>Check this option to show answered calls.</string> + </property> + <property name="text"> + <string>&Answered calls</string> + </property> + <property name="shortcut"> + <string>Alt+A</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="missedCheckBox"> + <property name="whatsThis"> + <string>Check this option to show missed calls.</string> + </property> + <property name="text"> + <string>&Missed calls</string> + </property> + <property name="shortcut"> + <string>Alt+M</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="profileCheckBox"> + <property name="whatsThis"> + <string>Check this option to show only calls associated with this user profile.</string> + </property> + <property name="text"> + <string>Current &user profiles only</string> + </property> + <property name="shortcut"> + <string>Alt+U</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <layout class="QHBoxLayout"> + <item> + <widget class="QPushButton" name="clearPushButton"> + <property name="whatsThis"> + <string><p>Clear the complete call history.</p> <p><b>Note:</b> this will clear <b>all</b> records, also records not shown depending on the checked view options.</p></string> - </property> - </widget> - </item> - <item> - <spacer name="spacer28"> - <property name="sizeHint"> - <size> - <width>540</width> - <height>20</height> - </size> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closePushButton"> - <property name="text"> - <string>Clo&se</string> - </property> - <property name="shortcut"> - <string>Alt+S</string> - </property> - <property name="default"> - <bool>false</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>Close this window.</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="callPushButton"> - <property name="text"> - <string>&Call</string> - </property> - <property name="shortcut"> - <string>Alt+C</string> - </property> - <property name="default"> - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>Call selected address.</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0"> - <layout class="QHBoxLayout"> - <item> - <widget class="QLabel" name="numberlCallsTtextLabel"> - <property name="text"> - <string>Number of calls:</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="numberCallsValueTextLabel"> - <property name="text"> - <string>###</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="totalDurationTextLabel"> - <property name="text"> - <string>Total call duration:</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="totalDurationValueTextLabel"> - <property name="text"> - <string>###</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <spacer name="spacer11"> - <property name="sizeHint"> - <size> - <width>460</width> - <height>20</height> - </size> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </spacer> - </item> - </layout> - </item> + </property> + <property name="text"> + <string>C&lear</string> + </property> + <property name="shortcut"> + <string>Alt+L</string> + </property> + </widget> + </item> + <item> + <spacer name="spacer28"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>540</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="closePushButton"> + <property name="whatsThis"> + <string>Close this window.</string> + </property> + <property name="text"> + <string>Clo&se</string> + </property> + <property name="shortcut"> + <string>Alt+S</string> + </property> + <property name="default"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="callPushButton"> + <property name="whatsThis"> + <string>Call selected address.</string> + </property> + <property name="text"> + <string>&Call</string> + </property> + <property name="shortcut"> + <string>Alt+C</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0"> + <layout class="QHBoxLayout"> + <item> + <widget class="QLabel" name="numberlCallsTtextLabel"> + <property name="text"> + <string>Number of calls:</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="numberCallsValueTextLabel"> + <property name="text"> + <string>###</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="totalDurationTextLabel"> + <property name="text"> + <string>Total call duration:</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="totalDurationValueTextLabel"> + <property name="text"> + <string>###</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <spacer name="spacer11"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>460</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> - </widget> - <layoutdefault spacing="6" margin="11"/> - <pixmapfunction></pixmapfunction> - <tabstops> - <tabstop>historyListView</tabstop> - <tabstop>cdrTextEdit</tabstop> - <tabstop>inCheckBox</tabstop> - <tabstop>outCheckBox</tabstop> - <tabstop>successCheckBox</tabstop> - <tabstop>missedCheckBox</tabstop> - <tabstop>profileCheckBox</tabstop> - <tabstop>clearPushButton</tabstop> - <tabstop>closePushButton</tabstop> - </tabstops> - <includes> - <include location="local">user.h</include> - <include location="local">phone.h</include> - <include location="local">q3popupmenu.h</include> - </includes> - <connections> - <connection> - <sender>closePushButton</sender> - <signal>clicked()</signal> - <receiver>HistoryForm</receiver> - <slot>close()</slot> - </connection> - <connection> - <sender>historyListView</sender> - <signal>currentChanged(Q3ListViewItem*)</signal> - <receiver>HistoryForm</receiver> - <slot>showCallDetails(Q3ListViewItem*)</slot> - </connection> - <connection> - <sender>inCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>HistoryForm</receiver> - <slot>loadHistory()</slot> - </connection> - <connection> - <sender>missedCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>HistoryForm</receiver> - <slot>loadHistory()</slot> - </connection> - <connection> - <sender>outCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>HistoryForm</receiver> - <slot>loadHistory()</slot> - </connection> - <connection> - <sender>profileCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>HistoryForm</receiver> - <slot>loadHistory()</slot> - </connection> - <connection> - <sender>successCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>HistoryForm</receiver> - <slot>loadHistory()</slot> - </connection> - <connection> - <sender>historyListView</sender> - <signal>rightButtonPressed(Q3ListViewItem*,QPoint,int)</signal> - <receiver>HistoryForm</receiver> - <slot>popupMenu(Q3ListViewItem*,QPoint)</slot> - </connection> - <connection> - <sender>historyListView</sender> - <signal>doubleClicked(Q3ListViewItem*,QPoint,int)</signal> - <receiver>HistoryForm</receiver> - <slot>call(Q3ListViewItem*)</slot> - </connection> - <connection> - <sender>clearPushButton</sender> - <signal>clicked()</signal> - <receiver>HistoryForm</receiver> - <slot>clearHistory()</slot> - </connection> - <connection> - <sender>callPushButton</sender> - <signal>clicked()</signal> - <receiver>HistoryForm</receiver> - <slot>call()</slot> - </connection> - </connections> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <tabstops> + <tabstop>historyListView</tabstop> + <tabstop>cdrTextEdit</tabstop> + <tabstop>inCheckBox</tabstop> + <tabstop>outCheckBox</tabstop> + <tabstop>successCheckBox</tabstop> + <tabstop>missedCheckBox</tabstop> + <tabstop>profileCheckBox</tabstop> + <tabstop>clearPushButton</tabstop> + <tabstop>closePushButton</tabstop> + </tabstops> + <includes> + <include location="local">user.h</include> + <include location="local">phone.h</include> + <include location="local">q3popupmenu.h</include> + </includes> + <resources/> + <connections> + <connection> + <sender>closePushButton</sender> + <signal>clicked()</signal> + <receiver>HistoryForm</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>713</x> + <y>631</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>inCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>HistoryForm</receiver> + <slot>loadHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>689</x> + <y>356</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>missedCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>HistoryForm</receiver> + <slot>loadHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>689</x> + <y>494</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>outCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>HistoryForm</receiver> + <slot>loadHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>689</x> + <y>402</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>profileCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>HistoryForm</receiver> + <slot>loadHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>689</x> + <y>540</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>successCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>HistoryForm</receiver> + <slot>loadHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>689</x> + <y>448</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>clearPushButton</sender> + <signal>clicked()</signal> + <receiver>HistoryForm</receiver> + <slot>clearHistory()</slot> + <hints> + <hint type="sourcelabel"> + <x>27</x> + <y>631</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>callPushButton</sender> + <signal>clicked()</signal> + <receiver>HistoryForm</receiver> + <slot>call()</slot> + <hints> + <hint type="sourcelabel"> + <x>799</x> + <y>631</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>historyListView</sender> + <signal>doubleClicked(QModelIndex)</signal> + <receiver>HistoryForm</receiver> + <slot>call(QModelIndex)</slot> + <hints> + <hint type="sourcelabel"> + <x>827</x> + <y>91</y> + </hint> + <hint type="destinationlabel"> + <x>862</x> + <y>300</y> + </hint> + </hints> + </connection> + <connection> + <sender>historyListView</sender> + <signal>customContextMenuRequested(QPoint)</signal> + <receiver>HistoryForm</receiver> + <slot>popupMenu(QPoint)</slot> + <hints> + <hint type="sourcelabel"> + <x>819</x> + <y>45</y> + </hint> + <hint type="destinationlabel"> + <x>858</x> + <y>290</y> + </hint> + </hints> + </connection> + <connection> + <sender>historyListView</sender> + <signal>activated(QModelIndex)</signal> + <receiver>HistoryForm</receiver> + <slot>showCallDetails(QModelIndex)</slot> + <hints> + <hint type="sourcelabel"> + <x>743</x> + <y>238</y> + </hint> + <hint type="destinationlabel"> + <x>658</x> + <y>300</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>call(QModelIndex)</slot> + <slot>popupMenu(QPoint)</slot> + <slot>showCallDetails(QModelIndex)</slot> + </slots> </ui> diff --git a/src/gui/historylistview.cpp b/src/gui/historylistview.cpp deleted file mode 100644 index 666f3ac..0000000 --- a/src/gui/historylistview.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "historylistview.h" -#include "util.h" -#include "userintf.h" - -#include "qpixmap.h" -//Added by qt3to4: -#include <q3mimefactory.h> - -HistoryListViewItem::HistoryListViewItem( Q3ListView * parent, const t_call_record &cr, t_user *user_config, time_t _last_viewed) : - Q3ListViewItem(parent, - time2str(cr.time_start, "%d %b %Y %H:%M:%S").c_str(), - cr.get_direction().c_str(), - (cr.direction == t_call_record::DIR_IN ? - ui->format_sip_address(user_config, - cr.from_display, cr.from_uri).c_str() : - ui->format_sip_address(user_config, - cr.to_display, cr.to_uri).c_str()), - cr.subject.c_str(), - cr.invite_resp_reason.c_str()) -{ - call_record = cr; - last_viewed = _last_viewed; - - // Set direction icon - setPixmap(HISTCOL_DIRECTION, (cr.direction == t_call_record::DIR_IN ? - QPixmap(":/icons/images/1leftarrow-yellow.png") : - QPixmap(":/icons/images/1rightarrow.png"))); - - // Set status icon - setPixmap(HISTCOL_STATUS, (cr.invite_resp_code < 300 ? - QPixmap(":/icons/images/ok.png") : - QPixmap(":/icons/images/cancel.png"))); -} - -void HistoryListViewItem::paintCell(QPainter *painter, const QColorGroup &cg, - int column, int width, int align) -{ - painter->save(); - QColorGroup grp(cg); - if (call_record.time_start > last_viewed && - call_record.rel_cause == t_call_record::CS_FAILURE && - call_record.direction == t_call_record::DIR_IN) - { - // Highlight missed calls since last view - grp.setColor(QColorGroup::Base, QColor("yellow")); - } - Q3ListViewItem::paintCell(painter, grp, column, width, align); - painter->restore(); -} - -int HistoryListViewItem::compare ( Q3ListViewItem * i, int col, bool ascending ) const -{ - if (col != HISTCOL_TIMESTAMP) { - return Q3ListViewItem::compare(i, col, ascending); - } - if (call_record.time_start < ((HistoryListViewItem *)i)->get_time_start()) { - return -1; - } - if (call_record.time_start == ((HistoryListViewItem *)i)->get_time_start()) { - return 0; - } - return 1; -} - -time_t HistoryListViewItem::get_time_start(void) const -{ - return call_record.time_start; -} - -t_call_record HistoryListViewItem::get_call_record(void) const -{ - return call_record; -} diff --git a/src/gui/historylistview.h b/src/gui/historylistview.h deleted file mode 100644 index af1b5ce..0000000 --- a/src/gui/historylistview.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _HISTORYLISTVIEW_H -#define _HISTORYLISTVIEW_H - -#include <sys/time.h> -#include "q3listview.h" -#include "qpainter.h" -#include "call_history.h" -#include "user.h" - -// Columns of the history list view -#define HISTCOL_TIMESTAMP 0 -#define HISTCOL_DIRECTION 1 -#define HISTCOL_FROMTO 2 -#define HISTCOL_SUBJECT 3 -#define HISTCOL_STATUS 4 - -class HistoryListViewItem : public Q3ListViewItem { -private: - t_call_record call_record; - time_t last_viewed; - -public: - HistoryListViewItem( Q3ListView * parent, const t_call_record &cr, t_user *user_config, - time_t _last_viewed); - - void paintCell(QPainter *painter, const QColorGroup &cg, - int column, int width, int align); - int compare ( Q3ListViewItem * i, int col, bool ascending ) const; - time_t get_time_start(void) const; - t_call_record get_call_record(void) const; -}; - -#endif - diff --git a/src/sys_settings.cpp b/src/sys_settings.cpp index 9a9ee11..cebd5c4 100644 --- a/src/sys_settings.cpp +++ b/src/sys_settings.cpp @@ -981,7 +981,7 @@ string t_sys_settings::about(bool html) const { if (html) s += "<BR>"; s += "\n"; - s += "Copyright (C) 2005-2009 "; + s += "Copyright (C) 2005-2015 "; s += PRODUCT_AUTHOR; if (html) s += "<BR>"; s += "\n"; diff --git a/src/userintf.h b/src/userintf.h index f29ce68..fc45866 100644 --- a/src/userintf.h +++ b/src/userintf.h @@ -35,7 +35,7 @@ #include "twinkle_config.h" #define PRODUCT_DATE VERSION_DATE -#define PRODUCT_AUTHOR "Michel de Boer" +#define PRODUCT_AUTHOR "Michel de Boer and contributors" // Tone definitions // The intervals indicate the length of silence between repetitions |