ImageViewer::ImageViewer (const KUrl &url, const QString &capText, QWidget *parent) :
    KDialog( parent ),
    m_ImageUrl(url),
    fileIsImage(false),
    downloadJob(0)
{
    init(url.fileName(), capText);
    // Add save button
    setButtons( KDialog::User2 | KDialog::User1 | KDialog::Close );

    KGuiItem saveButton( i18n("Save"), "document-save", i18n("Save the image to disk") );
    setButtonGuiItem( KDialog::User1, saveButton );

    // FIXME: Add more options, and do this more nicely
    KGuiItem invertButton( i18n("Invert colors"), "", i18n("Reverse colors of the image. This is useful to enhance contrast at times. This affects only the display and not the saving.") );
    setButtonGuiItem( KDialog::User2, invertButton );

    connect( this, SIGNAL( user1Clicked() ), this, SLOT ( saveFileToDisc() ) );
    connect( this, SIGNAL( user2Clicked() ), this, SLOT ( invertColors() ) );
    // check URL
    if (!m_ImageUrl.isValid())
        kDebug() << "URL is malformed: " << m_ImageUrl;
    
    // FIXME: check the logic with temporary files. Races are possible
    {
        KTemporaryFile tempfile;
        tempfile.open();
        file.setFileName( tempfile.fileName() );
    }// we just need the name and delete the tempfile from disc; if we don't do it, a dialog will be show

    loadImageFromURL();
}
Ejemplo n.º 2
0
KateSaveModifiedDialog::KateSaveModifiedDialog(QWidget *parent, QList<KTextEditor::Document*> documents):
    KDialog( parent)
{

  setCaption( i18n("Save Documents") );
  setButtons( KDialog::User1 | KDialog::No | Cancel );
  setObjectName( "KateSaveModifiedDialog" );
  setModal( true );

  setButtonGuiItem(KDialog::User1, KStandardGuiItem::save());
  connect(this, SIGNAL(user1Clicked()), this, SLOT(slotSaveSelected()));

  setButtonGuiItem(KDialog::No, KStandardGuiItem::discard());
  connect(this, SIGNAL(noClicked()), this, SLOT(slotDoNotSave()));

  setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel());
  setDefaultButton(KDialog::Cancel);
  setButtonFocus(KDialog::Cancel);

  KVBox *box = new KVBox(this);
  setMainWidget(box);
  new QLabel(i18n("<qt>The following documents have been modified. Do you want to save them before closing?</qt>"), box);
  m_list = new QTreeWidget(box);
  m_list->setColumnCount(2);
  m_list->setHeaderLabels(QStringList() << i18n("Documents") << i18n("Location"));
  m_list->setRootIsDecorated(true);

  foreach (KTextEditor::Document* doc, documents) {
    m_list->addTopLevelItem(new KateSaveModifiedDocumentCheckListItem(doc));
  }
Ejemplo n.º 3
0
EditNotifyDialog::EditNotifyDialog(QWidget* parent,
int serverGroupId,
const QString& nickname):
    KDialog(parent)

