Hi,

On Saturday, 2014-02-15, 19:44:46, Conny Marco Menebröcker wrote:
> Hello all,
> 
> 
> I have written my first plasmoid. I called it PlasmaTaskViewer, because
> it views the todos of a calendar file.
> In my case it shows the entries of my iPhone reminder app.
> 
> I would be happy if someone reviews my code. I am especially interested
> in comments about the use of kcalcore and the data engine. But every
> other comment is welcome, too.
> 
> https://sourceforge.net/projects/plasmataskviewer/

Looks pretty good.

One thing that is improvable is the handling of received data. Instead of 
putting that into a stringlist I would suggest doing something like

QHash<long, QByteArra> m_ical_data;

The slot is then just

void TaskViewerContainer::dataSlot(long id, const QByteArray &data)
{
    m_ical_data[id].append(data);
}

For the member holding the KJob pointer I would suggest
QPointer<Kjob> m_job;

It has a pointer operator so code would look "nicer"
if (m_job) m_job->kill();

Btw, I don't think you need to kill() the job when it is done :)

One other thing you could try (don't know if this is equivalent) is to have 
just one MemoryCalendar instance and close() it at the end of the loop.

Since you don't need the completed information as a string for display, it 
might be better to just have it as a list of bool.

Alternatively you could consider "pairing" the related values:

QVariantList list;
QVariantHash entry;
entry["summary"] = oneTodo->summary();
entry["completed"] = oneTodo->isCompleted();
list << entry;

in the applet that would the be something like

QVariantHash entry = todo_list[i].toHash();
addScrollerItem(entry["summary"], entry["completed"]);

Cheers,
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring

Attachment: signature.asc
Description: This is a digitally signed message part.

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to