void Smb4KConfigPageAuthentication::slotDetailsClicked(bool checked)
{
  QList<QListWidgetItem *> selected_items = m_entries_widget->selectedItems();
  
  if (checked && !selected_items.isEmpty())
  {
    // Since we have single selection defined, there is definitely
    // only one entry in the list.
    for (int i = 0; i < m_entries_list.size(); ++i)
    {
      if (QString::compare(selected_items.first()->text(), m_entries_list.at(i)->unc()) == 0 ||
           (QString::compare(selected_items.first()->text(), i18n("Default Login")) == 0 &&
            m_entries_list.at(i)->type() == UnknownNetworkItem))
      {
        showDetails(m_entries_list.at(i));
        break;
      }
      else
      {
        continue;
      }
    }
  }
  else
  {
    clearDetails();
  }
}
void Smb4KConfigPageAuthentication::slotItemSelectionChanged()
{
  // Clear details stuff
  clearDetails();
  
  // Enable the details and remove action
  m_collection->action("remove_action")->setEnabled(true);
}
void Smb4KConfigPageAuthentication::slotRemoveActionTriggered(bool /*checked*/)
{
  if ((m_details_widget->rowCount() != 0 && m_details_widget->columnCount() != 0) &&
       QString::compare(m_entries_widget->currentItem()->text(), m_details_widget->item(0, 1)->text()) == 0)
  {
    clearDetails();
  }
  else
  {
    // Do nothing
  }

  for (int i = 0; i < m_entries_list.size(); ++i)
  {
    if (QString::compare(m_entries_widget->currentItem()->text(), m_entries_list.at(i)->unc()) == 0 ||
         (QString::compare(m_entries_widget->currentItem()->text(), i18n("Default Login")) == 0 &&
         m_entries_list.at(i)->type() == UnknownNetworkItem))
    {
      switch (m_entries_list.at(i)->type())
      {
        case UnknownNetworkItem:
        {
          QCheckBox *default_login = findChild<QCheckBox *>("kcfg_UseDefaultLogin");
          m_default_login = default_login->isChecked();
          default_login->setChecked(false);
          break;
        }
        default:
        {
          break;
        }
      }
      
      delete m_entries_list.takeAt(i);
      break;
    }
    else
    {
      continue;
    }
  }

  delete m_entries_widget->currentItem();
  
  m_collection->action("undo_list_action")->setEnabled(true);
  m_collection->action("clear_action")->setEnabled((m_entries_widget->count() != 0));
  
  m_maybe_changed = true;
  emit walletEntriesModified();
}
Beispiel #4
0
void ShotgunField::onUpdate(const QVariant context)
{
    info() << "Update with context" << context;
    trace() << ".update(" << context << ")";

    clearDetails();

    // TODO: ugly...
    if (source())
        setCount(source()->count());
    else
        setCount(1);

    if (count() > 0) {
        OperationAttached::Status status = OperationAttached::Finished;

        for (int i = 0; i < count(); i++) {
            setIndex(i);

            QVariant value = buildValue(i, context.toMap());

            if (value.isValid()) {
                // TODO: Qt bug? null QVariant converts to a non-null QJSValue
                setDetail(i, "value", value.isNull() ? QJSValue(QJSValue::NullValue) : toScriptValue(value));
            } else {
                error() << "Unable to build value";
                status = OperationAttached::Error;
            }
        }

        emit updateFinished(status);
    } else {
        debug() << "source" << source() << "has count of" << source()->count();
        emit updateFinished(OperationAttached::Finished);
    }
}
void Smb4KConfigPageAuthentication::slotClearActionTriggered(bool /*checked*/)
{
  clearDetails();
  
  while (m_entries_widget->count() != 0)
  {
    delete m_entries_widget->item(0);
  }
  
  while(!m_entries_list.isEmpty())
  {
    delete m_entries_list.takeFirst();
  }
  
  m_collection->action("undo_list_action")->setEnabled(true);
  m_collection->action("clear_action")->setEnabled(false);
  
  QCheckBox *default_login = findChild<QCheckBox *>("kcfg_UseDefaultLogin");
  m_default_login = default_login->isChecked();
  default_login->setChecked(false);
  
  m_maybe_changed = true;
  emit walletEntriesModified();
}
Beispiel #6
0
QTM_BEGIN_NAMESPACE

