• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
resourcemodelview.cpp
Go to the documentation of this file.
1 /*
2  * resourcemodelview.cpp - model/view classes for alarm resource lists
3  * Program: kalarm
4  * Copyright © 2007-2011 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #include "kalarm.h"
22 
23 #include "messagebox.h"
24 #include "preferences.h"
25 #include "resourcemodelview.moc"
26 
27 #include <klocale.h>
28 #include <kcolorutils.h>
29 #include <kdebug.h>
30 
31 #include <QApplication>
32 #include <QToolTip>
33 #include <QMouseEvent>
34 #include <QKeyEvent>
35 #include <QHelpEvent>
36 
37 
38 ResourceModel* ResourceModel::mInstance = 0;
39 
40 
41 ResourceModel* ResourceModel::instance(QObject* parent)
42 {
43  if (!mInstance)
44  mInstance = new ResourceModel(parent);
45  return mInstance;
46 }
47 
48 ResourceModel::ResourceModel(QObject* parent)
49  : QAbstractListModel(parent)
50 {
51  refresh();
52  AlarmResources* resources = AlarmResources::instance();
53  connect(resources, SIGNAL(signalResourceModified(AlarmResource*)), SLOT(updateResource(AlarmResource*)));
54  connect(resources, SIGNAL(standardResourceChange(CalEvent::Type)), SLOT(slotStandardChanged(CalEvent::Type)));
55  connect(resources, SIGNAL(resourceStatusChanged(AlarmResource*,AlarmResources::Change)), SLOT(slotStatusChanged(AlarmResource*,AlarmResources::Change)));
56  connect(resources, SIGNAL(resourceLoaded(AlarmResource*,bool)), SLOT(slotLoaded(AlarmResource*,bool)));
57 }
58 
59 int ResourceModel::rowCount(const QModelIndex& parent) const
60 {
61  if (parent.isValid())
62  return 0;
63  return mResources.count();
64 }
65 
66 QModelIndex ResourceModel::index(int row, int column, const QModelIndex& parent) const
67 {
68  if (parent.isValid() || row >= mResources.count())
69  return QModelIndex();
70  return createIndex(row, column, mResources[row]);
71 }
72 
73 QVariant ResourceModel::data(const QModelIndex& index, int role) const
74 {
75  if (!index.isValid())
76  return QVariant();
77  AlarmResource* resource = static_cast<AlarmResource*>(index.internalPointer());
78  if (!resource)
79  return QVariant();
80  switch (role)
81  {
82  case Qt::DisplayRole:
83  return resource->resourceName();
84  case Qt::CheckStateRole:
85  return resource->isEnabled() ? Qt::Checked : Qt::Unchecked;
86  case Qt::ForegroundRole:
87  {
88  QColor colour;
89  switch (resource->alarmType())
90  {
91  case CalEvent::ACTIVE: colour = KColorScheme(QPalette::Active).foreground(KColorScheme::NormalText).color(); break;
92  case CalEvent::ARCHIVED: colour = Preferences::archivedColour(); break;
93  case CalEvent::TEMPLATE: colour = KColorScheme(QPalette::Active).foreground(KColorScheme::LinkText).color(); break;
94  default: break;
95  }
96  if (colour.isValid())
97  return resource->readOnly() ? KColorUtils::lighten(colour, 0.25) : colour;
98  break;
99  }
100  case Qt::BackgroundRole:
101  if (resource->colour().isValid())
102  return resource->colour();
103  break;
104  case Qt::FontRole:
105  {
106  if (!resource->isEnabled() || !resource->standardResource())
107  break;
108  QFont font = mFont;
109  font.setBold(true);
110  return font;
111  }
112  case Qt::ToolTipRole:
113  {
114  QString name = '@' + resource->resourceName(); // insert markers for stripping out name
115  QString type = '@' + resource->displayType();
116  bool inactive = !resource->isActive();
117  QString disabled = resource->isWrongAlarmType() ? i18nc("@info/plain", "Disabled (wrong alarm type)") : i18nc("@info/plain", "Disabled");
118  QString readonly = i18nc("@info/plain", "Read-only");
119  if (inactive && resource->readOnly())
120  return i18nc("@info:tooltip",
121  "%1"
122  "<nl/>%2: <filename>%3</filename>"
123  "<nl/>%4, %5",
124  name, type, resource->displayLocation(), disabled, readonly);
125  if (inactive || resource->readOnly())
126  return i18nc("@info:tooltip",
127  "%1"
128  "<nl/>%2: <filename>%3</filename>"
129  "<nl/>%4",
130  name, type, resource->displayLocation(),
131  (inactive ? disabled : readonly));
132  return i18nc("@info:tooltip",
133  "%1"
134  "<nl/>%2: <filename>%3</filename>",
135  name, type, resource->displayLocation());
136  }
137  default:
138  break;
139  }
140  return QVariant();
141 }
142 
143 /******************************************************************************
144 * Set the font to use for all items, or the checked state of one item.
145 * The font must always be set at initialisation.
146 */
147 bool ResourceModel::setData(const QModelIndex& index, const QVariant& value, int role)
148 {
149  mErrorPrompt.clear();
150  if (role == Qt::FontRole)
151  {
152  // Set the font used in all views.
153  // This enables data(index, Qt::FontRole) to return bold when appropriate.
154  mFont = value.value<QFont>();
155  return true;
156  }
157  if (role != Qt::CheckStateRole || !index.isValid())
158  return false;
159  AlarmResource* resource = static_cast<AlarmResource*>(index.internalPointer());
160  if (!resource)
161  return false;
162  Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt());
163  bool active = (state == Qt::Checked);
164  bool saveChange = false;
165  AlarmResources* resources = AlarmResources::instance();
166  if (active)
167  {
168  // Enable the resource
169  resource->setActive(true); // enable it now so that load() will work
170  saveChange = resources->load(resource);
171  resource->setActive(false); // reset so that setEnabled() will work
172  }
173  else
174  {
175  // Disable the resource
176  saveChange = resource->saveAndClose(); // close resource after it is saved
177  }
178  if (saveChange)
179  resource->setEnabled(active);
180  emit dataChanged(index, index);
181  return true;
182 }
183 
184 Qt::ItemFlags ResourceModel::flags(const QModelIndex&) const
185 {
186  return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
187 }
188 
189 /******************************************************************************
190 * Return the resource referred to by an index.
191 */
192 AlarmResource* ResourceModel::resource(const QModelIndex& index) const
193 {
194  if (!index.isValid())
195  return 0;
196  return static_cast<AlarmResource*>(index.internalPointer());
197 }
198 
199 /******************************************************************************
200 * Emit a signal that a resource has changed.
201 */
202 void ResourceModel::notifyChange(const QModelIndex& index)
203 {
204  if (index.isValid())
205  emit dataChanged(index, index);
206 }
207 
208 /******************************************************************************
209 * Reload the resources list.
210 */
211 void ResourceModel::refresh()
212 {
213  // This would be better done by a reset(), but the signals are private to QAbstractItemModel
214  if (!mResources.isEmpty())
215  {
216  beginRemoveRows(QModelIndex(), 0, mResources.count() - 1);
217  mResources.clear();
218  endRemoveRows();
219  }
220  QList<AlarmResource*> newResources;
221  AlarmResourceManager* manager = AlarmResources::instance()->resourceManager();
222  for (AlarmResourceManager::Iterator it = manager->begin(); it != manager->end(); ++it)
223  newResources += *it;
224  if (!newResources.isEmpty())
225  {
226  beginInsertRows(QModelIndex(), 0, newResources.count() - 1);
227  mResources = newResources;
228  endInsertRows();
229  }
230 }
231 
232 /******************************************************************************
233 * Add the specified resource to the list.
234 */
235 void ResourceModel::addResource(AlarmResource* resource)
236 {
237  int row = mResources.count();
238  beginInsertRows(QModelIndex(), row, row);
239  mResources += resource;
240  endInsertRows();
241 }
242 
243 /******************************************************************************
244 * Delete the specified resource from the list.
245 */
246 void ResourceModel::removeResource(AlarmResource* resource)
247 {
248  int row = mResources.indexOf(resource);
249  if (row >= 0)
250  {
251  beginRemoveRows(QModelIndex(), row, row);
252  mResources.removeAt(row);
253  endRemoveRows();
254  }
255 }
256 
257 /******************************************************************************
258 * Called when the resource has been updated , to update the
259 * active status displayed for the resource item.
260 */
261 void ResourceModel::updateResource(AlarmResource* resource)
262 {
263  int row = mResources.indexOf(resource);
264  if (row >= 0)
265  {
266  QModelIndex ix = index(row, 0, QModelIndex());
267  emit dataChanged(ix, ix);
268  }
269 }
270 
271 /******************************************************************************
272 * Called when a different resource has been set as the standard resource.
273 */
274 void ResourceModel::slotStandardChanged(CalEvent::Type type)
275 {
276  for (int row = 0, end = mResources.count(); row < end; ++row)
277  {
278  if (mResources[row]->alarmType() == type)
279  {
280  QModelIndex ix = index(row, 0, QModelIndex());
281  emit dataChanged(ix, ix);
282  }
283  }
284 }
285 
286 /******************************************************************************
287 * Called when a resource has completed loading.
288 * Check in case its status has changed.
289 */
290 void ResourceModel::slotLoaded(AlarmResource* resource, bool active)
291 {
292  if (active)
293  updateResource(resource);
294 }
295 
296 /******************************************************************************
297 * Called when a resource status has changed, to update the list.
298 */
299 void ResourceModel::slotStatusChanged(AlarmResource* resource, AlarmResources::Change change)
300 {
301  switch (change)
302  {
303  case AlarmResources::Added:
304  addResource(resource);
305  break;
306  case AlarmResources::Enabled:
307  case AlarmResources::ReadOnly:
308  case AlarmResources::Colour:
309  updateResource(resource);
310  break;
311  default:
312  break;
313  }
314 }
315 
316 
317 /*=============================================================================
318 = Class: ResourceFilterModel
319 = Proxy model for filtering resource lists.
320 =============================================================================*/
321 
322 ResourceFilterModel::ResourceFilterModel(QAbstractItemModel* baseModel, QObject* parent)
323  : QSortFilterProxyModel(parent),
324  mResourceType(CalEvent::EMPTY)
325 {
326  setSourceModel(baseModel);
327 }
328 
329 void ResourceFilterModel::setFilter(CalEvent::Type type)
330 {
331  if (type != mResourceType)
332  {
333  mResourceType = type;
334  invalidateFilter();
335  }
336 }
337 
338 bool ResourceFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex&) const
339 {
340  return static_cast<ResourceModel*>(sourceModel())->resource(sourceModel()->index(sourceRow, 0))->alarmType() == mResourceType;
341 }
342 
343 /******************************************************************************
344 * Return the resource referred to by an index.
345 */
346 AlarmResource* ResourceFilterModel::resource(int row) const
347 {
348  return static_cast<ResourceModel*>(sourceModel())->resource(mapToSource(index(row, 0)));
349 }
350 
351 AlarmResource* ResourceFilterModel::resource(const QModelIndex& index) const
352 {
353  return static_cast<ResourceModel*>(sourceModel())->resource(mapToSource(index));
354 }
355 
356 /******************************************************************************
357 * Emit a signal that a resource has changed.
358 */
359 void ResourceFilterModel::notifyChange(int row)
360 {
361  static_cast<ResourceModel*>(sourceModel())->notifyChange(mapToSource(index(row, 0)));
362 }
363 
364 void ResourceFilterModel::notifyChange(const QModelIndex& index)
365 {
366  static_cast<ResourceModel*>(sourceModel())->notifyChange(mapToSource(index));
367 }
368 
369 
370 /*=============================================================================
371 = Class: ResourceDelegate
372 = Model/view delegate for resource list.
373 =============================================================================*/
374 
375 /******************************************************************************
376 * Process a change of state of the checkbox for a resource.
377 */
378 bool ResourceDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index)
379 {
380  if (!(model->flags(index) & Qt::ItemIsEnabled))
381  return false;
382  if (event->type() == QEvent::MouseButtonRelease
383  || event->type() == QEvent::MouseButtonDblClick)
384  {
385  const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
386  QRect checkRect = QStyle::alignedRect(option.direction, Qt::AlignLeft | Qt::AlignVCenter,
387  check(option, option.rect, Qt::Checked).size(),
388  QRect(option.rect.x() + textMargin, option.rect.y(), option.rect.width(), option.rect.height()));
389  if (!checkRect.contains(static_cast<QMouseEvent*>(event)->pos()))
390  return false;
391  if (event->type() == QEvent::MouseButtonDblClick)
392  return true; // ignore double clicks
393  }
394  else if (event->type() == QEvent::KeyPress)
395  {
396  if (static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space
397  && static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select)
398  return false;
399  }
400  else
401  return false;
402 
403  QVariant value = index.data(Qt::CheckStateRole);
404  if (!value.isValid())
405  return false;
406  Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked ? Qt::Unchecked : Qt::Checked);
407  if (state == Qt::Unchecked)
408  {
409  // The resource is to be disabled.
410  // Check for eligibility.
411  AlarmResource* resource = static_cast<ResourceFilterModel*>(model)->resource(index);
412  if (!resource)
413  return false;
414  if (resource->standardResource())
415  {
416  // It's the standard resource for its type.
417  if (resource->alarmType() == CalEvent::ACTIVE)
418  {
419  KAMessageBox::sorry(static_cast<QWidget*>(parent()),
420  i18nc("@info", "You cannot disable your default active alarm calendar."));
421  return false;
422 
423  }
424  if (resource->alarmType() == CalEvent::ARCHIVED && Preferences::archivedKeepDays())
425  {
426  // Only allow the archived alarms standard resource to be disabled if
427  // we're not saving archived alarms.
428  KAMessageBox::sorry(static_cast<QWidget*>(parent()),
429  i18nc("@info", "You cannot disable your default archived alarm calendar "
430  "while expired alarms are configured to be kept."));
431  return false;
432  }
433  if (KAMessageBox::warningContinueCancel(static_cast<QWidget*>(parent()),
434  i18nc("@info", "Do you really want to disable your default calendar?"))
435  == KMessageBox::Cancel)
436  return false;
437  }
438  }
439  return model->setData(index, state, Qt::CheckStateRole);
440 }
441 
442 
443 /*=============================================================================
444 = Class: ResourceView
445 = View displaying a list of resources.
446 =============================================================================*/
447 
448 void ResourceView::setModel(QAbstractItemModel* model)
449 {
450  model->setData(QModelIndex(), viewOptions().font, Qt::FontRole);
451  QListView::setModel(model);
452  setItemDelegate(new ResourceDelegate(this));
453 }
454 
455 /******************************************************************************
456 * Return the resource for a given row.
457 */
458 AlarmResource* ResourceView::resource(int row) const
459 {
460  return static_cast<ResourceFilterModel*>(model())->resource(row);
461 }
462 
463 AlarmResource* ResourceView::resource(const QModelIndex& index) const
464 {
465  return static_cast<ResourceFilterModel*>(model())->resource(index);
466 }
467 
468 /******************************************************************************
469 * Emit a signal that a resource has changed.
470 */
471 void ResourceView::notifyChange(int row) const
472 {
473  static_cast<ResourceFilterModel*>(model())->notifyChange(row);
474 }
475 
476 void ResourceView::notifyChange(const QModelIndex& index) const
477 {
478  static_cast<ResourceFilterModel*>(model())->notifyChange(index);
479 }
480 
481 /******************************************************************************
482 * Called when a mouse button is released.
483 * Any currently selected resource is deselected.
484 */
485 void ResourceView::mouseReleaseEvent(QMouseEvent* e)
486 {
487  if (!indexAt(e->pos()).isValid())
488  clearSelection();
489  QListView::mouseReleaseEvent(e);
490 }
491 
492 /******************************************************************************
493 * Called when a ToolTip or WhatsThis event occurs.
494 */
495 bool ResourceView::viewportEvent(QEvent* e)
496 {
497  if (e->type() == QEvent::ToolTip && isActiveWindow())
498  {
499  QHelpEvent* he = static_cast<QHelpEvent*>(e);
500  QModelIndex index = indexAt(he->pos());
501  QVariant value = model()->data(index, Qt::ToolTipRole);
502  if (qVariantCanConvert<QString>(value))
503  {
504  QString toolTip = value.toString();
505  int i = toolTip.indexOf('@');
506  if (i > 0)
507  {
508  int j = toolTip.indexOf(QRegExp("<(nl|br)", Qt::CaseInsensitive), i + 1);
509  int k = toolTip.indexOf('@', j);
510  QString name = toolTip.mid(i + 1, j - i - 1);
511  value = model()->data(index, Qt::FontRole);
512  QFontMetrics fm(qvariant_cast<QFont>(value).resolve(viewOptions().font));
513  int textWidth = fm.boundingRect(name).width() + 1;
514  const int margin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
515  QStyleOptionButton opt;
516  opt.QStyleOption::operator=(viewOptions());
517  opt.rect = rectForIndex(index);
518  int checkWidth = QApplication::style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt).width();
519  int left = spacing() + 3*margin + checkWidth + viewOptions().decorationSize.width(); // left offset of text
520  int right = left + textWidth;
521  if (left >= horizontalOffset() + spacing()
522  && right <= horizontalOffset() + width() - spacing() - 2*frameWidth())
523  {
524  // The whole of the resource name is already displayed,
525  // so omit it from the tooltip.
526  if (k > 0)
527  toolTip.remove(i, k + 1 - i);
528  }
529  else
530  {
531  toolTip.remove(k, 1);
532  toolTip.remove(i, 1);
533  }
534  }
535  QToolTip::showText(he->globalPos(), toolTip, this);
536  return true;
537  }
538  }
539  return QListView::viewportEvent(e);
540 }
541 
542 // vim: et sw=4:
QSortFilterProxyModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QList::clear
void clear()
QModelIndex
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QEvent
ResourceDelegate::editorEvent
virtual bool editorEvent(QEvent *, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &)
Definition: resourcemodelview.cpp:378
ResourceModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: resourcemodelview.cpp:59
QEvent::type
Type type() const
QAbstractItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
ResourceModel::data
virtual QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: resourcemodelview.cpp:73
ResourceModel::removeResource
void removeResource(AlarmResource *)
Definition: resourcemodelview.cpp:246
QSortFilterProxyModel::setSourceModel
virtual void setSourceModel(QAbstractItemModel *sourceModel)
QFont
QStyle::pixelMetric
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
QAbstractItemView::setModel
virtual void setModel(QAbstractItemModel *model)
QListView::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *e)
QList::removeAt
void removeAt(int i)
QHelpEvent::pos
const QPoint & pos() const
QVariant::value
T value() const
ResourceView::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: resourcemodelview.cpp:485
ResourceFilterModel::setFilter
void setFilter(CalEvent::Type)
Definition: resourcemodelview.cpp:329
ResourceModel::setData
virtual bool setData(const QModelIndex &, const QVariant &value, int role=Qt::EditRole)
Definition: resourcemodelview.cpp:147
QFontMetrics
QMouseEvent
QString::remove
QString & remove(int position, int n)
QToolTip::showText
void showText(const QPoint &pos, const QString &text, QWidget *w)
QStyle::alignedRect
QRect alignedRect(Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment, const QSize &size, const QRect &rectangle)
QStyleOptionButton
QObject::event
virtual bool event(QEvent *e)
QList::indexOf
int indexOf(const T &value, int from) const
QString::clear
void clear()
ResourceModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &) const
Definition: resourcemodelview.cpp:184
QWidget::width
int width() const
QFont::setBold
void setBold(bool enable)
QRegExp
QObject::name
const char * name() const
QRect
QModelIndex::isValid
bool isValid() const
QFontMetrics::boundingRect
QRect boundingRect(QChar ch) const
QAbstractItemView::viewportEvent
virtual bool viewportEvent(QEvent *event)
QList::count
int count(const T &value) const
ResourceView::viewportEvent
virtual bool viewportEvent(QEvent *)
Definition: resourcemodelview.cpp:495
ResourceFilterModel::resource
AlarmResource * resource(int row) const
Definition: resourcemodelview.cpp:346
ResourceModel::instance
static ResourceModel * instance(QObject *parent=0)
Definition: resourcemodelview.cpp:41
QVariant::toInt
int toInt(bool *ok) const
ResourceModel::resource
AlarmResource * resource(const QModelIndex &) const
Definition: resourcemodelview.cpp:192
QAbstractItemModel::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QAbstractItemModel::endInsertRows
void endInsertRows()
QStyleOptionViewItem
QObject
QHelpEvent::globalPos
const QPoint & globalPos() const
QAbstractListModel
ResourceFilterModel::ResourceFilterModel
ResourceFilterModel(QAbstractItemModel *baseModel, QObject *parent)
Definition: resourcemodelview.cpp:322
QList::isEmpty
bool isEmpty() const
QAbstractItemModel::beginRemoveRows
void beginRemoveRows(const QModelIndex &parent, int first, int last)
QAbstractItemView::setItemDelegate
void setItemDelegate(QAbstractItemDelegate *delegate)
ResourceView::notifyChange
void notifyChange(int row) const
Definition: resourcemodelview.cpp:471
QSortFilterProxyModel::invalidateFilter
void invalidateFilter()
QModelIndex::internalPointer
void * internalPointer() const
QListView::horizontalOffset
virtual int horizontalOffset() const
QAbstractItemModel::data
virtual QVariant data(const QModelIndex &index, int role) const =0
QRect::contains
bool contains(const QPoint &point, bool proper) const
messagebox.h
QString
QList< AlarmResource * >
QColor
QWidget::isActiveWindow
bool isActiveWindow() const
QListView::rectForIndex
QRect rectForIndex(const QModelIndex &index) const
QAbstractItemModel::createIndex
QModelIndex createIndex(int row, int column, void *ptr) const
QSortFilterProxyModel
QWidget::font
const QFont & font() const
preferences.h
QAbstractItemModel::beginInsertRows
void beginInsertRows(const QModelIndex &parent, int first, int last)
QListView::viewOptions
virtual QStyleOptionViewItem viewOptions() const
QListView::spacing
int spacing() const
QKeyEvent
ResourceModel::notifyChange
void notifyChange(const QModelIndex &)
Definition: resourcemodelview.cpp:202
QAbstractProxyModel::sourceModel
QAbstractItemModel * sourceModel() const
QSortFilterProxyModel::mapToSource
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
QListView::indexAt
virtual QModelIndex indexAt(const QPoint &p) const
QRect::width
int width() const
QString::mid
QString mid(int position, int n) const
QFrame::frameWidth
int frameWidth() const
QModelIndex::data
QVariant data(int role) const
QApplication::style
QStyle * style()
KAMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
ResourceView::resource
AlarmResource * resource(int row) const
Definition: resourcemodelview.cpp:458
kalarm.h
ResourceModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
Definition: resourcemodelview.cpp:66
QAbstractItemModel
QAbstractItemModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
KAMessageBox::warningContinueCancel
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|WindowModal))
QVariant::isValid
bool isValid() const
QAbstractItemModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
ResourceModel
Definition: resourcemodelview.h:38
ResourceFilterModel
Definition: resourcemodelview.h:70
QStyle::subElementRect
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const =0
QMouseEvent::pos
const QPoint & pos() const
QWidget::toolTip
QString toolTip() const
QAbstractItemModel::endRemoveRows
void endRemoveRows()
QAbstractItemView::model
QAbstractItemModel * model() const
QAbstractItemView::clearSelection
void clearSelection()
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::parent
QObject * parent() const
QHelpEvent
ResourceFilterModel::filterAcceptsRow
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
Definition: resourcemodelview.cpp:338
ResourceView::setModel
virtual void setModel(QAbstractItemModel *)
Definition: resourcemodelview.cpp:448
ResourceFilterModel::notifyChange
void notifyChange(int row)
Definition: resourcemodelview.cpp:359
QColor::isValid
bool isValid() const
QVariant
ResourceDelegate
Definition: resourcemodelview.h:106
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal