Ejemplo n.º 1
0
/// Pixmap Collection Editor Dialog
PixmapCollectionEditor::PixmapCollectionEditor(PixmapCollection *collection, QWidget *parent)
        : KDialog(parent, "pixcollection_dialog", true,
                  i18n("Edit Pixmap Collection: %1", collection->collectionName()), Close, Close, false)
{
    m_collection = collection;
    QFrame *frame = makeMainWidget();
    QHBoxLayout *l = new QHBoxLayout(frame);
    setInitialSize(QSize(400, 200), true);

    //// Setup the icon toolbar /////////////////
    QVBoxLayout *vlayout = new QVBoxLayout(l);
    QToolButton *newItemPath = new QToolButton(frame);
    newItemPath->setIconSet(koIcon("document-open"));
    newItemPath->setTextLabel(i18n("&Add File"), true);
    vlayout->addWidget(newItemPath);
    m_buttons.insert(BNewItemPath, newItemPath);
    connect(newItemPath, SIGNAL(clicked()), this, SLOT(newItemByPath()));

    QToolButton *newItemName = new QToolButton(frame);
    newItemName->setIconSet(koIcon("list-add"));
    newItemName->setTextLabel(i18n("&Add an Icon"), true);
    vlayout->addWidget(newItemName);
    m_buttons.insert(BNewItemName, newItemName);
    connect(newItemName, SIGNAL(clicked()), this, SLOT(newItemByName()));

    QToolButton *delItem = new QToolButton(frame);
    delItem->setIconSet(koIcon("list-remove"));
    delItem->setTextLabel(i18n("&Remove Selected Item"), true);
    vlayout->addWidget(delItem);
    m_buttons.insert(BDelItem, delItem);
    connect(delItem, SIGNAL(clicked()), this, SLOT(removeItem()));
    vlayout->addStretch();

    // Setup the iconView
    m_iconView = new K3IconView(frame, "pixcollection_iconView");
    m_iconView->resize(100, 100);
    m_iconView->setArrangement(Q3IconView::LeftToRight);
    m_iconView->setAutoArrange(true);
    m_iconView->setMode(K3IconView::Select);
    l->addWidget(m_iconView);
    connect(m_iconView, SIGNAL(contextMenuRequested(Q3IconViewItem*,QPoint)), this, SLOT(displayMenu(Q3IconViewItem*,QPoint)));
    connect(m_iconView, SIGNAL(itemRenamed(Q3IconViewItem*,QString)), this, SLOT(renameCollectionItem(Q3IconViewItem*,QString)));

    PixmapMap::ConstIterator it;
    PixmapMap::ConstIterator endIt = collection->m_pixmaps.end();
    for (it = collection->m_pixmaps.constBegin(); it != endIt; ++it)
        createIconViewItem(it.key());
}
Ejemplo n.º 2
0
CColorPopup::CColorPopup (QWidget * parent, const char *name, Qt::WFlags f)
:QWidget (parent, name, f)
{
    colorShower = new QLabel (this, "color shower");
    colorShower->setFrameStyle (Q3Frame::WinPanel | Q3Frame::Sunken);
    colorShower->setLineWidth (2);
    colorShower->setMidLineWidth (1);
    colorShower->resize (37, 20);
    colorShower->setPaletteBackgroundColor (QColor (0, 0, 0));
    colorShower->move (5, 2);
    colorName = new Q3TextEdit (this);
    colorName->resize (55, 20);
    colorName->move (50, 2);
    colorName->setHScrollBarMode (Q3ScrollView::AlwaysOff);
    colorName->setVScrollBarMode (Q3ScrollView::AlwaysOff);
    
	QFont f1 ("Times", 8, QFont::Light);
    colorName->setFont (f1);
    colorName->clearFocus ();
    s = new CColorSwatches (this, "", ((CTools *) parent)->dad);
    s->resize (210, 125);
    s->move (2, 29);
    
	QToolButton * colordialog =new CToolButton (this, tr ("Open color dialog"));
    colordialog->move (180, 3);
    colordialog->resize (20, 20);
    colordialog->setIconSet (QIcon (QPixmap ("colordialogBut.png")));
    colordialog->setTextLabel (trUtf8 ("Open Color Dialog"));
    connect (colordialog, SIGNAL (clicked ()), this,SLOT (slotColordialog ()));

        //setFocusPolicy (QWidget::StrongFocus);
    setMouseTracking (true);
    mcursor = QPixmap ((const char **) eye_dropper_tool_xpm);
    setCursor (QCursor (mcursor, 1, 15));
}
Ejemplo n.º 3
0
MsgFile::MsgFile(CToolCustom *parent, Message *msg)
        : QLineEdit(parent)
{
    m_client = msg->client();
    for (QWidget *p = parent->parentWidget(); p; p = p->parentWidget()){
        if (p->inherits("MsgEdit")){
            m_edit = static_cast<MsgEdit*>(p);
            break;
        }
    }
    m_edit->m_edit->setTextFormat(PlainText);
    QString t = msg->getPlainText();
    if (!t.isEmpty())
        m_edit->m_edit->setText(t);
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    parent->addWidget(this);
    QToolButton *btn = new QToolButton(parent);
    btn->setAutoRaise(true);
    btn->setIconSet(*Icon("fileopen"));
    btn->setTextLabel(i18n("Select file"));
    parent->addWidget(btn);
    btn->show();
    connect(btn, SIGNAL(clicked()), this, SLOT(selectFile()));
    parent->setText(i18n("File:"));
    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
    Command cmd;
    cmd->id    = CmdSend;
    cmd->param = m_edit;
    Event e(EventCommandWidget, cmd);
    btnSend = (QToolButton*)(e.process());
    setText(static_cast<FileMessage*>(msg)->getFile());
    changed(text());
    show();
}
Ejemplo n.º 4
0
QWidget *Frame::createCategoryPage( CategoryInterface *c )
{
    QButtonGroup *g = new QButtonGroup( 1, Horizontal, toolBox );
    g->setFrameStyle( QFrame::NoFrame );
    g->setEraseColor(green);
    g->setBackgroundMode(PaletteBase);
    for ( int i = 0; i < c->numCategories(); ++i ) {
	QToolButton *b = new QToolButton( g );
	b->setBackgroundMode(PaletteBase);
	b->setTextLabel( c->categoryName( i ) );
	b->setIconSet( c->categoryIcon( i ) );
	b->setAutoRaise( TRUE );
	b->setTextPosition( QToolButton::Right );
	b->setUsesTextLabel( TRUE );
	g->insert( b, i + c->categoryOffset() );
	connect( g, SIGNAL( clicked( int ) ), c, SLOT( setCurrentCategory( int ) ) );
    }
    return g;
}
Ejemplo n.º 5
0
DelegateDialog::DelegateDialog(QWidget *parent)
    : KDialogBase(parent, "", true, "", Ok | Cancel, Ok, true)
{
    QWidget *page = new QWidget(this);
    QGridLayout *layout = new QGridLayout(page, 5, 3, 11, 6);

    QLabel *label = new QLabel(i18n("User:"******"..."));
    layout->addWidget(emailSelector, 0, 2);

    QValueList<Scalix::DelegateTypes> types;
    types << Scalix::SendOnBehalfOf;
    types << Scalix::SeePrivate;
    types << Scalix::GetMeetings;
    types << Scalix::InsteadOfMe;

    int row = 1;
    for(uint i = 0; i < types.count(); ++i)
    {
        QCheckBox *box = new QCheckBox(Scalix::Delegate::rightsAsString(types[ i ]), page);
        layout->addMultiCellWidget(box, row, row, 1, 2);

        mRights.insert(types[ i ], box);
        row++;
    }

    connect(emailSelector, SIGNAL(clicked()), SLOT(selectEmail()));

    setMainWidget(page);
}
CAdministrationWindow::CAdministrationWindow(QWidget* parent,  CMySQLServer *m)
: CMyWindow(parent, "CAdministrationWindow")
{
  (void)statusBar();

  blocked = false;
  myApp()->incCritical();
  setCaption("[" + m->connectionName() + "] " + trUtf8("Administration Panel"));
  setIcon(getPixmapIcon("applicationIcon"));
  enableMessageWindow(true);  

  if (!m->oneConnection())
  {
    m_mysql = new CMySQLServer(m->connectionName(), messagePanel());
    m_mysql->connect();
    delete_mysql = true;
  }
  else
  {
    m_mysql = m;  //POSIBLE BUG ... need to make m_mysql redirect messages & errors to this->messagePanel() also.  Currently they are in consoleWindow()
    //probably need to disable the timer !
    delete_mysql = false;
  }

  setCentralWidget( new QWidget( this, "qt_central_widget"));
  CAdministrationWindowLayout = new QGridLayout( centralWidget(), 1, 1, 4, 2, "CAdministrationWindowLayout"); 
  
  tabWidget = new QTabWidget( centralWidget(), "tabWidget");  
  
  processList = new CProcessListTable(tabWidget, m_mysql);
  tabWidget->insertTab(processList, getPixmapIcon("showProcessListIcon"), tr("Process List"), SHOW_PROCESSLIST);

  status = new CServerStatusTable(tabWidget, m_mysql);
  tabWidget->insertTab(status, getPixmapIcon("showStatusIcon"), tr("Status"), SHOW_STATUS);

  variables = new CShowServerVariables(tabWidget, m_mysql);
  tabWidget->insertTab(variables, getPixmapIcon("showVariablesIcon"), tr("Variables"), SHOW_VARIABLES);

  save_menu = new QPopupMenu(this);
  connect(save_menu, SIGNAL(activated(int)), this, SLOT(save(int)));
  save_menu->insertItem(getPixmapIcon("showProcessListIcon"), tr("&Process List"), MENU_SAVE_PROCESSLIST);
  save_menu->insertItem(getPixmapIcon("showStatusIcon"), tr("&Status"), MENU_SAVE_STATUS);
  save_menu->insertItem(getPixmapIcon("showVariablesIcon"), tr("&Variables"), MENU_SAVE_VARIABLES);
  save_menu->insertItem(tr("&InnoDB Status"), MENU_SAVE_INNODB_STATUS);

  has_innodb = CInnoDBStatus::hasInnoDB(m_mysql);
  if (has_innodb)
  {
    innoDBStatus = new CInnoDBStatus(tabWidget, m_mysql);
    tabWidget->insertTab(innoDBStatus, tr("InnoDB Status"), SHOW_INNODB_STATUS);    
  }
  else
    save_menu->setItemEnabled(MENU_SAVE_INNODB_STATUS, false);
  
  CAdministrationWindowLayout->addWidget( tabWidget, 0, 0 );

  viewShowMessagesAction = new CAction (tr("Show Messages"), tr("Show &Messages"), Qt::CTRL + Qt::Key_M,
    this, "fileShowMessagesAction", true);
  viewShowMessagesAction->setParentMenuText(tr("View"));
  connect(viewShowMessagesAction, SIGNAL(toggled(bool)), this, SLOT(showMessages(bool)));
  
  CAction * fileCloseAction = new CAction (tr("Close"), getPixmapIcon("closeIcon"),
    tr("&Close"), 0, this, "fileCloseAction");
  fileCloseAction->setParentMenuText(tr("File"));        
  connect(fileCloseAction, SIGNAL(activated()), this, SLOT(close()));


  fileRefreshAction = new CAction (tr("Refresh"), getPixmapIcon("refreshIcon"),
    tr("&Refresh"), Qt::Key_F5, this, "fileRefreshAction");
  fileRefreshAction->setParentMenuText(tr("File"));
  connect(fileRefreshAction, SIGNAL(activated()), this, SLOT(refresh()));


  actionKillProcessAction = new CAction (tr("Kill Process"), getPixmapIcon("killProcessIcon"),
    tr("&Kill Process"), Qt::CTRL + Qt::Key_K, this, "actionKillProcessAction");
  actionKillProcessAction->setParentMenuText(tr("Action"));
  connect(actionKillProcessAction, SIGNAL(activated()), this, SLOT(killProcesses()));

  CAction * actionPingAction = new CAction (tr("Ping"), getPixmapIcon("pingIcon"),
    tr("&Ping"), Qt::CTRL + Qt::Key_P, this, "actionPingAction");
  actionPingAction->setParentMenuText(tr("Action"));
  connect(actionPingAction, SIGNAL(activated()), this, SLOT(ping()));

  CAction * actionShutdownAction = new CAction (tr("Shutdown"), getPixmapIcon("serverShutdownIcon"),
    tr("&Shutdown"), 0, this, "actionShutdownAction");
  actionShutdownAction->setParentMenuText(tr("Action"));
  connect(actionShutdownAction, SIGNAL(activated()), this, SLOT(shutdown()));

  fileTimerAction = new CAction (tr("Start Refresh Timer"), getPixmapIcon("timerIcon"),
    tr("Start Refresh &Timer"), Qt::CTRL + Qt::Key_T, this, "fileTimerAction", true);
  fileTimerAction->setParentMenuText(tr("File"));
  connect(fileTimerAction, SIGNAL(toggled(bool)), this, SLOT(fileTimerActionToggled(bool)));

  QPopupMenu *fileMenu = new QPopupMenu(this);
  QPopupMenu *actionMenu = new QPopupMenu(this);
  QPopupMenu *viewMenu = new QPopupMenu(this);
  connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(viewMenuAboutToShow()));

  fileMenu->insertItem(getPixmapIcon("saveIcon"), tr("Save"), save_menu);
  fileMenu->insertSeparator();
  fileRefreshAction->addTo(fileMenu);
  fileMenu->insertSeparator();
  fileTimerAction->addTo(fileMenu);
  fileMenu->insertSeparator();
  fileCloseAction->addTo(fileMenu);
  menuBar()->insertItem(tr("&File"), fileMenu);

  viewShowMessagesAction->addTo(viewMenu);
  menuBar()->insertItem(tr("&View"), viewMenu);

  actionKillProcessAction->addTo(actionMenu);

  flush_menu = flushMenu(m_mysql->mysql());
  connect(flush_menu, SIGNAL(activated(int)), this, SLOT(flush(int)));

  actionMenu->insertItem(getPixmapIcon("flushIcon"),tr("Flush"), flush_menu);

  actionPingAction->addTo(actionMenu);
  actionMenu->insertSeparator();
  actionShutdownAction->addTo(actionMenu);
  menuBar()->insertItem(tr("&Action"), actionMenu);

  new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");

  QToolBar * actionToolBar = new QToolBar(tr("Action Bar"), this, Top);

  QToolButton * saveTypeButton = new QToolButton(actionToolBar);
  saveTypeButton->setPopup(save_menu);
  saveTypeButton->setPixmap(getPixmapIcon("saveIcon"));
  saveTypeButton->setTextLabel(tr("Save"), true);
  saveTypeButton->setPopupDelay(0);
  actionToolBar->addSeparator();

  actionKillProcessAction->addTo(actionToolBar);
  
  QToolButton * flushTypeButton = new QToolButton(actionToolBar);  
  flushTypeButton->setPopup(flush_menu);
  flushTypeButton->setPixmap(getPixmapIcon("flushIcon"));
  flushTypeButton->setTextLabel(tr("Flush"), true);
  flushTypeButton->setPopupDelay(0);    

  actionPingAction->addTo(actionToolBar);
  actionToolBar->addSeparator();
  actionShutdownAction->addTo(actionToolBar);

  QToolBar * refreshToolBar = new QToolBar(tr("Refresh Bar"), this, Top );  
  fileRefreshAction->addTo(refreshToolBar);  
  refreshToolBar->addSeparator();
 
  QLabel * delayLabel = new QLabel(refreshToolBar, "delayLabel" ); 
  delayLabel->setMinimumSize(QSize(65, 0));
  delayLabel->setText(tr("Refresh Rate (sec)"));
  
  delay = new QSpinBox(refreshToolBar, "delayBox");  
  delay->setMinimumSize(QSize( 50, 0)); 
  delay->setMaxValue(7200);
  delay->setMinValue(1);

  CConfig *cfg = new CConfig();  
  delay->setValue(cfg->readNumberEntry("Refresh Rate", 30));
  status->setTraditionalMode(strtobool(cfg->readStringEntry("Status Traditional Mode", "true")));
  delete cfg;
  status->refresh();  

  fileTimerAction->addTo(refreshToolBar);

  refreshTimer = new QTimer(this);
  connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));

  connect(tabWidget, SIGNAL(currentChanged (QWidget *)), this, SLOT(tabChanged(QWidget *)));
  myResize(600, 400);
}
Ejemplo n.º 7
0
MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent)
{
    d_plot = new Plot(this);

    setCentralWidget(d_plot);

    QToolBar *toolBar = new QToolBar(this);

    QToolButton *btnSpectrogram = new QToolButton(toolBar);
    QToolButton *btnContour = new QToolButton(toolBar);
    QToolButton *btnPrint = new QToolButton(toolBar);

#if QT_VERSION >= 0x040000
    btnSpectrogram->setText("Spectrogram");
    //btnSpectrogram->setIcon(QIcon());
    btnSpectrogram->setCheckable(true);
    btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnSpectrogram);

    btnContour->setText("Contour");
    //btnContour->setIcon(QIcon());
    btnContour->setCheckable(true);
    btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnContour);

	btnPrint->setText("Print");
    btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnPrint);