{
    setCaption( i18n("Edit Watched Nickname") );
    setModal( true );
    setButtons( KDialog::Ok | KDialog::Cancel );
    setDefaultButton( KDialog::Ok );
    QWidget* page = mainWidget();

    QGridLayout* layout = new QGridLayout(page);

    QLabel* networkNameLabel=new QLabel(i18n("&Network name:"), page);
    QString networkNameWT = i18n(
        "Pick the server network you will connect to here.");
    networkNameLabel->setWhatsThis(networkNameWT);
    networkNameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_networkNameCombo=new KComboBox(page);
    m_networkNameCombo->setWhatsThis(networkNameWT);
    networkNameLabel->setBuddy(m_networkNameCombo);

    QLabel* nicknameLabel=new QLabel(i18n("N&ickname:"), page);
    QString nicknameWT = i18n(
        "<qt>The nickname to watch for when connected to a server in the network.</qt>");
    nicknameLabel->setWhatsThis(nicknameWT);
    nicknameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_nicknameInput = new KLineEdit(nickname, page);
    m_nicknameInput->setWhatsThis(nicknameWT);
    nicknameLabel->setBuddy(m_nicknameInput);

    // Add network names to network combobox and select the one corresponding to argument.
    m_networkNameCombo->addItem(i18n("All Networks"), -1);
    QList<Server *> serverList = Application::instance()->getConnectionManager()->getServerList();
    for (int i = 0; i < serverList.count(); ++i)
    {
      Server *server = serverList.at(i);
      if (server->getServerGroup())
        m_networkNameCombo->addItem(server->getServerGroup()->name(), server->getServerGroup()->id());
    }
    m_networkNameCombo->setCurrentIndex(m_networkNameCombo->findData(serverGroupId, Qt::UserRole));
    layout->addWidget(networkNameLabel, 0, 0);
    layout->addWidget(m_networkNameCombo, 0, 1);
    layout->addWidget(nicknameLabel, 1, 0);
    layout->addWidget(m_nicknameInput, 1, 1);

    setButtonGuiItem( KDialog::Ok, KGuiItem(i18n("&OK"),"dialog-ok",i18n("Change notify information")));
    setButtonGuiItem( KDialog::Cancel, KGuiItem(i18n("&Cancel"),"dialog-cancel",i18n("Discards all changes made")));
    connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );

    m_nicknameInput->setFocus();
}
Ejemplo n.º 4
0
    ServerGroupDialog::ServerGroupDialog(const QString& title, QWidget *parent)
        : KDialog(parent)
    {
        setCaption(title);
        setButtons(Ok|Cancel);

        m_id = -1;
        m_identitiesNeedsUpdate = false;
        m_editedServer = false;

        m_mainWidget = new Ui::ServerGroupDialogUI();
        m_mainWidget->setupUi(mainWidget());
        mainWidget()->layout()->setMargin(0);
        m_mainWidget->serverWidget->layout()->setMargin(0);
        m_mainWidget->channelWidget->layout()->setMargin(0);

        connect(m_mainWidget->m_editIdentityButton, SIGNAL(clicked()), this, SLOT(editIdentity()));

        IdentityList identities = Preferences::identityList();

        for (IdentityList::ConstIterator it = identities.constBegin(); it != identities.constEnd(); ++it)
            m_mainWidget->m_identityCBox->addItem((*it)->getName());

        m_mainWidget->m_removeServerButton->setIcon(KIcon("list-remove"));
        m_mainWidget->m_upServerBtn->setIcon(KIcon("arrow-up"));
        m_mainWidget->m_downServerBtn->setIcon(KIcon("arrow-down"));

        connect(m_mainWidget->m_addServerButton, SIGNAL(clicked()), this, SLOT(addServer()));
        connect(m_mainWidget->m_changeServerButton, SIGNAL(clicked()), this, SLOT(editServer()));
        connect(m_mainWidget->m_removeServerButton, SIGNAL(clicked()), this, SLOT(deleteServer()));
        connect(m_mainWidget->m_serverLBox, SIGNAL(itemSelectionChanged()), this, SLOT(updateServerArrows()));
        connect(m_mainWidget->m_upServerBtn, SIGNAL(clicked()), this, SLOT(moveServerUp()));
        connect(m_mainWidget->m_downServerBtn, SIGNAL(clicked()), this, SLOT(moveServerDown()));

        m_mainWidget->m_removeChannelButton->setIcon(KIcon("list-remove"));
        m_mainWidget->m_upChannelBtn->setIcon(KIcon("arrow-up"));
        m_mainWidget->m_downChannelBtn->setIcon(KIcon("arrow-down"));

        connect(m_mainWidget->m_addChannelButton, SIGNAL(clicked()), this, SLOT(addChannel()));
        connect(m_mainWidget->m_changeChannelButton, SIGNAL(clicked()), this, SLOT(editChannel()));
        connect(m_mainWidget->m_removeChannelButton, SIGNAL(clicked()), this, SLOT(deleteChannel()));
        connect(m_mainWidget->m_channelLBox, SIGNAL(itemSelectionChanged()), this, SLOT(updateChannelArrows()));
        connect(m_mainWidget->m_upChannelBtn, SIGNAL(clicked()), this, SLOT(moveChannelUp()));
        connect(m_mainWidget->m_downChannelBtn, SIGNAL(clicked()), this, SLOT(moveChannelDown()));

        setButtonGuiItem(Ok, KGuiItem(i18n("&OK"), "dialog-ok", i18n("Change network information")));
        setButtonGuiItem(Cancel, KGuiItem(i18n("&Cancel"), "dialog-cancel", i18n("Discards all changes made")));

        m_mainWidget->m_nameEdit->setFocus();

        setInitialSize(QSize(320, 400));
    }
