diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
| commit | e38d2351b83fa65c66ccde443777647ef5cb6cff (patch) | |
| tree | 1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/entryitem.cpp | |
| download | tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip | |
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/entryitem.cpp')
| -rw-r--r-- | src/entryitem.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/entryitem.cpp b/src/entryitem.cpp new file mode 100644 index 0000000..0079d44 --- /dev/null +++ b/src/entryitem.cpp @@ -0,0 +1,55 @@ +/*************************************************************************** + copyright : (C) 2003-2007 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "entryitem.h" +#include "entry.h" +#include "gui/counteditem.h" +#include "collection.h" +#include "controller.h" + +#include <kiconloader.h> + +using Tellico::EntryItem; + +EntryItem::EntryItem(GUI::ListView* parent, Data::EntryPtr entry) + : GUI::ListViewItem(parent), m_entry(entry), m_isDetailedList(true) { +} + +EntryItem::EntryItem(GUI::CountedItem* parent_, Data::EntryPtr entry_) + : GUI::ListViewItem(parent_), m_entry(entry_), m_isDetailedList(false) { + setText(0, m_entry->title()); + setPixmap(0, UserIcon(entry_->collection()->typeName())); +} + +Tellico::Data::EntryPtr const EntryItem::entry() const { + return m_entry; +} + +QString EntryItem::key(int col_, bool) const { + // first column is always title unless it's a detailed list + // detailed list takes care of things on its own + bool checkArticles = (!m_isDetailedList && col_ == 0); + // there's some sort of painting bug if the key is identical for multiple entries + // probably a null string in the group view. TODO + // don't add the entry id if it's a detailed view cause that messes up secondary sorting + QString key = (checkArticles ? Data::Field::sortKeyTitle(text(col_)) : text(col_)); + return (m_isDetailedList ? key : key + QString::number(m_entry->id())); +} + +void EntryItem::doubleClicked() { + Controller::self()->editEntry(m_entry); +} + +Tellico::Data::EntryVec EntryItem::entries() const { + return Data::EntryVec(entry()); +} |
