Select Git revision
make-client.py
-
Ming Rui Zhang authored
Change-Id: I6ee537ee1ee3928c93b9a579e2b55b6ef97af779
Ming Rui Zhang authoredChange-Id: I6ee537ee1ee3928c93b9a579e2b55b6ef97af779
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
HistoryDock.cpp 10.73 KiB
#include "HistoryDock.h"
#include <QtGui/QVBoxLayout>
#include <kicon.h>
#include <klineedit.h>
#include <QtGui/QTreeWidget>
#include <QtGui/QComboBox>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <kdatewidget.h>
#include <QHeaderView>
#include <QtGui/QCheckBox>
#include <QDate>
#include "SFLPhone.h"
#include "widgets/HistoryTreeItem.h"
#include "conf/ConfigurationSkeleton.h"
#include "AkonadiBackend.h"
#include "lib/sflphone_const.h"
class QNumericTreeWidgetItem : public QTreeWidgetItem {
public:
QNumericTreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent),widget(0),weight(-1){}
QNumericTreeWidgetItem(QTreeWidgetItem* parent):QTreeWidgetItem(parent),widget(0),weight(-1){}
HistoryTreeItem* widget;
int weight;
private:
bool operator<(const QTreeWidgetItem & other) const {
int column = treeWidget()->sortColumn();
if (dynamic_cast<QNumericTreeWidgetItem*>((QTreeWidgetItem*)&other)) {
if (widget !=0 && dynamic_cast<QNumericTreeWidgetItem*>((QTreeWidgetItem*)&other)->widget != 0)
return widget->getTimeStamp() < dynamic_cast<QNumericTreeWidgetItem*>((QTreeWidgetItem*)&other)->widget->getTimeStamp();
else if (weight > 0 && dynamic_cast<QNumericTreeWidgetItem*>((QTreeWidgetItem*)&other)->weight > 0)
return weight > dynamic_cast<QNumericTreeWidgetItem*>((QTreeWidgetItem*)&other)->weight;
}
return text(column) < other.text(column);
}
};
HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent)
{
setMinimumSize(250,0);
setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
m_pFilterLE = new KLineEdit();
m_pItemView = new HistoryTree(this);
m_pSortByCBB = new QComboBox();
m_pSortByL = new QLabel("Sort by:");
m_pFromL = new QLabel("From:");
m_pToL = new QLabel("To:");
m_pFromDW = new KDateWidget();
m_pToDW = new KDateWidget();
m_pAllTimeCB = new QCheckBox("Display all");
m_pLinkPB = new QPushButton(this);
m_pAllTimeCB->setChecked(ConfigurationSkeleton::displayDataRange());
m_pSortByL->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
m_pSortByCBB->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
m_pLinkPB->setMaximumSize(20,9999999);
m_pLinkPB->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
m_pLinkPB->setCheckable(true);
m_pItemView->headerItem()->setText(0,"Calls" );
m_pItemView->header ()->setClickable(true );
m_pItemView->header ()->setSortIndicatorShown(true );
m_pItemView->setAlternatingRowColors(true );
m_pItemView->setAcceptDrops( true );
m_pItemView->setDragEnabled( true );
m_pFilterLE->setPlaceholderText("Filter");
m_pFilterLE->setClearButtonShown(true);