Ejemplo n.º 5
0
ExportDialog::ExportDialog(QWidget * parent)
        : KDialog(parent),m_outputStream(0)
{
    kDebug() << "ExportDialog::ExportDialog";
    setButtons(Help | User1 | Cancel);
    kDebug() << "ExportDialog: setButtons";
    ui.setupUi(mainWidget());
    kDebug() << "ExportDialog: ui.setupUi(mainWidget());";
    setButtonGuiItem(User1, KGuiItem(i18n("OK")));
    kDebug() << "ExportDialog: setButtonGuiItem(User1, KGuiItem(i18n(\"OK\")));";
    ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    setCaption(i18n("Export Chemical Data"));
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    populateElementList();
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    ui.formatList->addItem(".html (formatted html document)", "html");
    ui.formatList->addItem(".xml (raw element data)", "xml");
    ui.formatList->addItem(".csv (comma-separated data)", "csv");
    kDebug() << "ui.formatList->addItem(...);";

    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));
    kDebug() << "connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));";
    setHelp(QString(),"kalzium");
    kDebug() << "setHelp(QString(),\"kalzium\");";
}
Ejemplo n.º 6
0
void DeleteDialog::slotShouldDelete(bool shouldDelete)
{
    // This is called once from constructor, and then when the user changed the checkbox state.
    // In that case, save the user's preference.
    m_saveShouldDeleteUserPreference = true;
    setButtonGuiItem(User1, shouldDelete ? KStandardGuiItem::del() : m_trashGuiItem);
}
void KexiDBConnectionDialog::init(const KGuiItem& acceptButtonGuiItem)
{
    setObjectName("KexiDBConnectionDialog");
    setButtons(KDialog::User1 | KDialog::Cancel | KDialog::Help);
    setButtonGuiItem(KDialog::User1,
                     acceptButtonGuiItem.text().isEmpty()
                     ? KGuiItem(i18n("&Open"), "document-open", i18n("Open Database Connection"))
                     : acceptButtonGuiItem
                    );
    setModal(true);

    setMainWidget(m_tabWidget);
    connect(this, SIGNAL(user1Clicked()), this, SLOT(accept()));
    connect(m_tabWidget->mainWidget, SIGNAL(saveChanges()), this, SIGNAL(saveChanges()));
    connect(m_tabWidget, SIGNAL(testConnection()), this, SIGNAL(testConnection()));

    adjustSize();
    resize(width(), m_tabWidget->height());
    if (m_tabWidget->mainWidget->connectionOnly())
        m_tabWidget->mainWidget->driversCombo()->setFocus();
    else if (m_tabWidget->mainWidget->nameCombo->currentText().isEmpty())
        m_tabWidget->mainWidget->nameCombo->setFocus();
    else if (m_tabWidget->mainWidget->userEdit->text().isEmpty())
        m_tabWidget->mainWidget->userEdit->setFocus();
    else if (m_tabWidget->mainWidget->passwordEdit->text().isEmpty())
        m_tabWidget->mainWidget->passwordEdit->setFocus();
    else //back
        m_tabWidget->mainWidget->nameCombo->setFocus();
}
Ejemplo n.º 8
0
TrackOrganiser::TrackOrganiser(QWidget *parent)
    : SongDialog(parent, "TrackOrganiser",  QSize(800, 500))
    , schemeDlg(0)
    , autoSkip(false)
    , paused(false)
    , updated(false)
    , alwaysUpdate(false)
{
    iCount++;
    setButtons(Ok|Cancel);
    setCaption(i18n("Organize Files"));
    setAttribute(Qt::WA_DeleteOnClose);
    QWidget *mainWidet = new QWidget(this);
    setupUi(mainWidet);
    setMainWidget(mainWidet);
    configFilename->setIcon(Icons::self()->configureIcon);
    setButtonGuiItem(Ok, GuiItem(i18n("Rename"), "edit-rename"));
    connect(this, SIGNAL(update()), MPDConnection::self(), SLOT(update()));
    progress->setVisible(false);
    files->setItemDelegate(new BasicItemDelegate(files));
    files->setAlternatingRowColors(false);
    files->setContextMenuPolicy(Qt::ActionsContextMenu);
    files->setSelectionMode(QAbstractItemView::ExtendedSelection);
    removeAct=new Action(i18n("Remove From List"), files);
    removeAct->setEnabled(false);
    files->addAction(removeAct);
    connect(files, SIGNAL(itemSelectionChanged()), SLOT(controlRemoveAct()));
    connect(removeAct, SIGNAL(triggered()), SLOT(removeItems()));
}
Ejemplo n.º 9
0
KHLogin::KHLogin(QWidget *parent ) : KDialogBase(parent, "KHLogin", true, i18n("Log in"), User1 |KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true)
{
    QVBox *page = makeVBoxMainWidget();
    page->setMargin(5);
    page->setLineWidth(4);
    page->setMidLineWidth(4);
    page->setFrameStyle (QFrame::Box | QFrame::Raised );

    QVGroupBox *m_container = new QVGroupBox(i18n("Select your player"),page);

    m_selector = new KHSelectUser(m_container);
    m_selector->readPlayers(true);
    connect(m_selector, SIGNAL(playerSelected()), this, SLOT(setPlayerInformation()));

    QVBox *m_infoBox = new QVBox(m_container);

    m_labelName = new QLabel(i18n("Name: "), m_container);
    m_labelElo = new QLabel(i18n("Elo: "), m_container);
    m_labelType = new QLabel(i18n("Type: "), m_container);

    new KSeparator(m_container);

    new QLabel(i18n("Login"), m_container);
    m_login = new KLineEdit(m_container);
    new QLabel(i18n("Password"), m_container);
    m_password = new KLineEdit(m_container);

    setModal(true);

    setButtonGuiItem (KDialogBase::User1, KGuiItem( i18n("Create a new user"), SmallIcon("penguin"), i18n("Click to create new user"), i18n("Clicking this button you can create a new user") ));

    hide();
}
Ejemplo n.º 10
0
KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent,
                 const char *name, bool modal,
                 const QString &caption,
                 int buttonMask, ButtonCode defaultButton,
                 bool separator,
                 const KGuiItem &user1,
                 const KGuiItem &user2,
                 const KGuiItem &user3 )
    : KDialog( parent )
{
    setObjectName( name );
    setModal( modal );
    setCaption( caption );
    setButtons( (ButtonCodes)buttonMask );
    setDefaultButton( defaultButton );
    showButtonSeparator( separator );
    setButtonGuiItem( User1, user1 );
    setButtonGuiItem( User2, user2 );
    setButtonGuiItem( User3, user3 );

    totalTimer = new QTimer( this );
    totalTimer->setSingleShot( true );
    updateTimer = new QTimer( this );
    updateTimer->setSingleShot( false );
    msecTotal = msecRemaining = msec;
    updateInterval = 1000;
    tStyle = style;
	KWindowSystem::setIcons( winId(), DesktopIcon("randr"), SmallIcon("randr") );
    // default to canceling the dialog on timeout
    if ( buttonMask & Cancel )
        buttonOnTimeout = Cancel;

    connect( totalTimer, SIGNAL( timeout() ), SLOT( slotInternalTimeout() ) );
    connect( updateTimer, SIGNAL( timeout() ), SLOT( slotUpdateTime() ) );

    // create the widgets
    mainWidget = new KVBox( this );
    timerWidget = new KHBox( mainWidget );
    timerLabel = new QLabel( timerWidget );
    timerProgress = new QProgressBar( timerWidget );
    timerProgress->setRange( 0, msecTotal );
    timerProgress->setTextVisible( false );

    KDialog::setMainWidget( mainWidget );

    slotUpdateTime( false );
}
KOEventViewerDialog::KOEventViewerDialog( CalendarSupport::Calendar *calendar, QWidget *parent )
  : KDialog( parent )
{
  setCaption( i18n( "Event Viewer" ) );
  setButtons( Close | User1 | User2 );
  setModal( false );
  setButtonGuiItem( User1, KGuiItem( i18n( "Edit..." ), KIcon( "document-edit" ) ) );
  setButtonGuiItem( User2, KGuiItem( i18n( "Show in Context" ) ) );
  mEventViewer = new CalendarSupport::IncidenceViewer( calendar, this );
  setMainWidget( mEventViewer );

  resize( QSize( 500, 520 ).expandedTo( minimumSizeHint() ) );

  connect( this, SIGNAL(finished()), this, SLOT(delayedDestruct()) );
  connect( this, SIGNAL(user1Clicked()), this, SLOT(editIncidence()) );
  connect( this, SIGNAL(user2Clicked()), this, SLOT(showIncidenceContext()) );
}
Ejemplo n.º 12
0
IppReportDlg::IppReportDlg(TQWidget *parent, const char *name)
: KDialogBase(parent, name, true, i18n("IPP Report"), Close|User1, Close, false, KGuiItem(i18n("&Print"), "fileprint"))
{
	m_edit = new KTextEdit(this);
	m_edit->setReadOnly(true);
	setMainWidget(m_edit);
	resize(540, 500);
	setFocusProxy(m_edit);
	setButtonGuiItem(User1, KGuiItem(i18n("&Print"),"fileprint"));
}
Ejemplo n.º 13
0
void RemoveRedEyesWindow::setBusy(bool busy)
{
    d->busy = busy;

    if (busy)
    {
        // disable connection to make sure that the "test run" and "correct photos"
        // buttons are not enabled again on ImageListChange
        disconnect(d->imageList, SIGNAL(signalImageListChanged()),
                   this, SLOT(imageListChanged()));

        disconnect(this, SIGNAL(myCloseClicked()),
                   this, SLOT(closeClicked()));

        setButtonGuiItem(Close, KStandardGuiItem::cancel());
        enableButton(User1, false); // correction button
        enableButton(User2, false); // testrun button

        connect(this, SIGNAL(myCloseClicked()),
                this, SLOT(cancelCorrection()));

        d->settingsTab->setEnabled(false);
    }
    else
    {
        // enable connection again to make sure that an empty image list will
        // disable the "test run" and "correct photos" buttons
        connect(d->imageList, SIGNAL(signalImageListChanged()),
                this, SLOT(imageListChanged()));

        disconnect(this, SIGNAL(myCloseClicked()),
                   this, SLOT(cancelCorrection()));

        setButtonGuiItem(Close, KStandardGuiItem::close());
        enableButton(User1, true);  // correction button
        enableButton(User2, true);  // testrun button

        connect(this, SIGNAL(myCloseClicked()),
                this, SLOT(closeClicked()));

        d->settingsTab->setEnabled(true);
    }
}
Ejemplo n.º 14
0
KonqProfileDlg::KonqProfileDlg( KonqViewManager *manager, const QString & preselectProfile, QWidget *parent )
: KDialog( parent )
, d( new KonqProfileDlgPrivate( manager, this ) )
{
  d->layout()->setMargin( 0 );
  setMainWidget( d );

  setObjectName( QLatin1String( "konq_profile_dialog" ) );
  setModal( true );
  setCaption( i18nc( "@title:window", "Profile Management" ) );
  setButtons( Close | BTN_RENAME | BTN_DELETE | BTN_SAVE );
  setDefaultButton( BTN_SAVE );
  setButtonGuiItem( BTN_RENAME, KGuiItem( i18n( "&Rename Profile" ) ) );
  setButtonGuiItem( BTN_DELETE, KGuiItem( i18n( "&Delete Profile" ), "edit-delete" ) );
  setButtonGuiItem( BTN_SAVE, KStandardGuiItem::save() );

  d->m_pProfileNameLineEdit->setFocus();

  connect( d->m_pListView, SIGNAL(itemChanged(QListWidgetItem*)),
            SLOT(slotItemRenamed(QListWidgetItem*)) );

  loadAllProfiles( preselectProfile );
  d->m_pListView->setMinimumSize( d->m_pListView->sizeHint() );

  d->m_cbSaveURLs->setChecked( KonqSettings::saveURLInProfile() );

  connect( d->m_pListView, SIGNAL(itemSelectionChanged()),
           this, SLOT(slotSelectionChanged()) );

  connect( d->m_pProfileNameLineEdit, SIGNAL(textChanged(QString)),
           this, SLOT(slotTextChanged(QString)) );

  enableButton( BTN_RENAME, d->m_pListView->currentItem() != 0 );
  enableButton( BTN_DELETE, d->m_pListView->currentItem() != 0 );

  connect( this,SIGNAL(user1Clicked()),SLOT(slotRenameProfile()));
  connect( this,SIGNAL(user2Clicked()),SLOT(slotDeleteProfile()));
  connect( this,SIGNAL(user3Clicked()),SLOT(slotSave()));

  resize( sizeHint() );
}
Ejemplo n.º 15
0
void FingerPrintsGenerator::complete()
{
    QTime t;
    t = t.addMSecs(d->duration.elapsed());
    setLabel(i18n("<b>Update of fingerprint database complete.</b>"));
    setTitle(i18n("Duration: %1", t.toString()));
    setButtonGuiItem(KStandardGuiItem::ok());
    setButtonText(i18n("&Close"));
    // Pop-up a message to bring user when all is done.
    KNotificationWrapper("fingerprintscompleted", i18n("Update of fingerprint database complete."),
                         this, windowTitle());
    emit signalRebuildAllFingerPrintsDone();
}
YahooUserInfoDialog::YahooUserInfoDialog( YahooContact *c, QWidget * parent )
: KPageDialog( parent ), m_contact(c)
{
	setFaceType( KPageDialog::List );
	setCaption( i18n( "Yahoo User Information" ) );
	setButtons( KDialog::User2 | KDialog::User1 | KDialog::Cancel );
	setDefaultButton( KDialog::Cancel );
	setButtonGuiItem( KDialog::User1, KGuiItem( i18n("Save and Close") ) );
	setButtonGuiItem( KDialog::User2, KGuiItem( i18n("Merge with existing entry") ) );
	showButton( KDialog::User2, false );

	kDebug(14180) << "Creating new yahoo user info widget";
	
	QWidget *genInfo = new QWidget(this);
	m_genInfoWidget = new Ui::YahooGeneralInfoWidget;
	m_genInfoWidget->setupUi( genInfo );
	KPageWidgetItem *genInfoItem = addPage( genInfo, i18n("General Info") );
	genInfoItem->setHeader(  i18n( "General Yahoo Information" ) );
	genInfoItem->setIcon( KIcon("user-identity") );
	
	QWidget *workInfo = new QWidget(this);
	m_workInfoWidget = new Ui::YahooWorkInfoWidget;
	m_workInfoWidget->setupUi( workInfo );
	KPageWidgetItem *workInfoItem = addPage( workInfo, i18n("Work Info") );
	workInfoItem->setHeader( i18n( "Work Information" ) );
	workInfoItem->setIcon( KIcon("mail-attachment") );
	
	QWidget *otherInfo = new QWidget(this);
	m_otherInfoWidget = new Ui::YahooOtherInfoWidget;
	m_otherInfoWidget->setupUi( otherInfo );
	KPageWidgetItem *otherInfoItem = addPage( otherInfo, i18n("Other Info") );
	otherInfoItem->setHeader( i18n( "Other Yahoo Information" ) );
	otherInfoItem->setIcon( KIcon("document-properties") );
	
	QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotSaveAndCloseClicked()));
	QObject::connect(this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()));
}
Ejemplo n.º 17
0
void BatchFaceDetector::complete()
{
    QTime t;
    t = t.addMSecs(d->duration.elapsed());
    setLabel(i18n("<b>Scanning for people completed.</b>"));
    setTitle(i18n("Duration: %1", t.toString()));
    // set value to be sure in case of scanning for tags and total was too large
    setValue(d->total);
    setButtonGuiItem(KStandardGuiItem::ok());
    setButtonText(i18n("&Close"));
    // Pop-up a message to bring user when all is done.
    KNotificationWrapper("batchfacedetectioncompleted", i18n("The face detected database has been updated."),
                         this, windowTitle());
    emit signalDetectAllFacesDone();
}
Ejemplo n.º 18
0
ExportDialog::ExportDialog( const QString& remoteTypeName,
                            AbstractModelExporterConfigEditor* configEditor,
                            QWidget* parent )
  : KDialog( parent ),
    mConfigEditor( configEditor )
{
    setCaption( i18nc("@title:window","Export") );
    setButtons( Ok | Cancel );
    setButtonGuiItem( Ok, KGuiItem(i18nc("@action:button","&Export to File..."), QLatin1String("document-export"),
                      i18nc("@info:tooltip","Export the selected data to a file."),
                      i18nc("@info:whatsthis","If you press the <interface>Export to file</interface> "
                            "button, the selected data will be copied to a file "
                            "with the settings you entered above.")) );
    setDefaultButton( Ok );

    QSplitter* splitter = new QSplitter( this );

    setMainWidget( splitter );

    // config editor
    QWidget* editorPage = new QWidget( splitter );
    QVBoxLayout* editorPageLayout = new QVBoxLayout( editorPage );
    QLabel* editorLabel = new QLabel( remoteTypeName );
    QFont font = editorLabel->font();
    font.setBold( true );
    editorLabel->setFont( font );
    editorPageLayout->addWidget( editorLabel );
    editorPageLayout->addWidget( mConfigEditor );
    editorPageLayout->addStretch();

    splitter->addWidget( editorPage );
    splitter->setCollapsible( 0, false );

    mPreviewView = configEditor->createPreviewView();

    if( mPreviewView )
    {
        QGroupBox* previewBox = new QGroupBox( i18nc("@title:group","Preview"), this );
        splitter->addWidget( previewBox );

        QHBoxLayout* previewBoxLayout = new QHBoxLayout( previewBox );

        previewBoxLayout->addWidget( mPreviewView->widget() );
    }

    enableButtonOk( configEditor->isValid() );
    connect( configEditor, SIGNAL(validityChanged(bool)), SLOT(enableButtonOk(bool)) );
}
Ejemplo n.º 19
0
KonqSessionDlg::KonqSessionDlg( KonqViewManager *manager, QWidget *parent )
    : KDialog( parent )
    , d( new KonqSessionDlgPrivate( manager, this ) )
{
    d->layout()->setMargin( 0 );
    setMainWidget( d );
    
    setObjectName( QLatin1String( "konq_session_dialog" ) );
    setModal( true );
    setCaption( i18nc( "@title:window", "Manage Sessions" ) );
    setButtons( BTN_OPEN | Close );
    setDefaultButton( Close );
    
    setButtonGuiItem( BTN_OPEN, KGuiItem( i18n( "&Open" ), "document-open" ) );
    d->m_pSaveCurrentButton->setIcon(KIcon("document-save"));
    d->m_pRenameButton->setIcon(KIcon("edit-rename"));
    d->m_pDeleteButton->setIcon(KIcon("edit-delete"));
    d->m_pNewButton->setIcon(KIcon("document-new"));
    
    QString dir = KStandardDirs::locateLocal("appdata", "sessions/");
    
    d->m_pModel = new KDirModel(d->m_pListView);
    d->m_pModel->sort(QDir::Name);
    d->m_pModel->dirLister()->setDirOnlyMode(true);
    d->m_pModel->dirLister()->openUrl(dir);
    d->m_pListView->setModel(d->m_pModel);
    
    d->m_pListView->setMinimumSize( d->m_pListView->sizeHint() );
    
    connect( d->m_pListView->selectionModel(), SIGNAL( selectionChanged(
        const QItemSelection  &, const QItemSelection &) ), this, SLOT(
        slotSelectionChanged() ) );
    
    enableButton( BTN_OPEN, d->m_pListView->currentIndex().isValid() );
    slotSelectionChanged();

    d->m_pOpenTabsInsideCurrentWindow->setChecked(
	KonqSettings::openTabsInsideCurrentWindow());

    connect( this,SIGNAL(user1Clicked()),SLOT(slotOpen()));
    connect( d->m_pNewButton, SIGNAL(clicked()),SLOT(slotNew()));
    connect( d->m_pSaveCurrentButton, SIGNAL(clicked()),SLOT(slotSave()));
    connect( d->m_pRenameButton, SIGNAL(clicked()),SLOT(slotRename()));
    connect( d->m_pDeleteButton, SIGNAL(clicked()),SLOT(slotDelete()));
    
    resize( sizeHint() );
}
Ejemplo n.º 20
0
/*
 *  Constructs a fontProgressDialog which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 */