#else
    btnSpectrogram->setTextLabel("Spectrogram");
    //btnSpectrogram->setPixmap(zoom_xpm);
    btnSpectrogram->setToggleButton(true);
    btnSpectrogram->setUsesTextLabel(true);

    btnContour->setTextLabel("Contour");
    //btnContour->setPixmap(zoom_xpm);
    btnContour->setToggleButton(true);
    btnContour->setUsesTextLabel(true);

    btnPrint->setTextLabel("Print");
    btnPrint->setUsesTextLabel(true);
#endif

    addToolBar(toolBar);

    connect(btnSpectrogram, SIGNAL(toggled(bool)), 
        d_plot, SLOT(showSpectrogram(bool)));
    connect(btnContour, SIGNAL(toggled(bool)), 
        d_plot, SLOT(showContour(bool)));
    connect(btnPrint, SIGNAL(clicked()), 
        d_plot, SLOT(printPlot()) );

#if QT_VERSION >= 0x040000
    btnSpectrogram->setChecked(true);
    btnContour->setChecked(false);
#else
    btnSpectrogram->setOn(true);
    btnContour->setOn(false);
#endif
}
Ejemplo n.º 8
0
void KKeyChooser::initGUI(ActionType type, bool bAllowLetterShortcuts)
{
    d = new KKeyChooserPrivate();

    m_type = type;
    d->bAllowLetterShortcuts = bAllowLetterShortcuts;

    d->bPreferFourModifierKeys = KGlobalAccel::useFourModifierKeys();

    //
    // TOP LAYOUT MANAGER
    //
    // The following layout is used for the dialog
    //            LIST LABELS LAYOUT
    //            SPLIT LIST BOX WIDGET
    //            CHOOSE KEY GROUP BOX WIDGET
    //            BUTTONS LAYOUT
    // Items are added to topLayout as they are created.
    //

    QBoxLayout *topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());

    //
    // ADD SEARCHLINE
    //
    QHBoxLayout *searchLayout = new QHBoxLayout(0, 0, KDialog::spacingHint());
    topLayout->addLayout(searchLayout, 10);

    QToolButton *clearSearch = new QToolButton(this);
    clearSearch->setTextLabel(i18n("Clear Search"), true);
    clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left" : "locationbar_erase"));
    searchLayout->addWidget(clearSearch);
    QLabel *slbl = new QLabel(i18n("&Search:"), this);
    searchLayout->addWidget(slbl);
    KListViewSearchLine *listViewSearch = new KListViewSearchLine(this);
    searchLayout->addWidget(listViewSearch);
    slbl->setBuddy(listViewSearch);
    connect(clearSearch, SIGNAL(pressed()), listViewSearch, SLOT(clear()));

    QString wtstr = i18n(
        "Search interactively for shortcut names (e.g. Copy) "
        "or combination of keys (e.g. Ctrl+C) by typing them here.");

    QWhatsThis::add(slbl, wtstr);
    QWhatsThis::add(listViewSearch, wtstr);

    //
    // CREATE SPLIT LIST BOX
    //
    // fill up the split list box with the action/key pairs.
    //
    QGridLayout *stackLayout = new QGridLayout(2, 2, 2);
    topLayout->addLayout(stackLayout, 10);
    stackLayout->setRowStretch(1, 10); // Only list will stretch

    d->pList = new KListView(this);
    listViewSearch->setListView(d->pList); // Plug into search line
    QValueList< int > columns;
    columns.append(0);
    listViewSearch->setSearchColumns(columns);

    stackLayout->addMultiCellWidget(d->pList, 1, 1, 0, 1);

    wtstr = i18n(
        "Here you can see a list of key bindings, "
        "i.e. associations between actions (e.g. 'Copy') "
        "shown in the left column and keys or combination "
        "of keys (e.g. Ctrl+V) shown in the right column.");

    QWhatsThis::add(d->pList, wtstr);
    new KKeyChooserWhatsThis(d->pList);

    d->pList->setAllColumnsShowFocus(true);
    d->pList->addColumn(i18n("Action"));
    d->pList->addColumn(i18n("Shortcut"));
    d->pList->addColumn(i18n("Alternate"));

    connect(d->pList, SIGNAL(currentChanged(QListViewItem *)), SLOT(slotListItemSelected(QListViewItem *)));

    // handle double clicking an item
    connect(d->pList, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), SLOT(captureCurrentItem()));
    connect(d->pList, SIGNAL(spacePressed(QListViewItem *)), SLOT(captureCurrentItem()));
    //
    // CREATE CHOOSE KEY GROUP
    //
    d->fCArea = new QGroupBox(this);
    topLayout->addWidget(d->fCArea, 1);

    d->fCArea->setTitle(i18n("Shortcut for Selected Action"));
    d->fCArea->setFrameStyle(QFrame::GroupBoxPanel | QFrame::Plain);

    //
    // CHOOSE KEY GROUP LAYOUT MANAGER
    //
    QGridLayout *grid = new QGridLayout(d->fCArea, 3, 4, KDialog::spacingHint());
    grid->addRowSpacing(0, fontMetrics().lineSpacing());

    d->kbGroup = new QButtonGroup(d->fCArea);
    d->kbGroup->hide();
    d->kbGroup->setExclusive(true);

    m_prbNone = new QRadioButton(i18n("no key", "&None"), d->fCArea);
    d->kbGroup->insert(m_prbNone, NoKey);
    m_prbNone->setEnabled(false);
    // grid->addMultiCellWidget( rb, 1, 1, 1, 2 );
    grid->addWidget(m_prbNone, 1, 0);
    QWhatsThis::add(m_prbNone, i18n("The selected action will not be associated with any key."));
    connect(m_prbNone, SIGNAL(clicked()), SLOT(slotNoKey()));

    m_prbDef = new QRadioButton(i18n("default key", "De&fault"), d->fCArea);
    d->kbGroup->insert(m_prbDef, DefaultKey);
    m_prbDef->setEnabled(false);
    // grid->addMultiCellWidget( rb, 2, 2, 1, 2 );
    grid->addWidget(m_prbDef, 1, 1);
    QWhatsThis::add(m_prbDef, i18n("This will bind the default key to the selected action. Usually a reasonable choice."));
    connect(m_prbDef, SIGNAL(clicked()), SLOT(slotDefaultKey()));

    m_prbCustom = new QRadioButton(i18n("C&ustom"), d->fCArea);
    d->kbGroup->insert(m_prbCustom, CustomKey);
    m_prbCustom->setEnabled(false);
    // grid->addMultiCellWidget( rb, 3, 3, 1, 2 );
    grid->addWidget(m_prbCustom, 1, 2);
    QWhatsThis::add(m_prbCustom, i18n("If this option is selected you can create a customized key binding for the"
                                      " selected action using the buttons below."));
    connect(m_prbCustom, SIGNAL(clicked()), SLOT(slotCustomKey()));

    // connect( d->kbGroup, SIGNAL( clicked( int ) ), SLOT( keyMode( int ) ) );

    QBoxLayout *pushLayout = new QHBoxLayout(KDialog::spacingHint());
    grid->addLayout(pushLayout, 1, 3);

    d->pbtnShortcut = new KKeyButton(d->fCArea, "key");
    d->pbtnShortcut->setEnabled(false);
    connect(d->pbtnShortcut, SIGNAL(capturedShortcut(const KShortcut &)), SLOT(capturedShortcut(const KShortcut &)));
    grid->addRowSpacing(1, d->pbtnShortcut->sizeHint().height() + 5);

    wtstr = i18n(
        "Use this button to choose a new shortcut key. Once you click it, "
        "you can press the key-combination which you would like to be assigned "
        "to the currently selected action.");
    QWhatsThis::add(d->pbtnShortcut, wtstr);

    //
    // Add widgets to the geometry manager
    //
    pushLayout->addSpacing(KDialog::spacingHint() * 2);
    pushLayout->addWidget(d->pbtnShortcut);
    pushLayout->addStretch(10);

    d->lInfo = new QLabel(d->fCArea);
    // resize(0,0);
    // d->lInfo->setAlignment( AlignCenter );
    // d->lInfo->setEnabled( false );
    // d->lInfo->hide();
    grid->addMultiCellWidget(d->lInfo, 2, 2, 0, 3);

    // d->globalDict = new QDict<int> ( 100, false );
    // d->globalDict->setAutoDelete( true );
    readGlobalKeys();
    // d->stdDict = new QDict<int> ( 100, false );
    // d->stdDict->setAutoDelete( true );
    // if (type == Application || type == ApplicationGlobal)
    //  readStdKeys();
    connect(kapp, SIGNAL(settingsChanged(int)), SLOT(slotSettingsChanged(int)));
    if(allChoosers == NULL)
        allChoosers = allChoosersDeleter.setObject(allChoosers, new QValueList< KKeyChooser * >);
    allChoosers->append(this);
}
Ejemplo n.º 9
0
popupPublic::popupPublic(QWidget *parent, const char *name,QString sfile,bool filemode,KShortcut goDefaultKey):
KDialogBase( Plain, i18n("Select Public Key"), Details | Ok | Cancel, Ok, parent, name,true)
{

	QWidget *page = plainPage();
	QVBoxLayout *vbox=new QVBoxLayout(page,0,spacingHint());
	vbox->setAutoAdd(true);

	setButtonText(KDialogBase::Details,i18n("Options"));

        if (KGpgSettings::allowCustomEncryptionOptions())
                customOptions=KGpgSettings::customEncryptionOptions();

        KIconLoader *loader = KGlobal::iconLoader();

        keyPair=loader->loadIcon("kgpg_key2",KIcon::Small,20);
        keySingle=loader->loadIcon("kgpg_key1",KIcon::Small,20);
	keyGroup=loader->loadIcon("kgpg_key3",KIcon::Small,20);

        if (filemode) setCaption(i18n("Select Public Key for %1").arg(sfile));
        fmode=filemode;

	QHButtonGroup *hBar=new QHButtonGroup(page);
	//hBar->setFrameStyle(QFrame::NoFrame);
	hBar->setMargin(0);

#if KDE_IS_VERSION( 3, 2, 90 )
	QToolButton *clearSearch = new QToolButton(hBar);
	clearSearch->setTextLabel(i18n("Clear Search"), true);
	clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left"
                                            : "locationbar_erase"));
	(void) new QLabel(i18n("Search: "),hBar);
	KListViewSearchLine* listViewSearch = new KListViewSearchLine(hBar);
	connect(clearSearch, SIGNAL(pressed()), listViewSearch, SLOT(clear()));
