QString KrView::statistics() { KIO::filesize_t size = calcSize(); KIO::filesize_t selectedSize = calcSelectedSize(); QString tmp; KConfigGroup grp(_config, "Look&Feel"); if(grp.readEntry("Show Size In Bytes", false)) { tmp = i18nc("%1=number of selected items,%2=total number of items, \ %3=filesize of selected items,%4=filesize in Bytes, \ %5=filesize of all items in folder,%6=filesize in Bytes", "%1 out of %2, %3 (%4) out of %5 (%6)", numSelected(), _count, KIO::convertSize(selectedSize), KRpermHandler::parseSize(selectedSize), KIO::convertSize(size), KRpermHandler::parseSize(size)); } else {
void CurveEditInstance::insertControlPointsAtSelected() { unsigned int numPointsToRemove = numSelected(); if (numPointsToRemove == 0) { rError() << "Can't insert any points, no control vertices selected.\n"; return; } // This is the list of insert points Curve::IteratorList iterators = getSelected(); // De-select everything before removal setSelected(false); // Now remove the points _curve.insertControlPointsAt(iterators); }
void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) { if (!item_pair) return; if (!item_pair->first) { llwarning("Attempt to selet an item pair containing null panel item", 0); return; } setFocus(TRUE); bool select_item = !isSelected(item_pair); //*TODO find a better place for that enforcing stuff if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return; if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection(); selectItemPair(item_pair, select_item); }
void CurveEditInstance::removeSelectedControlPoints() { unsigned int numPointsToRemove = numSelected(); if (numPointsToRemove == 0) { rError() << "Can't remove any points, no control vertices selected.\n"; return; } if (_controlPoints.size() - numPointsToRemove < 3) { // Can't remove so many points rError() << "Can't remove so many points, curve would end up with less than 3 points.\n"; return; } // This is the list of iterators to be removed Curve::IteratorList iterators = getSelected(); // De-select everything before removal setSelected(false); // Now remove the points _curve.removeControlPoints(iterators); }
void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) { if (!item_pair) return; if (!item_pair->first) { llwarning("Attempt to selet an item pair containing null panel item", 0); return; } setFocus(TRUE); bool select_item = !isSelected(item_pair); //*TODO find a better place for that enforcing stuff if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return; if ( (mask & MASK_SHIFT) && !(mask & MASK_CONTROL) && mMultipleSelection && !mSelectedItemPairs.empty() ) { item_pair_t* last_selected_pair = mSelectedItemPairs.back(); // If item_pair is already selected - do nothing if (last_selected_pair == item_pair) return; bool grab_items = false; bool reverse = false; pairs_list_t pairs_to_select; // Pick out items from list between last selected and current clicked item_pair. for (pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end(); iter != iter_end; ++iter) { item_pair_t* cur = *iter; if (cur == last_selected_pair || cur == item_pair) { // We've got reverse selection if last grabed item isn't a new selection. reverse = grab_items && (cur != item_pair); grab_items = !grab_items; // Skip last selected and current clicked item pairs. continue; } if (!cur->first->getVisible()) { // Skip invisible item pairs. continue; } if (grab_items) { pairs_to_select.push_back(cur); } } if (reverse) { pairs_to_select.reverse(); } pairs_to_select.push_back(item_pair); for (pairs_iterator_t iter = pairs_to_select.begin(), iter_end = pairs_to_select.end(); iter != iter_end; ++iter) { item_pair_t* pair_to_select = *iter; if (isSelected(pair_to_select)) { // Item was already selected but there is a need to keep order from last selected pair to new selection. // Do it here to prevent extra mCommitOnSelectionChange in selectItemPair(). mSelectedItemPairs.remove(pair_to_select); mSelectedItemPairs.push_back(pair_to_select); } else { selectItemPair(pair_to_select, true); } } if (!select_item) { // Update last selected item border. mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); } return; } //no need to do additional commit on selection reset if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection(true); //only CTRL usage allows to deselect an item, usual clicking on an item cannot deselect it if (mask & MASK_CONTROL) selectItemPair(item_pair, select_item); else selectItemPair(item_pair, true); }