Пример #1
0
void KexiNameDialog::init()
{
    d->checkIfObjectExists = false;
    d->allowOverwriting = false;
    d->validator = 0;
    setButtons(Ok | Cancel | Help);
    QGridLayout *lyr = new QGridLayout(mainWidget());
    d->icon = new QLabel(mainWidget());
    d->icon->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    QSizePolicy sp(QSizePolicy::Fixed, QSizePolicy::Preferred);
    sp.setHorizontalStretch(1);
    d->icon->setSizePolicy(sp);
    d->icon->setFixedWidth(50);
    lyr->addWidget(d->icon, 0, 0);

    sp = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    sp.setHorizontalStretch(1);
    d->widget->setSizePolicy(sp);
    lyr->addWidget(d->widget, 0, 1);
    lyr->addItem(new QSpacerItem(25, 10, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
    lyr->addItem(new QSpacerItem(5, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 1);
// d->widget->captionLineEdit()->selectAll();
// d->widget->captionLineEdit()->setFocus();
    connect(d->widget, SIGNAL(messageChanged()), this, SLOT(updateSize()));
    updateSize();
    enableButtonOk(true);
    slotTextChanged();
    connect(d->widget, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
}
Пример #2
0
 void FieldLineEdit::enableSignals( bool enabled )
 {
     switch ( m_inputType )
     {
     case itSingleLine:
         if ( enabled )
         {
             connect( m_lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChanged( ) ) );
             connect( m_lineEdit, SIGNAL( textChanged( const QString& ) ), this, SIGNAL( textChanged( ) ) );
         }
         else
         {
             disconnect( m_lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChanged( ) ) );
             disconnect( m_lineEdit, SIGNAL( textChanged( const QString& ) ), this, SIGNAL( textChanged( ) ) );
         }
         break;
     case itMultiLine:
         if ( enabled )
         {
             connect( m_textEdit, SIGNAL( textChanged( ) ), this, SLOT( slotTextChanged( ) ) );
             connect( m_textEdit, SIGNAL( textChanged( ) ), this, SIGNAL( textChanged( ) ) );
         }
         else
         {
             disconnect( m_textEdit, SIGNAL( textChanged( ) ), this, SLOT( slotTextChanged( ) ) );
             disconnect( m_textEdit, SIGNAL( textChanged( ) ), this, SIGNAL( textChanged( ) ) );
         }
         break;
     }
Пример #3
0
void TextMessageDlg::init(const User& user)
{
    ui.setupUi(this);
    setWindowIcon(QIcon(APPICON));

    connect(ui.cancelButton, SIGNAL(clicked()), SLOT(slotCancel()));
    connect(ui.sendButton, SIGNAL(clicked()), SLOT(slotSendMsg()));
    connect(ui.newmsgTextEdit, SIGNAL(textChanged()), SLOT(slotTextChanged()));
    connect(ui.newmsgTextEdit, SIGNAL(sendTextMessage(const QString&)),
            SLOT(slotSendMsg(const QString&)));
    slotUpdateUser(user);
    slotTextChanged();

    m_local_typing_id = startTimer(LOCAL_TYPING_DELAY);
}
Пример #4
0
AddTagsLineEdit::AddTagsLineEdit(QWidget* const parent)
    : QLineEdit(parent),
      d(new Private)
{
    setClearButtonEnabled(true);

    d->completer = new TagCompleter(this);
    d->completer->setMaxVisibleItems(15);

    setCompleter(d->completer);

    connect(this, SIGNAL(returnPressed()),
            this, SLOT(slotReturnPressed()));

    connect(this, SIGNAL(editingFinished()),
            this, SLOT(slotEditingFinished()));

    connect(this, SIGNAL(textChanged(QString)),
            this, SLOT(slotTextChanged(QString)));

    connect(this, SIGNAL(textEdited(QString)),
            d->completer, SLOT(slotTextEdited(QString)));

    connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::activated),
            [this](const TaggingAction& action){ completerActivated(action); });

    connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::highlighted),
            [this](const TaggingAction& action){ completerHighlighted(action); });
}
Пример #5
0
    // TextPropertyEditor
    TextPropertyEditor::TextPropertyEditor(QWidget *parent,
                                           EmbeddingMode embeddingMode,
                                           TextPropertyValidationMode validationMode) :
        QWidget(parent),
        m_validationMode(ValidationSingleLine),
        m_updateMode(UpdateAsYouType),
        m_lineEdit(new PropertyLineEdit(this)),
        m_textEdited(false)
    {
        switch (embeddingMode) {
        case EmbeddingNone:
            break;
        case EmbeddingTreeView:
            m_lineEdit->setFrame(false);
            break;
        case EmbeddingInPlace:
            m_lineEdit->setFrame(false);
            Q_ASSERT(parent);
            m_lineEdit->setBackgroundRole(parent->backgroundRole());
            break;
        }

        setFocusProxy(m_lineEdit);

        connect(m_lineEdit,SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
        connect(m_lineEdit,SIGNAL(returnPressed()), this, SLOT(slotEditingFinished()));
        connect(m_lineEdit,SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
        connect(m_lineEdit,SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited()));

        setTextPropertyValidationMode(validationMode);
    }
Пример #6
0
NewWindowDialog::NewWindowDialog(const KSircChannel &channelInfo, QWidget * parent, const char * name)
    : KDialogBase(parent, name, true, i18n("New Window For"), Ok|Cancel, Ok, true),
      m_channelInfo(channelInfo)
{
  QHBox * w = makeHBoxMainWidget();

  QLabel * l = new QLabel(i18n("C&hannel/Nick:"), w);

  m_combo = new KHistoryCombo(w);
  m_combo->setFocus();

  // we don't need duplicated channel into the list
  m_combo->setDuplicatesEnabled( false );

  l->setBuddy(m_combo);

  QLabel * l2 = new QLabel(i18n("&Key:"), w);
  m_le = new KLineEdit(w);
  m_le->setEnabled(false);
  l2->setBuddy(m_le);

  connect(
      m_combo, SIGNAL(activated(const QString &)),
      m_combo, SLOT(addToHistory(const QString &)));
  connect( m_combo->lineEdit(), SIGNAL(textChanged ( const QString & )),
	   this, SLOT( slotTextChanged( const QString &)));

  KConfig *kConfig = kapp->config();
  KConfigGroupSaver saver(kConfig, "Recent");
  m_combo->setHistoryItems(kConfig->readListEntry("Channels"));
  slotTextChanged( m_combo->lineEdit()->text());
}
Пример #7
0
TextEdit::TextEdit(QWidget *p, const char *name)
        : TextShow(p, name)
{
    m_param = NULL;
    m_bEmpty = true;
    m_bBold  = false;
    m_bItalic = false;
    m_bUnderline = false;
    m_bSelected  = false;
    m_bNoSelected = false;
    m_bInClick = false;
    setReadOnly(false);
    curFG = colorGroup().color(QColorGroup::Text);
    m_bCtrlMode = true;
    setWordWrap(WidgetWidth);
#if QT_VERSION >= 0x030100
    setAutoFormatting(0);
#endif
    connect(this, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(fontChanged(const QFont&)));
    connect(this, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(slotColorChanged(const QColor&)));
    connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
#if QT_VERSION >= 300
    connect(this, SIGNAL(clicked(int,int)), this, SLOT(slotClicked(int,int)));
#endif
    viewport()->installEventFilter(this);
    fontChanged(font());
}
Пример #8
0
UnicodeDialog::UnicodeDialog(InputMethod inputMeth) :
        inputMethod(inputMeth),
        m_lastCursorPos(0)
{
    setupUi(this);
    readChoices();
    showLastUnicode();
    connect(unicodeNumber, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
    connect(unicodeNumber, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
    connect(arrowUp, SIGNAL(clicked()), this, SLOT(slotPrevUnicode()));
    connect(arrowDown, SIGNAL(clicked()), this, SLOT(slotNextUnicode()));

    switch (inputMethod) {
    case InputHex:
        unicodeNumber->setMaxLength(MAX_LENGTH_HEX);
        break;

    case InputDec:
        break;
    }

    arrowUp->setShortcut(Qt::Key_Up);
    arrowDown->setShortcut(Qt::Key_Down);
    unicode_link->setText(i18n("Information about unicode characters: <a href=\"http://decodeunicode.org\">http://decodeunicode.org</a>"));
    arrowUp->setToolTip(i18n("Previous Unicode character (Arrow Up)"));
    arrowDown->setToolTip(i18n("Next Unicode character (Arrow Down)"));
    unicodeNumber->setToolTip(i18n("Enter your Unicode number here. Allowed characters: [0-9] and [a-f]."));
    unicodeNumber->selectAll(); // Selection will be reset by setToolTip and similar, so set it here

}
Пример #9
0
FormWidget::FormWidget(const QString &label, bool isEditable, QWidget *parent)
        : QWidget(parent),
          m_hideWhenEmpty(false)
{
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);

    m_label = new QLabel(this);
    QFont fnt;
    fnt.setBold(true);
    m_label->setFont(fnt);
    m_label->setText(label);
    layout->addWidget(m_label);

    m_editor = new FormatTextEdit(this);
    m_editor->setEditable(isEditable);
    //m_textEdit->setWhatsThis(tr("This area shows text from an auxillary translation."));
    layout->addWidget(m_editor);

    setLayout(layout);

    connect(m_editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
    connect(m_editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
    connect(m_editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
}
void QueueEditor::slotTransferModeChanged(int index)
{
  if (m_lastTransferType == index)
    return;
  else
    m_lastTransferType = (KFTPQueue::TransferType) index;

  resetTabs();
  resetServerData();
  
  switch (index) {
    case 0: {
      // Download - source: remote dest: local
      m_layout->serverTab->setTabEnabled(m_layout->tab, true);
      m_layout->serverTab->showPage(m_layout->tab);
      break;
    }
    case 1: {
      // Upload - source: local dest: remote
      m_layout->serverTab->setTabEnabled(m_layout->tab_2, true);
      m_layout->serverTab->showPage(m_layout->tab_2);
      break;
    }
    case 2: {
      // FXP - source: remote dest: remote
      m_layout->serverTab->setTabEnabled(m_layout->tab, true);
      m_layout->serverTab->setTabEnabled(m_layout->tab_2, true);
      m_layout->serverTab->showPage(m_layout->tab);
      break;
    }
  }

  slotTextChanged();
}
Пример #11
0
void KonqProfileDlg::loadAllProfiles(const QString & preselectProfile)
{
    bool profileFound = false;
    d->m_mapEntries.clear();
    d->m_pListView->clear();
    d->m_mapEntries = readAllProfiles();
    KonqProfileMap::ConstIterator eIt = d->m_mapEntries.constBegin();
    KonqProfileMap::ConstIterator eEnd = d->m_mapEntries.constEnd();
    for (; eIt != eEnd; ++eIt )
    {
        QListWidgetItem *item = new KonqProfileItem( d->m_pListView, eIt.key() );
        QString filename = eIt.value().mid( eIt.value().lastIndexOf( '/' ) + 1 );
        kDebug() << filename;
        if ( filename == preselectProfile )
        {
            profileFound = true;
            d->m_pProfileNameLineEdit->setText( eIt.key() );
            d->m_pListView->setCurrentItem( item );
        }
    }
    if (!profileFound)
        d->m_pProfileNameLineEdit->setText( preselectProfile);

    slotTextChanged( d->m_pProfileNameLineEdit->text() );  // really disable save button if text empty
}
Пример #12
0
KonqNewSessionDlg::KonqNewSessionDlg( QWidget *parent, QString sessionName )
    : KDialog( parent )
    , d( new KonqNewSessionDlgPrivate( this ) )
{
    d->layout()->setMargin( 0 );
    setMainWidget( d );
    
    setObjectName( QLatin1String( "konq_new_session_dialog" ) );
    setModal( true );
    setCaption( i18nc( "@title:window", "Save Session" ) );
    setButtons( Ok | Cancel );
    setDefaultButton( Ok );
    enableButton( Ok, false );
    
    if(!sessionName.isEmpty())
        d->m_pSessionName->setText(sessionName);
    
    d->m_pSessionName->setFocus();

    connect(this, SIGNAL(okClicked()), SLOT(slotAddSession()));
    connect(d->m_pSessionName, SIGNAL(textChanged(QString)), this,
        SLOT(slotTextChanged(QString)));
    
    resize( sizeHint() );
}
Пример #13
0
EditWithLabel::EditWithLabel( QString label, int id, QWidget* parent ) :
    QFrame( parent )
{
    m_id = id;

    QVBoxLayout* vLayout = new QVBoxLayout();

    QHBoxLayout* hLayout = new QHBoxLayout();
    m_label = new QLabel( label, this );
    hLayout->addWidget( m_label );
    hLayout->addStretch();

    QHBoxLayout* hLayout2 = new QHBoxLayout();
    m_lineEdit = new QLineEdit( this );
    hLayout2->addWidget( m_lineEdit );
    hLayout2->addStretch();

    vLayout->addLayout( hLayout );
    vLayout->addLayout( hLayout2 );
    vLayout->setContentsMargins( 1,1,1,1 );

    setLayout( vLayout );

    connect( m_lineEdit, SIGNAL( textEdited( QString ) ), this, SLOT( slotTextChanged( QString ) ) );

    setFrameStyle( QFrame::Panel | QFrame::Raised );

    setStyleSheet( "QLabel { font:  bold 12px; margin-bottom: -1px }"
                   "QLineEdit { font: 12px; max-height: 14px; margin-top: -1px }"
                 );
}
Пример #14
0
BackgroundParser::BackgroundParser(Document* doc, QObject *parent, const char *name)
  :  QObject(parent, name), m_ownerDoc(doc), /*m_ied(0),*/ m_timer(0)
{  
  connect(m_ownerDoc->view()->document(), SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
//   m_ied = dynamic_cast<KTextEditor::EditInterface*>(m_ownerDoc->view()->document());

  m_timer = new QTimer(this);
  connect(m_timer, SIGNAL(timeout()), this, SLOT(parse()));
}
Пример #15
0
/**
 *  Constructs a SelectOperationDialog instance.
 *
 *  @param  parent  The parent to this instance.
 *  @param  c       The concept to get the operations from.
 *  @param  enableAutoIncrement Flag to enable auto increment checkbox
 */
SelectOperationDialog::SelectOperationDialog(UMLView *parent, UMLClassifier * c, bool enableAutoIncrement)
  : SinglePageDialogBase(parent),
    m_id(CUSTOM),
    m_pView(parent),
    m_classifier(c)
{
    setCaption(i18n("Select Operation"));

    QFrame *frame = new QFrame(this);
    setMainWidget(frame);

    QVBoxLayout * topLayout = new QVBoxLayout(frame);

    m_pOpGB = new QGroupBox(i18n("Select Operation"));
    topLayout->addWidget(m_pOpGB);

    QGridLayout * mainLayout = new QGridLayout(m_pOpGB);
#if QT_VERSION < 0x050000
    mainLayout->setSpacing(spacingHint());
#endif
    mainLayout->setMargin(fontMetrics().height());

    Dialog_Utils::makeLabeledEditField(mainLayout, 0,
                                    m_pSeqL, i18n("Sequence number:"),
                                    m_pSeqLE);

    m_pOpAS = new QCheckBox(i18n("Auto increment:"), m_pOpGB);
    mainLayout->addWidget(m_pOpAS, 0, 2);
    connect(m_pOpAS, SIGNAL(toggled(bool)), this, SLOT(slotAutoIncrementChecked(bool)));
    m_pOpAS->setEnabled(enableAutoIncrement);

    m_pOpRB = new QLabel(i18n("Class operation:"), m_pOpGB);
    mainLayout->addWidget(m_pOpRB, 1, 0);

    m_pOpCB = new KComboBox(m_pOpGB);
#if QT_VERSION < 0x050000
    m_pOpCB->setCompletionMode(KGlobalSettings::CompletionPopup);
#endif
    m_pOpCB->setDuplicatesEnabled(false); // only allow one of each type in box
    connect(m_pOpCB, SIGNAL(currentIndexChanged(int)), this, SLOT(slotIndexChanged(int)));
    mainLayout->addWidget(m_pOpCB, 1, 1, 1, 2);

    m_newOperationButton = new QPushButton(i18n("New Operation..."), m_pOpGB);
    connect(m_newOperationButton, SIGNAL(clicked()), this, SLOT(slotNewOperation()));
    mainLayout->addWidget(m_newOperationButton, 1, 3);

    m_pCustomRB = new QLabel(i18n("Custom operation:"), m_pOpGB);
    mainLayout->addWidget(m_pCustomRB, 2, 0);

    m_pOpLE = new KLineEdit(m_pOpGB);
    connect(m_pOpLE, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
    mainLayout->addWidget(m_pOpLE, 2, 1, 1, 2);
    setupOperationsList();
    enableButtonOk(false);
}
Пример #16
0
void AdvancedRenameLineEdit::setupConnections()
{
    connect(d->parseTimer, SIGNAL(timeout()),
            this, SLOT(slotParseTimer()));

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

    connect(this, SIGNAL(cursorPositionChanged()),
            this, SLOT(slotCursorPositionChanged()));
}
Пример #17
0
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotItemHighlighted (int index) {
    if (index < 0 || index >= (int) profiles.size ()) {
        load->setEnabled (false);
        del->setEnabled (false);
    } else {
        profile->setText (profiles[profilelist->currentItem ()]->name);
        load->setEnabled (true);
        del->setEnabled (true);
        slotTextChanged (profilelist->currentText ());
    }
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(text())
{
    setSide(Utils::FancyLineEdit::Right);
    setPlaceholderText(tr("Filter"));
    setButtonToolTip(tr("Clear text"));
    setAutoHideIcon(true);
    connect(this, SIGNAL(buttonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(typedText())
{
    setSide(FancyLineEdit::Right);   
    setPixmap(QPixmap(QLatin1String(":/style/images/reset.png")));
    setHintText(tr("Type to filter"));

    connect(this, SIGNAL(buttonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
Пример #20
0
void KexiNameDialog::init()
{
	QGridLayout *lyr = new QGridLayout(plainPage(), 2, 3);
	m_icon = new QLabel( plainPage(), "icon" );
	m_icon->setAlignment( int( AlignTop | AlignLeft ) );
	m_icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred,1,0));
	m_icon->setFixedWidth(50);
	lyr->addWidget(m_icon,0,0);

	m_widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred,1,0));
	lyr->addWidget(m_widget,0,1);
	lyr->addItem(new QSpacerItem( 25, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2);
	lyr->addItem(new QSpacerItem( 5, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ), 1, 1);
//	m_widget->captionLineEdit()->selectAll();
//	m_widget->captionLineEdit()->setFocus();
	connect(m_widget,SIGNAL(messageChanged()),this, SLOT(updateSize()));
	updateSize();
	enableButtonOK( true );
	slotTextChanged();
	connect(m_widget, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
}
Пример #21
0
GMultiLineEditItem::GMultiLineEditItem( qreal w, qreal h,
    const PHIAItem *it, QGraphicsItem *parent ) : GWidgetItem( w, h, it, parent )
{
    qDebug( "GMultiLineEditItem::GMultiLineEditItem()" );
    _e=new QPlainTextEdit();
    connect( _e, SIGNAL( textChanged() ), this, SLOT( slotTextChanged() ) );
    setWidget( _e );
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    setMinimumSize( PHI::minimumSizeForBox() );
    resize( w, h );
    setCacheMode( NoCache );
}
Пример #22
0
UrlDlg::UrlDlg(QWidget *parent)
    : QDialog(parent)
    , m_pbClear(new QPushButton(this))
    , m_urlRequester(nullptr)
    , m_ui(new Ui::UrlDlg)
{
    m_ui->setupUi(this);
    m_ui->buttonBox->addButton(m_pbClear, QDialogButtonBox::DestructiveRole);
    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setShortcut(Qt::CTRL | Qt::Key_Return);
    m_pbClear->setIcon(QIcon::fromTheme("clear"));
    m_pbClear->setText(i18n("Clear"));

    KHistoryComboBox *combo = new KHistoryComboBox(this);
    combo->setDuplicatesEnabled(false);
    KConfigGroup kc = KSharedConfig::openConfig()->group("Open-repository settings");
    int max = kc.readEntry(QLatin1String("Maximum history"), 15);
    combo->setMaxCount(max);
    const QStringList list = kc.readEntry(QLatin1String("History"), QStringList());
    combo->setHistoryItems(list);
    combo->setMinimumWidth(100);
    combo->adjustSize();
    if (combo->width() > 300) {
        combo->resize(300, combo->height());
    }

    m_urlRequester = new KUrlRequester(combo, this);
    m_ui->topLayout->insertWidget(1, m_urlRequester);
    m_urlRequester->setFocus();
    m_urlRequester->setMode(KFile::ExistingOnly | KFile::Directory);
    connect(m_urlRequester->comboBox(), SIGNAL(currentTextChanged(QString)),
            this, SLOT(slotTextChanged(QString)));

    slotTextChanged(QString());
    m_urlRequester->adjustSize();

    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_pbClear, SIGNAL(clicked(bool)), m_urlRequester, SLOT(clear()));
}
AnnotationDialog::KDateEdit::KDateEdit( bool isStartEdit, QWidget *parent )
    : KComboBox( parent ),
      defaultValue( QDate::currentDate() ),
      mReadOnly(false),
      mDiscardNextMousePress(false),
      mIsStartEdit( isStartEdit )
{
    setEditable(true);
    setMaxCount(1);       // need at least one entry for popup to work
    value = defaultValue;
    QString today = QDate::currentDate().toString( QString::fromLatin1("dd. MMM yyyy") );
    addItem(QString::fromLatin1( "" ) );
    setCurrentIndex(0);
    setItemText( 0, QString::fromLatin1( "" ));
    setMinimumSize(sizeHint());

    mDateFrame = new QFrame;
    mDateFrame->setWindowFlags(Qt::Popup);
    QVBoxLayout* layout = new QVBoxLayout(mDateFrame);
    mDateFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    mDateFrame->setLineWidth(3);
    mDateFrame->hide();
    mDateFrame->installEventFilter(this);

    mDatePicker = new KDatePicker(value, mDateFrame);
    layout->addWidget(mDatePicker);

    connect(lineEdit(),SIGNAL(editingFinished()),SLOT(lineEnterPressed()));
    connect(this,SIGNAL(textChanged(QString)),
            SLOT(slotTextChanged(QString)));

    connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(dateEntered(QDate)));
    connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(dateSelected(QDate)));

    // Create the keyword list. This will be used to match against when the user
    // enters information.
    mKeywordMap[i18n("tomorrow")] = 1;
    mKeywordMap[i18n("today")] = 0;
    mKeywordMap[i18n("yesterday")] = -1;

    QString dayName;
    for (int i = 1; i <= 7; ++i)
    {
        dayName = KGlobal::locale()->calendar()->weekDayName(i).toLower();
        mKeywordMap[dayName] = i + 100;
    }
    lineEdit()->installEventFilter(this);   // handle keyword entry

    mTextChanged = false;
    mHandleInvalid = false;
}
KNoteHostDlg::KNoteHostDlg( const QString &caption, QWidget *parent )
  : KDialog( parent )
{
  setCaption( caption );
  setButtons( Ok|Cancel );
  KVBox *page = new KVBox( this );
  setMainWidget( page );
  ( void ) new QLabel( i18n("Select recipient:"), page );

  m_servicesView = new QTableView( page );
  m_servicesView->setShowGrid( false );
  DNSSD::ServiceModel* mdl = new DNSSD::ServiceModel( new DNSSD::ServiceBrowser( "_knotes._tcp", true ) );
  mdl->setParent( m_servicesView );
  m_servicesView->setModel( mdl );
  m_servicesView->setSelectionBehavior( QAbstractItemView::SelectRows );
  m_servicesView->hideColumn( DNSSD::ServiceModel::Port );
  connect( m_servicesView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
    SLOT(serviceSelected(QModelIndex)) );
  connect( m_servicesView, SIGNAL(activated(QModelIndex)),
    SLOT(serviceSelected(QModelIndex)) );
  connect( m_servicesView, SIGNAL(clicked(QModelIndex)),
    SLOT(serviceSelected(QModelIndex)) );

  ( void ) new QLabel( i18n("Hostname or IP address:"), page );

  m_hostCombo = new KHistoryComboBox( true, page );
  m_hostCombo->setMinimumWidth( fontMetrics().maxWidth() * 15 );
  m_hostCombo->setDuplicatesEnabled( false );

  // Read known hosts from configfile
  m_hostCombo->setHistoryItems( KNotesGlobalConfig::knownHosts(), true );
  m_hostCombo->setFocus();
  connect( m_hostCombo->lineEdit(), SIGNAL(textChanged(QString)),
           this, SLOT(slotTextChanged(QString)) );
  slotTextChanged( m_hostCombo->lineEdit()->text() );
}
Пример #25
0
void FormMultiWidget::addEditor(int idx)
{
    FormatTextEdit *editor = new FormatTextEdit(this);
    m_editors.insert(idx, editor);

    m_minusButtons.insert(idx, makeButton(m_minusIcon, SLOT(minusButtonClicked())));
    m_plusButtons.insert(idx + 1,
            new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), editor));

    connect(editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
    connect(editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
    connect(editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
    editor->installEventFilter(this);

    emit editorCreated(editor);
}
Пример #26
0
AdvancedRenameLineEdit::AdvancedRenameLineEdit(QWidget* parent)
    : QTextEdit(parent), d(new AdvancedRenameLineEditPriv)
{
    setLineWrapMode(QTextEdit::NoWrap);
    setWordWrapMode(QTextOption::NoWrap);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFrameStyle(QFrame::NoFrame);
    setPalette(kapp->palette());
    setFocusPolicy(Qt::StrongFocus);

    viewport()->setAutoFillBackground(false);
    setAutoFillBackground(false);

    QFontMetrics fm = fontMetrics();
    setFixedHeight(fm.height());

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

    d->parseTimer = new QTimer(this);
    d->parseTimer->setInterval(500);
    d->parseTimer->setSingleShot(true);

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

    // layout widget correctly by setting a dummy text and calling ensureCursorVisible().
    // Save the scrollbar position now, to avoid scrolling of the text when selecting with the mouse
    setPlainText("DUMMY TEXT");
    ensureCursorVisible();
    d->verticalSliderPosition = verticalScrollBar()->value();
    clear();

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

    connect(d->parseTimer, SIGNAL(timeout()),
            this, SLOT(slotParseTimer()));

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

    connect(this, SIGNAL(cursorPositionChanged()),
            this, SLOT(slotCursorPositionChanged()));
}
void SearchBar::toggleSearchFoward(bool value)
{
    Application* konvApp = Application::instance();
    if (value) {
      m_findNextButton->setIcon(m_goDownSearch);
      m_findPreviousButton->setIcon(m_goUpSearch);
      konvApp->getMainWindow()->actionCollection()->action(KStandardAction::name(KStandardAction::FindNext))->setIcon(m_goDownSearch);
      konvApp->getMainWindow()->actionCollection()->action(KStandardAction::name(KStandardAction::FindPrev))->setIcon(m_goUpSearch);
    }
    else
    {
      m_findNextButton->setIcon(m_goUpSearch);
      m_findPreviousButton->setIcon(m_goDownSearch);
      konvApp->getMainWindow()->actionCollection()->action(KStandardAction::name(KStandardAction::FindNext))->setIcon(m_goUpSearch);
      konvApp->getMainWindow()->actionCollection()->action(KStandardAction::name(KStandardAction::FindPrev))->setIcon(m_goDownSearch);
    }
    m_searchFoward = value;
    slotTextChanged();
}
Пример #28
0
KileAbbrevInputDialog::KileAbbrevInputDialog(KileAbbrevView *listview, KListViewItem *item, int mode, const char *name )
	: KDialogBase(listview,name, true, i18n("Add Abbreviation"), KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true),
	  m_listview(listview), m_abbrevItem(item), m_mode(mode)
{
	QWidget *page = new QWidget(this);
	setMainWidget(page);
	QVBoxLayout *vl = new QVBoxLayout(page, 0, spacingHint());

	if ( m_mode == KileAbbrevView::ALVedit )
	{
		setCaption( i18n("Edit Abbreviation") );
		m_abbrev = m_abbrevItem->text(KileAbbrevView::ALVabbrev);
		m_expansion = m_abbrevItem->text(KileAbbrevView::ALVexpansion);
	}
	
	QLabel *abbrev = new QLabel(i18n("&Abbreviation:"),page);
	QLabel *expansion = new QLabel(i18n("&Expanded Text:"),page);
	m_leAbbrev = new KLineEdit(m_abbrev,page);
	m_leExpansion = new KLineEdit(m_expansion,page);

	vl->addWidget(abbrev);
	vl->addWidget(m_leAbbrev);
	vl->addWidget(expansion);
	vl->addWidget(m_leExpansion);
	vl->addSpacing(8);

	abbrev->setBuddy(m_leAbbrev);
	expansion->setBuddy(m_leExpansion);

	QRegExp reg("[a-zA-Z0-9]+");
	QRegExpValidator *abbrevValidator = new QRegExpValidator(reg,this);
	m_leAbbrev->setValidator(abbrevValidator);

	connect(m_leAbbrev,SIGNAL(textChanged(const QString &)),
	        this,SLOT(slotTextChanged(const QString &)));
	connect(m_leExpansion,SIGNAL(textChanged(const QString &)),
	        this,SLOT(slotTextChanged(const QString &)));

	slotTextChanged(QString::null);
	m_leAbbrev->setFocus();
	page->setMinimumWidth(350);
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(text())
{
    // KDE has custom icons for this. Notice that icon namings are counter intuitive.
    // If these icons are not available we use the freedesktop standard name before
    // falling back to a bundled resource.
    QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
                     QLatin1String("edit-clear-locationbar-rtl") :
                     QLatin1String("edit-clear-locationbar-ltr"),
                     QIcon::fromTheme(QLatin1String("edit-clear"), QIcon(QLatin1String(":/core/images/editclear.png"))));

    setButtonPixmap(Right, icon.pixmap(16));
    setButtonVisible(Right, true);
    setPlaceholderText(tr("Filter"));
    setButtonToolTip(Right, tr("Clear text"));
    setAutoHideButton(Right, true);
    connect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
Пример #30
0
QG_CommandHistory::QG_CommandHistory(QWidget* parent) :
    QTextEdit(parent)
{
	setContextMenuPolicy(Qt::ActionsContextMenu);

	m_pCopy = new QAction(tr("&Copy"), this);
	connect(m_pCopy, SIGNAL(triggered()), this, SLOT(copy()));
	addAction(m_pCopy);
	m_pCopy->setVisible(false);
	//only show "copy" menu item when there's available selection to copy
	connect(this, SIGNAL(copyAvailable(bool)), m_pCopy, SLOT(setVisible(bool)));

	m_pSelectAll = new QAction(tr("select&All"), this);
	connect(m_pSelectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
	addAction(m_pSelectAll);

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

    setStyleSheet("selection-color: white; selection-background-color: green;");
}