Commit 25567903 authored by Rafał Malinowski's avatar Rafał Malinowski

coverity: fixes

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 7665202e
......@@ -75,7 +75,7 @@ bool TalkablePainter::useColorsWorkaround()
}
#endif
TalkablePainter::TalkablePainter(const TalkableDelegateConfiguration &configuration, QStyleOptionViewItemV4 option, const QModelIndex &index) :
TalkablePainter::TalkablePainter(const TalkableDelegateConfiguration &configuration, const QStyleOptionViewItemV4 &option, const QModelIndex &index) :
Configuration(configuration), Option(option), Index(index),
FontMetrics(Configuration.font()),
BoldFontMetrics(Configuration.boldFont()),
......
......@@ -32,7 +32,7 @@ class TalkableDelegateConfiguration;
class TalkablePainter
{
const TalkableDelegateConfiguration &Configuration;
QStyleOptionViewItemV4 Option;
const QStyleOptionViewItemV4 &Option;
const QModelIndex &Index;
const QTreeView *Widget;
const QStyle *Style;
......@@ -99,7 +99,7 @@ class TalkablePainter
#endif
public:
TalkablePainter(const TalkableDelegateConfiguration &configuration, QStyleOptionViewItemV4 option, const QModelIndex &index);
TalkablePainter(const TalkableDelegateConfiguration &configuration, const QStyleOptionViewItemV4 &option, const QModelIndex &index);
~TalkablePainter();
QPixmap avatar() const;
......
......@@ -59,7 +59,7 @@ QString printDateTime(const QDateTime &datetime)
ret.prepend(datetime.toString(QCoreApplication::translate("@default", "dddd at ")));
ret[0] = ret.at(0).toUpper(); // looks ugly lowercase ;)
}
else if ((delta > 7) && (delta < 14))
else if (delta < 14)
{
int tmp = delta % 7;
if (tmp == 0)
......
......@@ -179,8 +179,6 @@ bool TalkableProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri
return lessThan(left.data(BuddyRole).value<Buddy>(), right.data(BuddyRole).value<Buddy>());
case ContactRole:
return lessThan(left.data(ContactRole).value<Contact>().ownerBuddy(), right.data(ContactRole).value<Contact>().ownerBuddy());
default:
Q_ASSERT(false);
}
return QSortFilterProxyModel::lessThan(left, right);
......
......@@ -59,7 +59,7 @@ void GaduProtocolFactory::destroyInstance()
GaduProtocolFactory::GaduProtocolFactory()
{
MyStatusAdapter = new GaduStatusAdapter();
MyStatusAdapter = make_unique<GaduStatusAdapter>();
// already sorted
SupportedStatusTypes.append(StatusTypeFreeForChat);
......
......@@ -38,7 +38,7 @@ class GaduProtocolFactory : public ProtocolFactory
static GaduProtocolFactory *Instance;
QList<StatusType> SupportedStatusTypes;
StatusAdapter *MyStatusAdapter;
std::unique_ptr<StatusAdapter> MyStatusAdapter;
GaduProtocolFactory();
......@@ -56,7 +56,7 @@ public:
virtual AccountEditWidget * newEditAccountWidget(Account, QWidget *parent);
virtual QWidget * newContactPersonalInfoWidget(Contact contact, QWidget *parent = 0);
virtual QList<StatusType> supportedStatusTypes();
virtual StatusAdapter * statusAdapter() { return MyStatusAdapter; }
virtual StatusAdapter * statusAdapter() { return MyStatusAdapter.get(); }
virtual QString idLabel();
virtual QValidator::State validateId(QString id);
virtual bool canRegister();
......
......@@ -417,45 +417,38 @@ Hint *HintManager::addHint(Notification *notification)
{
kdebugf();
Hint *hint;
if (DisplayedNotifications.contains(notification->identifier()))
{
foreach (Hint *h, hints)
if (h->getNotification()->identifier() == notification->identifier())
for (auto hint : hints)
if (hint->getNotification()->identifier() == notification->identifier())
{
hint = h;
//hope this refreshes this hint
hint->notificationUpdated();
break;
return hint;
}
}
else
{
notification->acquire(this);
connect(notification, SIGNAL(closed(Notification *)), this, SLOT(notificationClosed(Notification *)));
notification->acquire(this);
hint = new Hint(frame, notification);
hints.append(hint);
connect(notification, SIGNAL(closed(Notification *)), this, SLOT(notificationClosed(Notification *)));
setLayoutDirection();
layout->addWidget(hint);
auto hint = new Hint(frame, notification);
hints.append(hint);
connect(hint, SIGNAL(leftButtonClicked(Hint *)), this, SLOT(leftButtonSlot(Hint *)));
connect(hint, SIGNAL(rightButtonClicked(Hint *)), this, SLOT(rightButtonSlot(Hint *)));
connect(hint, SIGNAL(midButtonClicked(Hint *)), this, SLOT(midButtonSlot(Hint *)));
connect(hint, SIGNAL(closing(Hint *)), this, SLOT(deleteHintAndUpdate(Hint *)));
connect(hint, SIGNAL(updated(Hint *)), this, SLOT(hintUpdated()));
setHint();
setLayoutDirection();
layout->addWidget(hint);
if (!hint_timer->isActive())
hint_timer->start(1000);
connect(hint, SIGNAL(leftButtonClicked(Hint *)), this, SLOT(leftButtonSlot(Hint *)));
connect(hint, SIGNAL(rightButtonClicked(Hint *)), this, SLOT(rightButtonSlot(Hint *)));
connect(hint, SIGNAL(midButtonClicked(Hint *)), this, SLOT(midButtonSlot(Hint *)));
connect(hint, SIGNAL(closing(Hint *)), this, SLOT(deleteHintAndUpdate(Hint *)));
connect(hint, SIGNAL(updated(Hint *)), this, SLOT(hintUpdated()));
setHint();
DisplayedNotifications.append(notification->identifier());
}
if (!hint_timer->isActive())
hint_timer->start(1000);
kdebugf2();
DisplayedNotifications.append(notification->identifier());
return hint;
}
......
......@@ -56,7 +56,7 @@ void JabberProtocolFactory::destroyInstance()
JabberProtocolFactory::JabberProtocolFactory()
{
MyStatusAdapter = new JabberStatusAdapter();
MyStatusAdapter = make_unique<JabberStatusAdapter>();
// already sorted
SupportedStatusTypes.append(StatusTypeFreeForChat);
......
......@@ -38,7 +38,7 @@ class JabberProtocolFactory : public ProtocolFactory
static JabberProtocolFactory *Instance;
QList<StatusType> SupportedStatusTypes;
StatusAdapter *MyStatusAdapter;
std::unique_ptr<StatusAdapter> MyStatusAdapter;
public:
static void createInstance();
......@@ -55,7 +55,7 @@ public:
virtual QWidget * newContactPersonalInfoWidget(Contact contact, QWidget *parent = 0);
virtual ProtocolMenuManager * protocolMenuManager();
virtual QList<StatusType> supportedStatusTypes();
virtual StatusAdapter * statusAdapter() { return MyStatusAdapter; }
virtual StatusAdapter * statusAdapter() { return MyStatusAdapter.get(); }
virtual QString idLabel();
virtual QValidator::State validateId(QString id);
virtual bool canRegister();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment