~ubuntu-branches/debian/sid/kde-baseapps/sid

« back to all changes in this revision

Viewing changes to plasma/applets/folderview/actionoverlay.cpp

  • Committer: Package Import Robot
  • Author(s): Modestas Vainius, Eshat Cakar, Pino Toscano
  • Date: 2012-06-09 22:18:08 UTC
  • mfrom: (4.2.1) (6.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20120609221808-h1l0ekd5qmb8nefr
Tags: 4:4.8.4-1
* New upstream release.

[ Eshat Cakar ]
* Add watch file.
* Bump kde-sc-dev-latest build dependency to version 4:4.8.4.
* Update installed files.

[ Pino Toscano ]
* Move files of the konqueror documentation from kde-baseapps-data to
  konqueror itself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
    m_openButton = new ActionIcon(this);
129
129
    m_openButton->setElement("open");
130
130
 
131
 
    QGraphicsGridLayout *layout = new QGraphicsGridLayout(this);
132
 
    layout->setContentsMargins(4, 4, 4, 4);
133
 
    layout->setSpacing(1);
134
 
    layout->addItem(m_toggleButton, 0, 0);
135
 
    layout->addItem(m_openButton, 1, 0);
 
131
    m_showFolderButton = true;
 
132
    m_showSelectionButton = true;
 
133
 
 
134
    m_layout = new QGraphicsGridLayout(this);
 
135
    m_layout->setContentsMargins(4, 4, 4, 4);
 
136
    m_layout->setSpacing(1);
 
137
    m_layout->addItem(m_toggleButton, 0, 0);
 
138
    m_layout->addItem(m_openButton, 1, 0);
136
139
 
137
140
    connect(parentWidget(), SIGNAL(entered(QModelIndex)), this, SLOT(entered(QModelIndex)));
138
141
    connect(parentWidget(), SIGNAL(left(QModelIndex)), this, SLOT(left(QModelIndex)));
216
219
        IconView *iview = qobject_cast<IconView*>(view);
217
220
        if (iview && iview->clickToViewFolders()) {
218
221
            AsyncFileTester::checkIfFolder(index, this, "checkIfFolderResult");
219
 
        } else {
220
 
            m_openButton->hide();
221
222
        }
222
223
    }
223
224
}
275
276
    AbstractItemView *view = static_cast<AbstractItemView*>(parentWidget());
276
277
 
277
278
    QAbstractItemModel *mod = view->model();
278
 
    connect(mod, SIGNAL(rowsRemoved(QModelIndex, int, int)), SLOT(rowsRemoved(QModelIndex, int, int)));
279
 
}
280
 
 
 
279
    connect(mod, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(rowsRemoved(QModelIndex,int,int)));
 
280
}
 
281
 
 
282
void ActionOverlay::setShowFolderButton(bool show)
 
283
{
 
284
  if (m_showFolderButton != show) {
 
285
    m_showFolderButton = show;
 
286
    toggleShowActionButton(show, m_openButton, 1);
 
287
  }
 
288
}
 
289
 
 
290
void ActionOverlay::setShowSelectionButton(bool show)
 
291
{
 
292
  if (m_showSelectionButton!= show) {
 
293
    m_showSelectionButton = show;
 
294
    toggleShowActionButton(show, m_toggleButton, 0);
 
295
  }
 
296
}
 
297
 
 
298
bool ActionOverlay::showFolderButton() const
 
299
{
 
300
  return m_showFolderButton;
 
301
}
 
302
bool ActionOverlay::showSelectionButton() const
 
303
{
 
304
  return m_showSelectionButton;
 
305
}
 
306
 
 
307
QSizeF ActionOverlay::iconSize() const
 
308
{
 
309
    return m_openButton->geometry().size();
 
310
}
 
311
 
 
312
void ActionOverlay::toggleShowActionButton(bool show, ActionIcon* button, unsigned int pos)
 
313
{
 
314
  if (show && m_layout->itemAt(pos, 0) != button) {
 
315
    m_layout->addItem(button, pos, 0);
 
316
    button->show();
 
317
  } else if (m_layout->itemAt(pos, 0) == button) {
 
318
    button->hide();
 
319
#if QT_VERSION >= 0x040800
 
320
    m_layout->removeItem(button);
 
321
#else
 
322
    /* find the index of the item: yeah, this is ugly... on the other hand, this works in Qt 4.7,
 
323
     * and if you have a look at the 4.8 source, this is exactly what it does. */
 
324
    int index = -1;
 
325
    for (int i = 0; i < m_layout->count(); ++i) {
 
326
      if (m_layout->itemAt(i) == button) {
 
327
        index = i;
 
328
        break;
 
329
      }
 
330
    }
 
331
    Q_ASSERT(index >= 0); // the button *is* part of the layout, so we have to find it
 
332
    m_layout->removeAt(index);
 
333
#endif
 
334
  }
 
335
}