/*!
  \class QContact

  \brief The QContact class represents an addressbook contact.

  \inmodule QtContacts
  \since 1.0

  \ingroup contacts-main

  Individual contacts, groups, and other types of contacts are represented with
  a QContact object.  In addition to the type, a QContact consists of information
  that belongs to the contact, some information about the relationships that the
  contact has, and the preferred ways to interact with the contact.

  A QContact object has a collection of details (like a name, phone numbers and
  email addresses).  Each detail (which can have multiple fields) is stored
  in an appropriate subclass of QContactDetail, and the QContact allows
  retrieving these details in various ways.

  Depending on the details of the QContact, certain actions are available for a
  contact.  An instance of a QContact can return a list of actions that can be
  performed on it, and a list of details supported by a specific action can be
  retrieved (for example - a list of phone numbers supported by a specific "Call" action).
  It is also possible to store one detail for each type of action that is the "preferred"
  detail to use.

  A QContact may have zero or more relationships with other contacts.  For example,
  a group contact would have a \c "HasMember" relationship with the QContacts that
  are its members.  Spouses, managers and assistants can also be represented this
  way.

  A QContact instance represents the in-memory version of an addressbook contact,
  and has no tie to a specific QContactManager.  It is possible for the contents
  of a QContact to change independently of the contents that are stored persistently
  in a QContactManager.  A QContact has an ID associated with it when it is first
  retrieved from a QContactManager, or after it has been first saved, and this allows
  clients to track changes using the signals in QContactManager.

  A QContact has a number of mandatory details:
  \list
   \o A QContactType, with the type of the contact (individual contact, group etc)
   \o A QContactDisplayLabel, representing the text to display
  \endlist

  If you have edited the contents of a QContact (via saving or removing details),
  you will need to ask a specific QContactManager for the new display label for the
  contact, since system settings (like the order of first or last names) can vary
  between managers.

  \sa QContactManager, QContactDetail
 */

/*!
 * \fn QList<T> QContact::details() const
 * Returns a list of details of the template parameter type.  The type must be
 * a subclass of QContactDetail.
 *
 * For example:
 *  \snippet doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp 3
 * \since 1.0
 */

/*!
 * \fn QList<T> QContact::details(const QString& fieldName, const QString& value) const
 * Returns a list of details of the template parameter type which have field called \a fieldName, with matching \a value.
 * The type must be a subclass of QContactDetail.
 *
 * For example:
 *  \snippet doc/src/snippets/qtcontactsdocsample/qtcontactsdocsample.cpp 4
 * \since 1.0
 */

/*!
 * \fn T QContact::detail() const
 * Returns the first detail of the template parameter type, as returned by the template details() function.
 * The type must be a subclass of QContactDetail.
 * \since 1.0
 */

/*!
 * \fn QContact::operator!=(const QContact &other) const
 * Returns true if this contacts id or details are different to those of the \a other contact.
 * \since 1.0
 */

/*!
    Construct an empty contact.

    The contact will have an empty display label, an empty id, and have type \l QContactType::TypeContact.
    The isEmpty() function will return true.
*/
QContact::QContact()
    : d(new QContactData)
{
    clearDetails();
}
QDeclarativeContact::~QDeclarativeContact()
{
    clearDetails();
}
bool Smb4KConfigPageAuthentication::eventFilter(QObject *object, QEvent *e)
{
  if (object == m_entries_widget->viewport())
  {
    // If the user clicked on the viewport of the entries view, clear 
    // the details widget and the "Details" button, if no item 
    // is under the mouse.
    if (e->type() == QEvent::MouseButtonPress)
    {
      QMouseEvent *event = static_cast<QMouseEvent *>(e);
      QPoint pos = m_entries_widget->mapFromGlobal(event->globalPos());
        
      if (!m_entries_widget->itemAt(pos))
      {
        clearDetails();
        m_entries_widget->clearSelection();
        m_collection->action("remove_action")->setEnabled(false);
      }
      else
      {
        // Do nothing. Is managed by slotItemSelectionChanged().
      }
    }
    else
    {
      // Do nothing
    }
    
    return m_entries_widget->viewport()->eventFilter(object, e);
  }
  else if (object == m_details_widget->viewport())
  {
    // Enable/disable the edit action.
    if (e->type() == QEvent::MouseButtonPress)
    {
      QMouseEvent *event = static_cast<QMouseEvent *>(e);
      QPoint pos = m_details_widget->mapFromGlobal(event->globalPos());
      
      if (m_details_widget->columnAt(pos.x()) > 0 && m_details_widget->rowAt(pos.y()) > 0)
      {
        m_collection->action("edit_action")->setEnabled(true);
      }
      else
      {
        m_collection->action("edit_action")->setEnabled(false);
      }
    }
    else
    {
      // Do nothing
    }
    
    return m_details_widget->viewport()->eventFilter(object, e);
  }
  else
  {
    // Do nothing
  }
  
  return QTabWidget::eventFilter(object, e);
}