Logo Search packages:      
Sourcecode: basket version File versions  Download package

void Basket::editItem ( Item item,
bool  editAnnotations = false 
) [slot]

Actions on (selected) items

Definition at line 2020 of file basket.cpp.

References editItem(), ItemEditorBase::editorWidget(), ItemEditorBase::goFirstFocus(), Item::isAlternate(), Container::setStatusBarEditing(), ItemEditorBase::toolbar(), and Item::type().

Referenced by Container::editItem(), editItem(), and Item::slotEdit().

{
      if (isLocked())
            return;

      if (m_editor != 0L) // It arrive toolbar of another editor stay shown...
            closeEditor();

      setFocusedItem(item); // Focus and select item (in case of new inserted item)
      unselectAllBut(item);

      // If possible and if wanted, use inline editor :
      if ( Settings::useInlineEditors() && !editAnnotations && Global::mainContainer->isShown() &&
           (item->type() == Item::Text || item->type() == Item::Html) ) {
            if (item->type() == Item::Text)
                  m_editor = new ItemTextEditor(item, Global::mainContainer, viewport(), m_stackedKeyEvent);
            else
                  m_editor = new ItemHtmlEditor(item, Global::mainContainer, viewport(), m_stackedKeyEvent);
            Global::mainContainer->addDockWindow(m_editor->toolbar());
/*          // DISABLE all SHOWN items:
            for (Item *it = firstShownItem(); it != 0L; it = it->next())
                  if (it->isShown()) {
                        it->setEnabled(false);
                        if (it == lastShownItem())
                              break;
                  }*/
            // The editor :
            m_editor->editorWidget()->setPaletteBackgroundColor(item->isAlternate() ? altColor() : color());
            m_editor->editorWidget()->reparent( viewport(), QPoint(0,0), true );
            addChild(m_editor->editorWidget(), 0, 0);
            placeEditor();
//          ((QFrame*)m_editor->editorWidget())->setFrameShape(QFrame::NoFrame);
//          ((QFrame*)m_editor->editorWidget())->setLineWidth(1);
            // To avoid a one line text with an hozirontal scrollBar that take all the widget :
            if (item->type() == Item::Text || item->type() == Item::Html)
                  ((QScrollView*)m_editor->editorWidget())->setHScrollBarMode(QScrollView::AlwaysOff);
            m_editor->editorWidget()->show();
            m_editor->editorWidget()->raise();
            m_editor->goFirstFocus();
            connect( m_editor, SIGNAL(focusOut()), this, SLOT(closeEditor()) );
            connect( (QTextEdit*)(m_editor->editorWidget()), SIGNAL(textChanged()), this, SLOT(placeEditor()) );
//          if (m_stackedKeyEvent) {
//                kapp->postEvent(m_editor->editorWidget(), m_stackedKeyEvent);
            m_stackedKeyEvent = 0L;
//          }
            kapp->processEvents();   // Show the editor toolbar before ensuring the item is visible
            ensureVisibleItem(item); //  because toolbar can create a new line and then partially hide the item
            Global::mainContainer->setStatusBarEditing();
      } else {
            ItemEditDialog *dialog = new ItemEditDialog(item, editAnnotations, item, m_stackedKeyEvent);
            dialog->exec();
            m_stackedKeyEvent = 0L;
            delete dialog;
      }
}


Generated by  Doxygen 1.6.0   Back to index