#endif

        keysList = new KListView( page );
	 keysList->addColumn(i18n("Name"));
	 keysList->addColumn(i18n("Email"));
	 keysList->addColumn(i18n("ID"));

#if KDE_IS_VERSION( 3, 2, 90 )
	 listViewSearch->setListView(keysList);
#endif

        keysList->setRootIsDecorated(false);
        page->setMinimumSize(540,200);
        keysList->setShowSortIndicator(true);
        keysList->setFullWidth(true);
	keysList->setAllColumnsShowFocus(true);
        keysList->setSelectionModeExt(KListView::Extended);
	keysList->setColumnWidthMode(0,QListView::Manual);
	keysList->setColumnWidthMode(1,QListView::Manual);
	keysList->setColumnWidth(0,210);
	keysList->setColumnWidth(1,210);

        boutonboxoptions=new QButtonGroup(5,Qt::Vertical ,page,0);

	KActionCollection *actcol=new KActionCollection(this);
	(void) new KAction(i18n("&Go to Default Key"),goDefaultKey, this, SLOT(slotGotoDefaultKey()),actcol,"go_default_key");


        CBarmor=new QCheckBox(i18n("ASCII armored encryption"),boutonboxoptions);
        CBuntrusted=new QCheckBox(i18n("Allow encryption with untrusted keys"),boutonboxoptions);
        CBhideid=new QCheckBox(i18n("Hide user id"),boutonboxoptions);
        setDetailsWidget(boutonboxoptions);
        QWhatsThis::add
                (keysList,i18n("<b>Public keys list</b>: select the key that will be used for encryption."));
        QWhatsThis::add
                (CBarmor,i18n("<b>ASCII encryption</b>: makes it possible to open the encrypted file/message in a text editor"));
        QWhatsThis::add
                (CBhideid,i18n("<b>Hide user ID</b>: Do not put the keyid into encrypted packets. This option hides the receiver "
                                "of the message and is a countermeasure against traffic analysis. It may slow down the decryption process because "
                                "all available secret keys are tried."));
        QWhatsThis::add
                (CBuntrusted,i18n("<b>Allow encryption with untrusted keys</b>: when you import a public key, it is usually "
                                  "marked as untrusted and you cannot use it unless you sign it in order to make it 'trusted'. Checking this "
                                  "box enables you to use any key, even if it has not be signed."));

        if (filemode) {
		QWidget *parentBox=new QWidget(boutonboxoptions);
		QHBoxLayout *shredBox=new QHBoxLayout(parentBox,0);
		//shredBox->setFrameStyle(QFrame::NoFrame);
		//shredBox->setMargin(0);
	       CBshred=new QCheckBox(i18n("Shred source file"),parentBox);
                QWhatsThis::add
                        (CBshred,i18n("<b>Shred source file</b>: permanently remove source file. No recovery will be possible"));

		QString shredWhatsThis = i18n( "<qt><b>Shred source file:</b><br /><p>Checking this option will shred (overwrite several times before erasing) the files you have encrypted. This way, it is almost impossible that the source file is recovered.</p><p><b>But you must be aware that this is not secure</b> on all file systems, and that parts of the file may have been saved in a temporary file or in the spooler of your printer if you previously opened it in an editor or tried to print it. Only works on files (not on folders).</p></qt>");
		  KActiveLabel *warn= new KActiveLabel( i18n("<a href=\"whatsthis:%1\">Read this before using shredding</a>").arg(shredWhatsThis),parentBox );
		  shredBox->addWidget(CBshred);
		  shredBox->addWidget(warn);
        }

	        CBsymmetric=new QCheckBox(i18n("Symmetrical encryption"),boutonboxoptions);
                QWhatsThis::add
                        (CBsymmetric,i18n("<b>Symmetrical encryption</b>: encryption does not use keys. You just need to give a password "
                                          "to encrypt/decrypt the file"));
                QObject::connect(CBsymmetric,SIGNAL(toggled(bool)),this,SLOT(isSymetric(bool)));

	CBarmor->setChecked( KGpgSettings::asciiArmor() );
	CBuntrusted->setChecked( KGpgSettings::allowUntrustedKeys() );
	CBhideid->setChecked( KGpgSettings::hideUserID() );
	if (filemode) CBshred->setChecked( KGpgSettings::shredSource() );

        if (KGpgSettings::allowCustomEncryptionOptions()) {
                QHButtonGroup *bGroup = new QHButtonGroup(page);
                //bGroup->setFrameStyle(QFrame::NoFrame);
                (void) new QLabel(i18n("Custom option:"),bGroup);
                KLineEdit *optiontxt=new KLineEdit(bGroup);
                optiontxt->setText(customOptions);
                QWhatsThis::add
                        (optiontxt,i18n("<b>Custom option</b>: for experienced users only, allows you to enter a gpg command line option, like: '--armor'"));
                QObject::connect(optiontxt,SIGNAL(textChanged ( const QString & )),this,SLOT(customOpts(const QString & )));
        }
        QObject::connect(keysList,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotOk()));