fontProgressDialog::fontProgressDialog(const QString& helpIndex, const QString& label, const QString& abortTip, const QString& whatsThis, const QString& ttip, QWidget* parent, bool progressbar)
  : KDialog( parent),
    TextLabel2(0),
    TextLabel1(0),
    ProgressBar1(0),
    progress(0),
    process(0)
{
  setCaption( i18n( "Font Generation Progress Dialog" ) );
  setModal( true );
  setButtons( Cancel );
  setDefaultButton( Cancel );
  setCursor(QCursor(Qt::WaitCursor));

  setButtonGuiItem(Cancel, KGuiItem(i18n("Abort"), "process-stop", abortTip));

  if (helpIndex.isEmpty() == false) {
    setHelp(helpIndex, "okular");
    setHelpLinkText( i18n( "What is happening here?") );
    enableLinkedHelp(true);
  } else
    enableLinkedHelp(false);

  KVBox* page = new KVBox( this );
  setMainWidget( page );

  TextLabel1   = new QLabel(label, page);
  TextLabel1->setAlignment(Qt::AlignCenter);
  TextLabel1->setWhatsThis( whatsThis );
  TextLabel1->setToolTip( ttip );

  if (progressbar) {
    ProgressBar1 = new QProgressBar( page );
    ProgressBar1->setFormat(i18n("%v of %m"));
    ProgressBar1->setWhatsThis( whatsThis );
    ProgressBar1->setToolTip( ttip );
  } else
    ProgressBar1 = NULL;

  TextLabel2   = new QLabel("", page);
  TextLabel2->setAlignment(Qt::AlignCenter);
  TextLabel2->setWhatsThis( whatsThis );
  TextLabel2->setToolTip( ttip );

  qApp->connect(this, SIGNAL(finished()), this, SLOT(killProcess()));
}
Ejemplo n.º 21
0
SloxFolderDialog::SloxFolderDialog( SloxFolderManager *manager, FolderType type, QWidget *parent ) :
  KDialog( parent),
  mManager( manager ),
  mFolderType( type )
{
  setCaption( i18n("Select Folder") );
  setButtons( Ok|Cancel|User1 );
  setDefaultButton( Ok );
  setButtonGuiItem( User1, KGuiItem( i18n("Reload"), "view-refresh" ) );
  mListView = new K3ListView( this );
  mListView->setRootIsDecorated( true );
  mListView->setShowSortIndicator( true );
  mListView->addColumn( i18n("Folder") );
  mListView->addColumn( i18n("Folder ID"), 0 );
  setMainWidget( mListView );
  updateFolderView();
  connect( manager, SIGNAL( foldersUpdated() ), SLOT( updateFolderView() ) );
  connect(this,SIGNAL(user1Clicked()),this,SLOT(slotUser1( )));
}
Ejemplo n.º 22
0
KIGPDialog::KIGPDialog(QWidget *parent, const QString& path )
    : KPageDialog( parent)
{
    setCaption(i18nc("@title:window", "Configure"));
    setButtons(Default|Ok|Cancel);
    setDefaultButton(Ok);
    setModal(true);
    showButtonSeparator(true);
    setFaceType(List);

    m_path = path;
    setCaption(i18nc("@title:window", "Create Image Gallery"));
    setButtonGuiItem( KDialog::Ok, KGuiItem(i18n("Create"),"imagegallery") );
    m_config = new KConfig("kimgallerypluginrc", KConfig::NoGlobals);
    setupLookPage(path);
    setupDirectoryPage(path);
    setupThumbnailPage(path);
    connect(this,SIGNAL(defaultClicked()),this,SLOT(slotDefault()));
}
Ejemplo n.º 23
0
CalDialog::CalDialog(QWidget *parent, JoyDevice *joy)
  : KDialog( parent ),
    joydev(joy)
{
  setObjectName( "calibrateDialog" );
  setModal( true );
  setCaption( i18n("Calibration") );
  setButtons( Cancel | User1 );
  setDefaultButton( User1 );
  setButtonGuiItem( User1, KGuiItem( i18n("Next") ) );
  showButtonSeparator( true );

  KVBox *main = new KVBox( this );
  setMainWidget( main );

  text = new QLabel(main);
  text->setMinimumHeight(200);
  valueLbl = new QLabel(main);
  connect(this,SIGNAL(user1Clicked()),this,SLOT(slotUser1()));
}
Ejemplo n.º 24
0
KReplaceDialog::KReplaceDialog( ReplaceTool* tool, QWidget* parent )
  : KAbstractFindDialog( parent ),
    mTool( tool )
{
    setCaption( i18nc("@title:window","Replace Bytes") );
    setButtonGuiItem( Ok, KGuiItem( i18nc("@action;button", "&Replace"),
                      QLatin1String("edit-find-replace"),
                      i18nc("@info:tooltip","Start replace"),
                      i18nc("@info:whatsthis",
                            "If you press the <interface>Replace</interface> button, "
                            "the bytes you entered above are searched for within "
                            "the byte array and any occurrence is replaced with "
                            "the replacement bytes.")) );

    setupFindBox();

    // replace term
    QGroupBox *ReplaceBox = new QGroupBox( i18nc("@title:group","Replace With"), mainWidget() );

    QVBoxLayout *ReplaceBoxLayout = new QVBoxLayout;

    ReplaceDataEdit = new Okteta::ByteArrayComboBox( ReplaceBox );
    const QString toolTip =
        i18nc("@info:tooltip",
              "Enter the bytes to replace with, or select bytes previously replaced with from the list.");
    ReplaceDataEdit->setToolTip( toolTip );

    ReplaceBoxLayout->addWidget( ReplaceDataEdit );

    ReplaceBox->setLayout( ReplaceBoxLayout );
    setupOperationBox( ReplaceBox );

    //
    PromptCheckBox = new QCheckBox( i18nc("@option:check","&Prompt on replace") );
    PromptCheckBox->setWhatsThis( i18nc("@info:whatsthis","Ask before replacing each match found.") );

    setupCheckBoxes( PromptCheckBox );

    enableButtonOk( false );
    setModal( true );
}
Ejemplo n.º 25
0
void MirrorAddDlg::init()
{
    setCaption(i18n("Add mirror"));
    QWidget *widget = new QWidget(this);
    ui.setupUi(widget);
    setMainWidget(widget);

    if (m_countryModel)
    {
        ui.location->setModel(m_countryModel);
        ui.location->setCurrentIndex(-1);
    }

    setButtons(KDialog::Yes | KDialog::Cancel);
    setButtonGuiItem(KDialog::Yes, KStandardGuiItem::add());

    updateButton();

    connect(ui.url, SIGNAL(textChanged(QString)), this, SLOT(updateButton(QString)));
    connect(this, SIGNAL(yesClicked()), this, SLOT(addMirror()));
}
void ImageViewer::init(QString caption, QString capText) {
    setAttribute( Qt::WA_DeleteOnClose, true );
    setModal( false );
    setCaption( i18n( "KStars image viewer" ) + QString( " : " ) + caption );
    setButtons( KDialog::Close | KDialog::User1);

    // FIXME: Add more options, and do this more nicely
    KGuiItem invertButton( i18n("Invert colors"), "", i18n("Reverse colors of the image. This is useful to enhance contrast at times. This affects only the display and not the saving.") );
    setButtonGuiItem( KDialog::User1, invertButton );
    connect( this, SIGNAL( user1Clicked() ), this, SLOT ( invertColors() ) );


    // Create widget
    QFrame* page = new QFrame( this );
    setMainWidget( page );
    m_View = new ImageLabel( page );
    m_View->setAutoFillBackground( true );
    m_Caption = new QLabel( page );
    m_Caption->setAutoFillBackground( true );
    m_Caption->setFrameShape( QFrame::StyledPanel );
    m_Caption->setText( capText );
    // Add layout
    QVBoxLayout* vlay = new QVBoxLayout( page );
    vlay->setSpacing( 0 );
    vlay->setMargin( 0 );
    vlay->addWidget( m_View );
    vlay->addWidget( m_Caption );

    //Reverse colors
    QPalette p = palette();
    p.setColor( QPalette::Window, palette().color( QPalette::WindowText ) );
    p.setColor( QPalette::WindowText, palette().color( QPalette::Window ) );
    m_Caption->setPalette( p );
    m_View->setPalette( p );
    
    //If the caption is wider than the image, try to shrink the font a bit
    QFont capFont = m_Caption->font();
    capFont.setPointSize( capFont.pointSize() - 2 );
    m_Caption->setFont( capFont );
}
Ejemplo n.º 27
0
RenameFavoriteDialog::RenameFavoriteDialog(const QString& caption, const QString& text, const QString& value, const QString& defaultName, QWidget *parent )
  :KDialog( parent ),
   m_defaultName( defaultName )
{
  setCaption(caption);
  setButtons(Ok | Cancel | User1);
  setButtonGuiItem(User1, KGuiItem(i18n("Default Name")));
  setDefaultButton(Ok);
  setModal(true);

  QWidget *frame = new QWidget(this);
  QVBoxLayout *layout = new QVBoxLayout(frame);
  layout->setMargin(0);

  m_label = new QLabel(text, frame);
  m_label->setWordWrap(true);
  layout->addWidget(m_label);

  m_lineEdit = new KLineEdit(value, frame);
  m_lineEdit->setClearButtonShown(true);
  layout->addWidget(m_lineEdit);

  m_lineEdit->setFocus();
  m_label->setBuddy(m_lineEdit);

  layout->addStretch();

  connect(m_lineEdit, SIGNAL(textChanged(QString)),
          SLOT(slotEditTextChanged(QString)));
  connect(this, SIGNAL(user1Clicked()), this, SLOT(slotDefaultName()));


  setMainWidget(frame);
  slotEditTextChanged(value);
  setMinimumWidth(350);

}
Ejemplo n.º 28
0
///////////////////////////////////////////////////////////////////////////
// KateMailDialog implementation
///////////////////////////////////////////////////////////////////////////
KateMailDialog::KateMailDialog( TQWidget *parent, KateMainWindow  *mainwin )
  : KDialogBase( parent, "kate mail dialog", true, i18n("Email Files"),
                Ok|Cancel|User1, Ok, false,
                KGuiItem( i18n("&Show All Documents >>") ) ),
    mainWindow( mainwin )
{
  setButtonGuiItem( KDialogBase::Ok, KGuiItem( i18n("&Mail..."), "mail-send") );
  mw = makeVBoxMainWidget();
  mw->installEventFilter( this );

  lInfo = new TQLabel( i18n(
        "<p>Press <strong>Mail...</strong> to email the current document."
        "<p>To select more documents to send, press <strong>Show All Documents&nbsp;&gt;&gt;</strong>."), mw );
  // TODO avoid untill needed - later
  list = new TDEListView( mw );
  list->addColumn( i18n("Name") );
  list->addColumn( i18n("URL") );
  Kate::Document *currentDoc = mainWindow->viewManager()->activeView()->getDoc();
  uint n = KateDocManager::self()->documents();
  uint i = 0;
  TQCheckListItem *item;
  while ( i < n ) {
    Kate::Document *doc = KateDocManager::self()->document( i );
    if ( doc ) {
      item = new KateDocCheckItem( list, doc->docName(), doc );
      item->setText( 1, doc->url().prettyURL() );
      if ( doc == currentDoc ) {
        item->setOn( true );
        item->setSelected( true );
      }
    }
    i++;
  }
  list->hide();
  connect( this, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(slotShowButton()) );
  mw->setMinimumSize( lInfo->sizeHint() );
}
KeyGenerator::KeyGenerator( QWidget * parent )
  : KDialog( parent )
{
  setModal( true );
  setCaption( "KeyGenerationJob test" );
  setButtons( Close|User1 );
  setDefaultButton( User1 );
  showButtonSeparator( true );
  setButtonGuiItem( User1, KGuiItem( "Create" ) );

  QWidget * w = new QWidget( this );
  setMainWidget( w );

  QGridLayout *glay = new QGridLayout( w );
  glay->setMargin( marginHint() );
  glay->setSpacing( spacingHint() );

  int row = -1;

  ++row;
  glay->addWidget( new QLabel( "<GnupgKeyParms format=\"internal\">", w ),
			    row, 0, 1, 2 );
  for ( int i = 0 ; i < numKeyParams ; ++i ) {
    ++row;
    glay->addWidget( new QLabel( keyParams[i], w ), row, 0 );
    glay->addWidget( mLineEdits[i] = new QLineEdit( w ), row, 1 );
  }

  ++row;
  glay->addWidget( new QLabel( "</GnupgKeyParms>", w ), row, 0, 1, 2 );
  ++row;
  glay->setRowStretch( row, 1 );
  glay->setColumnStretch( 1, 1 );

  connect( this, SIGNAL(user1Clicked()), SLOT(slotStartKeyGeneration()) );
}
TwitterListDialog::TwitterListDialog(TwitterApiAccount* theAccount, QWidget* parent)
: KDialog(parent)
{
    if(theAccount){
        account = qobject_cast<TwitterAccount*>(theAccount);
        if(!account){
        kError()<<"TwitterListDialog: ERROR, the provided account is not a valid Twitter account";
        return;
        }
    } else {
        kError()<<"TwitterListDialog: ERROR, theAccount is NULL";
        return;
    }
    setWindowTitle(i18n("Add List"));
    blog = qobject_cast<TwitterMicroBlog*>(account->microblog());
    mainWidget = new QWidget(this);
    ui.setupUi(mainWidget);
    setMainWidget(mainWidget);
    connect(ui.username, SIGNAL(textChanged(QString)), SLOT(slotUsernameChanged(QString)));
    connect(ui.loadUserLists, SIGNAL(clicked(bool)), SLOT(loadUserLists()));
    QRegExp rx("([a-z0-9_]){1,20}(\\/)", Qt::CaseInsensitive);
    QValidator *val = new QRegExpValidator(rx, 0);
    ui.username->setValidator(val);
    ui.username->setFocus();
    setButtonText(Ok, i18n("Add"));
    setButtonGuiItem(Cancel, KStandardGuiItem::close());
    listWidget = new QListWidget(this);
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(ui.label, 0, 0);
    layout->addWidget(ui.username, 0, 1);
    layout->addWidget(ui.loadUserLists, 0, 2);
    layout->addWidget(listWidget, 1, 0, 1, 3);
    layout->addWidget(ui.label_2, 2, 0);
    layout->addWidget(ui.listname, 2, 1, 2, 3);
    mainWidget->setLayout(layout);
}