Example #1
0
CustomTemplates::CustomTemplates( QWidget *parent, const char *name )
  :CustomTemplatesBase( parent, name ), mCurrentItem( 0 )
{
  QFont f = KGlobalSettings::fixedFont();
  mEdit->setFont( f );

  mAdd->setIconSet( BarIconSet( "add", KIcon::SizeSmall ) );
  mRemove->setIconSet( BarIconSet( "remove", KIcon::SizeSmall ) );

  mList->setColumnWidth( 0, 50 );
  mList->setColumnWidth( 1, 100 );

  mEditFrame->setEnabled( false );

  connect( mEdit, SIGNAL( textChanged() ),
           this, SLOT( slotTextChanged( void ) ) );

  connect( mInsertCommand, SIGNAL( insertCommand(QString, int) ),
           this, SLOT( slotInsertCommand(QString, int) ) );

  connect( mAdd, SIGNAL( clicked() ),
           this, SLOT( slotAddClicked() ) );
  connect( mRemove, SIGNAL( clicked() ),
           this, SLOT( slotRemoveClicked() ) );
  connect( mList, SIGNAL( selectionChanged() ),
           this, SLOT( slotListSelectionChanged() ) );
  connect( mType, SIGNAL( activated( int ) ),
           this, SLOT( slotTypeActivated( int ) ) );

  connect( mKeyButton, SIGNAL( capturedShortcut( const KShortcut& ) ),
           this, SLOT( slotShortcutCaptured( const KShortcut& ) ) );

  mReplyPix = KIconLoader().loadIcon( "mail_reply", KIcon::Small );
  mReplyAllPix = KIconLoader().loadIcon( "mail_replyall", KIcon::Small );
  mForwardPix = KIconLoader().loadIcon( "mail_forward", KIcon::Small );

  mType->clear();
  mType->insertItem( QPixmap(), i18n( "Message->", "Universal" ), TUniversal );
  mType->insertItem( mReplyPix, i18n( "Message->", "Reply" ), TReply );
  mType->insertItem( mReplyAllPix, i18n( "Message->", "Reply to All" ), TReplyAll );
  mType->insertItem( mForwardPix, i18n( "Message->", "Forward" ), TForward );

  QString help =
      i18n( "<qt>"
            "<p>Here you can add, edit, and delete custom message "
            "templates to use when you compose a reply or forwarding message. "
            "Create the custom template by selecting it using the right mouse "
            " button menu or toolbar menu. Also, you can bind a keyboard "
            "combination to the template for faster operations.</p>"
            "<p>Message templates support substitution commands "
            "by simple typing them or selecting them from menu "
            "<i>Insert command</i>.</p>"
            "<p>There are four types of custom templates: used to "
            "<i>Reply</i>, <i>Reply to All</i>, <i>Forward</i>, and "
            "<i>Universal</i> which can be used for all kind of operations. "
            "You cannot bind keyboard shortcut to <i>Universal</i> templates.</p>"
            "</qt>" );
  mHelp->setText( i18n( "<a href=\"whatsthis:%1\">How does this work?</a>" ).arg( help ) );
}
Example #2
0
// public
QIconSet kpTool::iconSet (int forceSize) const
{
#if DEBUG_KP_TOOL && 0
    kdDebug () << "kpTool(" << name () << ")::iconSet(forceSize=" << forceSize << ")" << endl;
#endif
    // (robust in case BarIcon() default arg changes)
    if (forceSize > 0)
        return BarIconSet (name (), forceSize);
    else
        return BarIconSet (name ());
}
Example #3
0
ConfFilters::ConfFilters(TQWidget *parent, const char *name)
: TQWidget(parent, name)
{
	m_filters = new TDEListView(this);
	m_filters->addColumn(i18n("Mime Type"));
	m_filters->addColumn(i18n("Command"));
	m_filters->setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
	m_filters->setLineWidth(1);
	m_filters->setSorting(-1);
	m_filters->header()->setStretchEnabled(true, 1);
	connect(m_filters, TQT_SIGNAL(doubleClicked(TQListViewItem*)), TQT_SLOT(slotChange()));

	m_add = new TQPushButton(this);
	m_add->setPixmap(BarIcon("document-new"));
	m_remove = new TQPushButton(this);
	m_remove->setIconSet(BarIconSet("remove"));
	m_change = new TQPushButton(this);
	m_change->setIconSet(BarIconSet("filter"));
	m_up = new TQPushButton(this);
	m_up->setIconSet(BarIconSet("go-up"));
	m_down = new TQPushButton(this);
	m_down->setIconSet(BarIconSet("go-down"));
	connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAdd()));
	connect(m_change, TQT_SIGNAL(clicked()), TQT_SLOT(slotChange()));
	connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemove()));
	connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotUp()));
	connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotDown()));
	TQToolTip::add(m_add, i18n("Add filter"));
	TQToolTip::add(m_change, i18n("Modify filter"));
	TQToolTip::add(m_remove, i18n("Remove filter"));
	TQToolTip::add(m_up, i18n("Move filter up"));
	TQToolTip::add(m_down, i18n("Move filter down"));

	TQHBoxLayout	*l0 = new TQHBoxLayout(this, 10, 10);
	TQVBoxLayout	*l1 = new TQVBoxLayout(0, 0, 0);
	l0->addWidget(m_filters, 1);
	l0->addLayout(l1, 0);
	l1->addWidget(m_add);
	l1->addWidget(m_change);
	l1->addWidget(m_remove);
	l1->addSpacing(10);
	l1->addWidget(m_up);
	l1->addWidget(m_down);
	l1->addStretch(1);
	updateButton();
	connect(m_filters, TQT_SIGNAL(selectionChanged ()),TQT_SLOT(updateButton()));
}
Example #4
0
void KMInstancePage::addButton(const QString &txt, const QString &pixmap, const char *receiver)
{
    QPushButton *btn = new QPushButton(this, 0L);
    btn->setText(txt);
    btn->setIconSet(BarIconSet(pixmap));
    btn->setFlat(true);
    connect(btn, SIGNAL(clicked()), receiver);
    m_buttons.append(btn);
}
CompletionOrderEditor::CompletionOrderEditor(KPIM::LdapSearch *ldapSearch,
        QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, i18n("Edit Completion Order"), Ok | Cancel, Ok, true),
      mConfig("kpimcompletionorder"), mDirty(false)
{
    mItems.setAutoDelete(true);
    // The first step is to gather all the data, creating CompletionItem objects
    QValueList< LdapClient * > ldapClients = ldapSearch->clients();
    for(QValueList<LdapClient *>::const_iterator it = ldapClients.begin(); it != ldapClients.end(); ++it)
    {
        //kdDebug(5300) << "LDAP: host " << (*it)->host() << " weight " << (*it)->completionWeight() << endl;
        mItems.append(new LDAPCompletionItem(*it));
    }
    KABC::AddressBook *addressBook = KABC::StdAddressBook::self(true);
    QPtrList<KABC::Resource> resources = addressBook->resources();
    for(QPtrListIterator<KABC::Resource> resit(resources); *resit; ++resit)
    {
        //kdDebug(5300) << "KABC Resource: " << (*resit)->className() << endl;
        ResourceABC *res = dynamic_cast<ResourceABC *>(*resit);
        if(res)      // IMAP KABC resource
        {
            const QStringList subresources = res->subresources();
            for(QStringList::const_iterator it = subresources.begin(); it != subresources.end(); ++it)
            {
                mItems.append(new KABCImapSubResCompletionItem(res, *it));
            }
        }
        else     // non-IMAP KABC resource
        {
            mItems.append(new SimpleCompletionItem(this, (*resit)->resourceName(),
                                                   (*resit)->identifier()));
        }
    }

#ifndef KDEPIM_NEW_DISTRLISTS // new distr lists are normal contact, so no separate item if using them
    // Add an item for distribution lists
    mItems.append(new SimpleCompletionItem(this, i18n("Distribution Lists"), "DistributionLists"));
#endif

    // Now sort the items, then create the GUI
    mItems.sort();

    QHBox *page = makeHBoxMainWidget();
    mListView = new KListView(page);
    mListView->setSorting(-1);
    mListView->addColumn(QString::null);
    mListView->header()->hide();

    for(QPtrListIterator<CompletionItem> compit(mItems); *compit; ++compit)
    {
        new CompletionViewItem(mListView, *compit);
        kdDebug(5300) << "  " << (*compit)->label() << " " << (*compit)->completionWeight() << endl;
    }

    QVBox *upDownBox = new QVBox(page);
    mUpButton = new KPushButton(upDownBox, "mUpButton");
    mUpButton->setIconSet(BarIconSet("up", KIcon::SizeSmall));
    mUpButton->setEnabled(false);   // b/c no item is selected yet
    mUpButton->setFocusPolicy(StrongFocus);

    mDownButton = new KPushButton(upDownBox, "mDownButton");
    mDownButton->setIconSet(BarIconSet("down", KIcon::SizeSmall));
    mDownButton->setEnabled(false);   // b/c no item is selected yet
    mDownButton->setFocusPolicy(StrongFocus);

    QWidget *spacer = new QWidget(upDownBox);
    upDownBox->setStretchFactor(spacer, 100);

    connect(mListView, SIGNAL(selectionChanged(QListViewItem *)),
            SLOT(slotSelectionChanged(QListViewItem *)));
    connect(mUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUp()));
    connect(mDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDown()));
}
Example #6
0
void ExtDatePicker::init( const ExtDate &dt )
{
  d = new ExtDatePickerPrivate();

  d->calendar = new ExtCalendarSystemGregorian();

  QBoxLayout * topLayout = new QVBoxLayout(this);

  d->navigationLayout = new QHBoxLayout(topLayout);
  d->navigationLayout->addStretch();
  yearBackward = new QToolButton(this);
  yearBackward->setAutoRaise(true);
  d->navigationLayout->addWidget(yearBackward);
  monthBackward = new QToolButton(this);
  monthBackward ->setAutoRaise(true);
  d->navigationLayout->addWidget(monthBackward);
  d->navigationLayout->addSpacing(KDialog::spacingHint());

  selectMonth = new QToolButton(this);
  selectMonth ->setAutoRaise(true);
  d->navigationLayout->addWidget(selectMonth);
  selectYear = new QToolButton(this);
  selectYear->setToggleButton(true);
  selectYear->setAutoRaise(true);
  d->navigationLayout->addWidget(selectYear);
  d->navigationLayout->addSpacing(KDialog::spacingHint());

  monthForward = new QToolButton(this);
  monthForward ->setAutoRaise(true);
  d->navigationLayout->addWidget(monthForward);
  yearForward = new QToolButton(this);
  yearForward ->setAutoRaise(true);
  d->navigationLayout->addWidget(yearForward);
  d->navigationLayout->addStretch();

  line = new KLineEdit(this);
  val = new ExtDateValidator(this);
  table = new ExtDateTable(this);
  fontsize = KGlobalSettings::generalFont().pointSize();
  if (fontsize == -1)
     fontsize = QFontInfo(KGlobalSettings::generalFont()).pointSize();

  fontsize++; // Make a little bigger

  d->selectWeek = new QComboBox(false, this);  // read only week selection
  d->todayButton = new QToolButton(this);
  d->todayButton->setIconSet(SmallIconSet("today"));

  QToolTip::add(yearForward, i18n("Next year"));
  QToolTip::add(yearBackward, i18n("Previous year"));
  QToolTip::add(monthForward, i18n("Next month"));
  QToolTip::add(monthBackward, i18n("Previous month"));
  QToolTip::add(d->selectWeek, i18n("Select a week"));
  QToolTip::add(selectMonth, i18n("Select a month"));
  QToolTip::add(selectYear, i18n("Select a year"));
  QToolTip::add(d->todayButton, i18n("Select the current day"));

  // -----
  setFontSize(fontsize);
  line->setValidator(val);
  line->installEventFilter( this );
  if (  QApplication::reverseLayout() )
  {
      yearForward->setIconSet(BarIconSet(QString::fromLatin1("2leftarrow")));
      yearBackward->setIconSet(BarIconSet(QString::fromLatin1("2rightarrow")));
      monthForward->setIconSet(BarIconSet(QString::fromLatin1("1leftarrow")));
      monthBackward->setIconSet(BarIconSet(QString::fromLatin1("1rightarrow")));
  }
  else
  {
      yearForward->setIconSet(BarIconSet(QString::fromLatin1("2rightarrow")));
      yearBackward->setIconSet(BarIconSet(QString::fromLatin1("2leftarrow")));
      monthForward->setIconSet(BarIconSet(QString::fromLatin1("1rightarrow")));
      monthBackward->setIconSet(BarIconSet(QString::fromLatin1("1leftarrow")));
  }
  connect(table, SIGNAL(dateChanged(const ExtDate&)), SLOT(dateChangedSlot(const ExtDate&)));
  connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
  connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
  connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
  connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
  connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked()));
  connect(d->selectWeek, SIGNAL(activated(int)), SLOT(weekSelected(int)));
  connect(d->todayButton, SIGNAL(clicked()), SLOT(todayButtonClicked()));
  connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked()));
  connect(selectYear, SIGNAL(toggled(bool)), SLOT(selectYearClicked()));
  connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
  table->setFocus();


  topLayout->addWidget(table);

  QBoxLayout * bottomLayout = new QHBoxLayout(topLayout);
  bottomLayout->addWidget(d->todayButton);
  bottomLayout->addWidget(line);
  bottomLayout->addWidget(d->selectWeek);

  table->setDate(dt);
  dateChangedSlot(dt);  // needed because table emits changed only when newDate != oldDate
}