//	QObject::connect(this,SIGNAL(okClicked()),this,SLOT(crypte()));
        QObject::connect(CBuntrusted,SIGNAL(toggled(bool)),this,SLOT(refresh(bool)));

        char line[200]="\0";
        FILE *fp2;
        seclist=QString::null;

        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colon --list-secret-keys ", "r");
        while ( fgets( line, sizeof(line), fp2))
        {
            QString readLine=QString::fromUtf8(line);
            if (readLine.startsWith("sec")) seclist+=", 0x"+readLine.section(":",4,4).right(8);
        }
        pclose(fp2);

        trusted=CBuntrusted->isChecked();

        refreshkeys();
	setMinimumSize(550,200);
	updateGeometry();
	keysList->setFocus();
	show();
}
Ejemplo n.º 10
0
void managementWidget::setupWidgets()
{
  QTab t;

  top = new QBoxLayout(this,QBoxLayout::TopToBottom);
  vPan  = new QSplitter(QSplitter::Horizontal, this);
  top->addWidget(vPan);

  // the left panel
  leftpanel = new QFrame(vPan);
  leftbox = new QBoxLayout(leftpanel,QBoxLayout::TopToBottom);

  QTabBar *ltab = new QTabBar(leftpanel);

  treeList = new KpTreeList(leftpanel);


  for (int i = 0; i < 4; i++) {
    QTab *t = new QTab();
    t->setText( tType[i] );
    ltab->addTab(t);
  }
  // Quick Search Bar
  searchToolBar = new KToolBar( leftpanel, "search toolbar");

  QToolButton *clearSearch = new QToolButton(searchToolBar);
  clearSearch->setTextLabel(i18n("Clear Search"), true);
  clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left"
                                            : "locationbar_erase"));
  (void) new QLabel(i18n("Search: "),searchToolBar);

  searchLine = new KpListViewSearchLine(searchToolBar, treeList);
  //  searchLine->setKeepParentsVisible(false);
  connect( clearSearch, SIGNAL( pressed() ), searchLine, SLOT( clear() ));

  QValueList<int> clist;  clist.append(0);  clist.append(2);
  searchLine->setSearchColumns(clist);

  searchToolBar->setStretchableWidget( searchLine );
  connect( treeList, SIGNAL( cleared() ), searchLine, SLOT( clear() ));

  connect(ltab,SIGNAL(selected (int)),SLOT(tabChanged(int)));
  ltab->setCurrentTab(treeList->treeType);

  leftbox->addWidget(ltab,10);
  leftbox->addWidget(searchToolBar,10);
  leftbox->addWidget(treeList,10);

  leftbox->addStretch();

  lbuttons = new QBoxLayout(QBoxLayout::LeftToRight);

  luinstButton = new QPushButton(i18n("Uninstall Marked"),leftpanel);
  luinstButton->setEnabled(FALSE);
  connect(luinstButton,SIGNAL(clicked()),
	  SLOT(uninstallMultClicked()));
  linstButton = new QPushButton(i18n("Install Marked"),leftpanel);
  linstButton->setEnabled(FALSE);
  connect(linstButton,SIGNAL(clicked()),
	  SLOT(installMultClicked()));

  leftbox->addLayout(lbuttons,0); // top level layout as child

  // Setup the `buttons' layout
  lbuttons->addWidget(linstButton,1,AlignBottom);
  lbuttons->addWidget(luinstButton,1,AlignBottom);
  lbuttons->addStretch(1);

  connect(treeList, SIGNAL(selectionChanged(QListViewItem *)),
	  SLOT(packageHighlighted(QListViewItem *)));

  // the right panel
  rightpanel = new QFrame(vPan);
  rightbox = new QBoxLayout(rightpanel,QBoxLayout::TopToBottom);

  packageDisplay = new packageDisplayWidget(rightpanel);
  //  connect(this, SIGNAL(changePackage(packageInfo *)),
  //  packageDisplay, SLOT(changePackage(packageInfo *)));

  rbuttons = new QBoxLayout(QBoxLayout::LeftToRight);

  uinstButton = new QPushButton(i18n("Uninstall"),rightpanel);
  uinstButton->setEnabled(FALSE);
  connect(uinstButton,SIGNAL(clicked()),
	  SLOT(uninstallSingleClicked()));
  instButton = new QPushButton(i18n("Install"),rightpanel);
  instButton->setEnabled(FALSE);
  connect(instButton,SIGNAL(clicked()),
	  SLOT(installSingleClicked()));


  // Setup the `right panel' layout
  rightbox->addWidget(packageDisplay,10);
  rightbox->addLayout(rbuttons,0); // top level layout as child

  // Setup the `buttons' layout
  rbuttons->addWidget(instButton,1);
  rbuttons->addWidget(uinstButton,1);
  rbuttons->addStretch(1);

}