示例#1
0
TagPropWidget::TagPropWidget(QWidget* const parent)
    : QWidget(parent), d(new Private())
{
    QGridLayout* const grid = new QGridLayout(this);
    QLabel* const logo      = new QLabel(this);

    logo->setPixmap(KIcon("tag-properties").pixmap(30,30));
    d->topLabel = new QLabel(this);
    d->topLabel->setText(i18n("Tag Properties"));
    d->topLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    d->topLabel->setWordWrap(false);

    KSeparator* const line = new KSeparator(Qt::Horizontal, this);

    // --------------------------------------------------------

    QLabel* const titleLabel = new QLabel(this);
    titleLabel->setText(i18n("&Title:"));
    titleLabel->setMargin(KDialog::marginHint());
    titleLabel->setIndent(KDialog::spacingHint());

    d->titleEdit = new SearchTextBar(this, "TagEditDlgTitleEdit",
                                     i18n("Enter tag name here"));
    d->titleEdit->setCaseSensitive(false);
    titleLabel->setBuddy(d->titleEdit);

    QLabel* const tipLabel = new QLabel(this);
    tipLabel->setTextFormat(Qt::RichText);
    tipLabel->setWordWrap(true);
    tipLabel->setMargin(KDialog::marginHint());
    tipLabel->setIndent(KDialog::spacingHint());

    QLabel* const iconTextLabel = new QLabel(this);
    iconTextLabel->setText(i18n("&Icon:"));
    iconTextLabel->setMargin(KDialog::marginHint());
    iconTextLabel->setIndent(KDialog::spacingHint());

    d->iconButton         = new QPushButton(this);
    d->iconButton->setFixedSize(40, 40);
    iconTextLabel->setBuddy(d->iconButton);

    d->resetIconButton = new QPushButton(KIcon("view-refresh"), i18n("Reset"), this);

    QLabel* const kscTextLabel = new QLabel(this);
    kscTextLabel->setText(i18n("&Shortcut:"));
    kscTextLabel->setMargin(KDialog::marginHint());
    kscTextLabel->setIndent(KDialog::spacingHint());

    d->keySeqWidget      = new KKeySequenceWidget(this);
    kscTextLabel->setBuddy(d->keySeqWidget);
    d->keySeqWidget->setCheckActionCollections(TagsActionMngr::defaultManager()->actionCollections());

    QLabel* const tipLabel2 = new QLabel(this);
    tipLabel2->setTextFormat(Qt::RichText);
    tipLabel2->setWordWrap(true);
    tipLabel2->setText(i18n("<p><b>Note:</b> <i>This shortcut can be used "
                            "to assign or unassign tag to items.</i></p>"));
    tipLabel2->setMargin(KDialog::marginHint() );
    tipLabel2->setIndent(KDialog::spacingHint());

    d->saveButton = new QPushButton(i18n("Save"));
    d->discardButton = new QPushButton(i18n("Discard"));

    // --------------------------------------------------------

    grid->addWidget(logo,               0, 0, 1, 1);
    grid->addWidget(d->topLabel,        0, 1, 1, 4);
    grid->addWidget(line,               1, 0, 1, 4);
    grid->addWidget(tipLabel,           2, 0, 1, 4);
    grid->addWidget(titleLabel,         3, 0, 1, 1);
    grid->addWidget(d->titleEdit,       3, 1, 1, 3);
    grid->addWidget(iconTextLabel,      4, 0, 1, 1);
    grid->addWidget(d->iconButton,      4, 1, 1, 1);
    grid->addWidget(d->resetIconButton, 4, 2, 1, 1);
    grid->addWidget(kscTextLabel,       5, 0, 1, 1);
    grid->addWidget(d->keySeqWidget,    5, 1, 1, 3);
    grid->addWidget(tipLabel2,          6, 0, 1, 4);
    grid->addWidget(d->saveButton,      7, 0, 1, 1);
    grid->addWidget(d->discardButton,   7, 1, 1, 1);
    grid->setRowStretch(8, 10);
    grid->setColumnStretch(3, 10);
    grid->setMargin(KDialog::marginHint());
    grid->setVerticalSpacing(KDialog::spacingHint());

    adjustSize();

    connect(d->iconButton, SIGNAL(clicked()),
            this, SLOT(slotIconChanged()));

    connect(d->titleEdit, SIGNAL(textEdited(QString)),
            this, SLOT(slotDataChanged()));

    connect(d->resetIconButton, SIGNAL(clicked()),
            this,SLOT(slotIconResetClicked()));

    connect(d->keySeqWidget, SIGNAL(keySequenceChanged(QKeySequence)),
            this, SLOT(slotDataChanged()));

    connect(d->saveButton, SIGNAL(clicked()),
            this, SLOT(slotSaveChanges()));

    connect(d->discardButton, SIGNAL(clicked()),
            this, SLOT(slotDiscardChanges()));

    enableItems(TagPropWidget::DisabledAll);
}
示例#2
0
kgitView::kgitView(QWidget *parent)
    : kgitViewbase(parent),
    DCOPObject("kgitIface")
{
  // setup our layout manager to automatically add our widgets
  QHBoxLayout *top_layout = new QHBoxLayout(this);
  top_layout->setAutoAdd(true);

  // we want to look for all components that satisfy our needs.  the
  // trader will actually search through *all* registered KDE
  // applications and components -- not just KParts.  So we have to
  // specify two things: a service type and a constraint
  //
  // the service type is like a mime type.  we say that we want all
  // applications and components that can handle HTML -- 'text/html'
  //
  // however, by itself, this will return such things as Netscape..
  // not what we wanted.  so we constrain it by saying that the
  // string 'KParts/ReadOnlyPart' must be found in the ServiceTypes
  // field.  with this, only components of the type we want will be
  // returned.
  KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KParts/ReadWritePart' in ServiceTypes");

  KLibFactory *factory = 0;
  // in theory, we only care about the first one.. but let's try all
  // offers just in case the first can't be loaded for some reason
  KTrader::OfferList::Iterator it(offers.begin());
  for( ; it != offers.end(); ++it)
  {
    KService::Ptr ptr = (*it);

    // we now know that our offer can handle HTML and is a part.
    // since it is a part, it must also have a library... let's try to
    // load that now
    factory = KLibLoader::self()->factory( ptr->library() );
    if (factory)
    {
      m_html = static_cast<KParts::ReadWritePart *>(factory->create(this/*(QWidget *)layout4->parent()*/, ptr->name(), "KParts::ReadWritePart"));
      break;
    }
  }

  // if our factory is invalid, then we never found our component
  // and we might as well just exit now
  if (!factory)
  {
    KMessageBox::error(this, i18n("Could not find a suitable HTML component"));
    return;
  }

  //layout4->addWidget(m_html->widget());
  m_html->widget()->hide();
  connect(m_html, SIGNAL(setWindowCaption(const QString&)),
          this,   SLOT(slotSetTitle(const QString&)));
  connect(m_html, SIGNAL(setStatusBarText(const QString&)),
          this,   SLOT(slotOnURL(const QString&)));

	gitProc = new KProcIO;

	connect((QObject *)CommitButton,SIGNAL(clicked()),this,SLOT(slotCommitCurrent()));	
	connect((QObject *)DiscardChangesButton,SIGNAL(clicked()),this,SLOT(slotDiscardChanges()));	
	connect((QObject *)UndoCommitButton,SIGNAL(clicked()),this,SLOT(slotUndoLastCommit()));	
	connect((QObject *)RevertCommitButton,SIGNAL(clicked()),this,SLOT(slotRevertCommit()));	
	connect((QObject *)CherryPickFromOtherButton,SIGNAL(clicked()),this,SLOT(slotCherryPickFromOther()));	
	connect((QObject *)SendPatchButton,SIGNAL(clicked()),this,SLOT(slotSendPatch()));	
	
	connect(comboBoxBranches, SIGNAL(activated(const QString&)),this,SLOT(slotGitChangeBranch(const QString&)));

	connect(ShortLogList, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int ) ),this,SLOT(slotGitShowCommitDiff()));
	ShortLogList->setSorting(-1);

	connect(RepoTreeList, SIGNAL(selectionChanged()),this,SLOT(slotUpdateFilesToCommit()));
	connect(FileListFilterText, SIGNAL(textChanged ( const QString & )),this,SLOT(slotFileFilter(const QString &)));
	
	commit_files = new QStringList;
	branches = new QStringList;

	busyWaiting=0;
}