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

ItemLinkEditWidget::ItemLinkEditWidget ( Item item,
QWidget *  parent = 0,
const char *  name = 0,
WFlags  fl = 0,
QKeyEvent *  ke = 0L 
)

ItemLinkEditWidget

Definition at line 611 of file itemedit.cpp.

References Item::autoIcon(), Item::autoTitle(), Item::icon(), LinkLook::iconSize(), Item::title(), and Item::url().

 : ItemEditWidgetBase(item, parent, name, fl)
{
      QGridLayout *layout = new QGridLayout(this, 3, 2, 0, 6);

      m_url = new KURLRequester(m_item->url().url(), this);

      QWidget *wid1 = new QWidget(this);
      QHBoxLayout *titleLay = new QHBoxLayout(wid1, 0, 6);
      m_title = new QLineEdit(m_item->title(), wid1);
      m_autoTitle = new QPushButton(i18n("Auto"), wid1);
      m_autoTitle->setToggleButton(true);
      m_autoTitle->setOn(item->autoTitle());
      titleLay->addWidget(m_title);
      titleLay->addWidget(m_autoTitle);

      QWidget *wid = new QWidget(this);
      QHBoxLayout *hLay = new QHBoxLayout(wid, 0, 6);
      m_icon = new KIconButton(wid);
      QLabel *label3 = new QLabel(m_icon, i18n("&Icon:"), this);
      m_icon->setIconType ( KIcon::NoGroup, KIcon::MimeType );
      m_icon->setIconSize( LinkLook::lookForURL( KURL(m_url->lineEdit()->text()) )->iconSize() );
      QPushButton *button2 = new QPushButton(i18n("Cl&ear"),  wid); // Create before to know size here:
      /* Icon button: */
      m_icon->setIcon(item->icon());
      int minSize = button2->sizeHint().height();
      // Make the icon button at least the same heigh than the other buttons for a better alignment (nicer to the eyes):
      if (m_icon->sizeHint().height() < minSize)
            m_icon->setFixedSize(minSize, minSize);
      else
            m_icon->setFixedSize(m_icon->sizeHint().height(), m_icon->sizeHint().height()); // Make it square
      if ( item->icon().isEmpty() )
            m_icon->resetIcon();
      /* Auto button: */
      m_autoIcon = new QPushButton(i18n("Auto"), wid);
      m_autoIcon->setToggleButton(true);
      m_autoIcon->setOn(item->autoIcon());
      hLay->addWidget(m_icon);
      hLay->addWidget(button2);
      hLay->addWidget(m_autoIcon);
      hLay->addStretch();

      //m_url->setShowLocalProtocol(true);
      QLabel      *label1 = new QLabel(m_url,   i18n("&URL:"),    this);
      QLabel      *label2 = new QLabel(m_title, i18n("&Title:"),  this);
      layout->addWidget(label1,  0, 0, Qt::AlignVCenter);
      layout->addWidget(label2,  1, 0, Qt::AlignVCenter);
      layout->addWidget(label3,  2, 0, Qt::AlignVCenter);
      layout->addWidget(m_url,   0, 1, Qt::AlignVCenter);
      layout->addWidget(wid1,    1, 1, Qt::AlignVCenter);
      layout->addWidget(wid,     2, 1, Qt::AlignVCenter);

      m_isAutoModified = false;
      connect( m_url,   SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))     );
      connect( m_title, SIGNAL(textChanged(const QString&)), this, SLOT(doNotAutoTitle(const QString&)) );
      connect( m_icon,  SIGNAL(iconChanged(QString))       , this, SLOT(doNotAutoIcon(QString))         );
      connect( m_autoTitle, SIGNAL(clicked()), this, SLOT(guessTitle()) );
      connect( m_autoIcon,  SIGNAL(clicked()), this, SLOT(guessIcon())  );
      connect( button2,     SIGNAL(pressed()), this, SLOT(emptyIcon())  );

      urlChanged("");

      if (ke)
            kapp->postEvent(m_url->lineEdit(), ke);
}


Generated by  Doxygen 1.6.0   Back to index