QucsEdit::QucsEdit(const QString& FileName_, bool readOnly) { // set application icon setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Editor " PACKAGE_VERSION " - " + tr("File: ")); QVBoxLayout *v = new QVBoxLayout(this); QHBox *h = new QHBox(this); v->addWidget(h); QToolButton *ButtLoad = new QToolButton(h); ButtLoad->setIconSet( QIconSet(QImage(QucsSettings.BitmapDir + "fileopen.png"))); connect(ButtLoad, SIGNAL(clicked()), SLOT(slotLoad())); QToolButton *ButtSave = new QToolButton(h); ButtSave->setIconSet( QIconSet(QImage(QucsSettings.BitmapDir + "filesave.png"))); connect(ButtSave, SIGNAL(clicked()), SLOT(slotSave())); ButtSave->setDisabled(readOnly); h->setStretchFactor(new QWidget(h),5); // stretchable placeholder PosText = new QLabel(tr("Line: %1 - Column: %2").arg(1).arg(1), h); h->setStretchFactor(new QWidget(h),5); // stretchable placeholder QPushButton *ButtAbout = new QPushButton(tr("About"),h); connect(ButtAbout, SIGNAL(clicked()), SLOT(slotAbout())); QPushButton *ButtOK = new QPushButton(tr("Quit"),h); connect(ButtOK, SIGNAL(clicked()), SLOT(slotQuit())); ButtOK->setFocus(); // try using same-sized mono-spaced font in the textarea QFont fedit = QFont("Courier New"); fedit.setPointSize(QucsSettings.font.pointSize()-1); fedit.setStyleHint(QFont::Courier); fedit.setFixedPitch(true); text = new QTextEdit(this); text->setTextFormat(Qt::PlainText); text->setReadOnly(readOnly); text->setWordWrap(QTextEdit::NoWrap); text->setMinimumSize(300,200); text->setFont(fedit); text->setCurrentFont(fedit); v->addWidget(text); connect(text, SIGNAL(cursorPositionChanged(int, int)), SLOT(slotPrintCursorPosition(int, int))); // ................................................. loadFile(FileName_); }
/// 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()); }
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)); }
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(); }
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; }
toMain::toMain() : toMainWindow() { qApp->setMainWidget ( this ); setDockMenuEnabled ( true ); Edit = NULL; FileMenu = new QPopupMenu ( this ); FileMenu->insertItem ( QPixmap ( ( const char ** ) connect_xpm ), "&New Connection...", TO_NEW_CONNECTION ); FileMenu->insertItem ( QPixmap ( ( const char ** ) disconnect_xpm ), "&Close Connection", this, SLOT ( delConnection() ), 0, TO_CLOSE_CONNECTION ); FileMenu->insertSeparator(); FileMenu->insertItem ( QPixmap ( ( const char ** ) commit_xpm ), "&Commit Connection", TO_FILE_COMMIT ); FileMenu->insertItem ( QPixmap ( ( const char ** ) rollback_xpm ), "&Rollback Connection", TO_FILE_ROLLBACK ); FileMenu->insertItem ( "C&urrent Connection", TO_FILE_CURRENT ); FileMenu->insertItem ( QPixmap ( ( const char ** ) trash_xpm ), "Reread Object Cache", TO_FILE_CLEARCACHE ); FileMenu->insertSeparator(); FileMenu->insertItem ( QPixmap ( ( const char ** ) fileopen_xpm ), "&Open File...", TO_FILE_OPEN ); FileMenu->insertItem ( QPixmap ( ( const char ** ) filesave_xpm ), "&Save", TO_FILE_SAVE ); FileMenu->insertItem ( "Save A&s...", TO_FILE_SAVE_AS ); FileMenu->insertSeparator(); FileMenu->insertItem ( QPixmap ( ( const char ** ) print_xpm ), "&Print..", TO_FILE_PRINT ); FileMenu->insertSeparator(); FileMenu->insertItem ( "&Quit", TO_FILE_QUIT ); menuBar() ->insertItem ( "&File", FileMenu, TO_FILE_MENU ); FileMenu->setAccel ( Key_G | CTRL, TO_NEW_CONNECTION ); FileMenu->setAccel ( Key_O | CTRL, TO_FILE_OPEN ); FileMenu->setAccel ( Key_S | CTRL, TO_FILE_SAVE ); FileMenu->setAccel ( Key_W | CTRL, TO_FILE_COMMIT ); FileMenu->setAccel ( Key_R | CTRL, TO_FILE_ROLLBACK ); FileMenu->setAccel ( Key_U | CTRL, TO_FILE_CURRENT ); connect ( FileMenu, SIGNAL ( aboutToShow() ), this, SLOT ( editFileMenu() ) ); EditMenu = new QPopupMenu ( this ); EditMenu->insertItem ( QPixmap ( ( const char ** ) undo_xpm ), "&Undo", TO_EDIT_UNDO ); EditMenu->insertItem ( QPixmap ( ( const char ** ) redo_xpm ), "&Redo", TO_EDIT_REDO ); EditMenu->insertSeparator(); EditMenu->insertItem ( QPixmap ( ( const char ** ) cut_xpm ), "Cu&t", TO_EDIT_CUT ); EditMenu->insertItem ( QPixmap ( ( const char ** ) copy_xpm ), "&Copy", TO_EDIT_COPY ); EditMenu->insertItem ( QPixmap ( ( const char ** ) paste_xpm ), "&Paste", TO_EDIT_PASTE ); EditMenu->insertSeparator(); EditMenu->insertItem ( "&Search && Replace", TO_EDIT_SEARCH ); EditMenu->insertItem ( "Search &Next", TO_EDIT_SEARCH_NEXT ); EditMenu->insertItem ( "Select &All", TO_EDIT_SELECT_ALL ); EditMenu->insertItem ( "Read All &Items", TO_EDIT_READ_ALL ); EditMenu->insertSeparator(); EditMenu->insertItem ( "&Options...", TO_EDIT_OPTIONS ); EditMenu->setAccel ( Key_Z | CTRL, TO_EDIT_UNDO ); EditMenu->setAccel ( Key_Y | CTRL, TO_EDIT_REDO ); EditMenu->setAccel ( Key_X | CTRL, TO_EDIT_CUT ); EditMenu->setAccel ( Key_C | CTRL, TO_EDIT_COPY ); EditMenu->setAccel ( Key_V | CTRL, TO_EDIT_PASTE ); EditMenu->setAccel ( Key_F | CTRL, TO_EDIT_SEARCH ); EditMenu->setAccel ( Key_F3, TO_EDIT_SEARCH_NEXT ); connect ( EditMenu, SIGNAL ( aboutToShow() ), this, SLOT ( editFileMenu() ) ); menuBar() ->insertItem ( "&Edit", EditMenu, TO_EDIT_MENU ); std::map<QString, toTool *> &tools = toTool::tools(); QToolBar *toolbar = toAllocBar ( this, "Application", QString::null ); LoadButton = new QToolButton ( QPixmap ( ( const char ** ) fileopen_xpm ), "Load file into editor", "Load file into editor", this, SLOT ( loadButton() ), toolbar ); SaveButton = new QToolButton ( QPixmap ( ( const char ** ) filesave_xpm ), "Save file from editor", "Save file from editor", this, SLOT ( saveButton() ), toolbar ); PrintButton = new QToolButton ( QPixmap ( ( const char ** ) print_xpm ), "Print", "Print", this, SLOT ( printButton() ), toolbar ); PrintButton->setEnabled ( false ); LoadButton->setEnabled ( false ); SaveButton->setEnabled ( false ); toolbar->addSeparator(); UndoButton = new QToolButton ( QPixmap ( ( const char ** ) undo_xpm ), "Undo", "Undo", this, SLOT ( undoButton() ), toolbar ); RedoButton = new QToolButton ( QPixmap ( ( const char ** ) redo_xpm ), "Redo", "Redo", this, SLOT ( redoButton() ), toolbar ); CutButton = new QToolButton ( QPixmap ( ( const char ** ) cut_xpm ), "Cut to clipboard", "Cut to clipboard", this, SLOT ( cutButton() ), toolbar ); CopyButton = new QToolButton ( QPixmap ( ( const char ** ) copy_xpm ), "Copy to clipboard", "Copy to clipboard", this, SLOT ( copyButton() ), toolbar ); PasteButton = new QToolButton ( QPixmap ( ( const char ** ) paste_xpm ), "Paste from clipboard", "Paste from clipboard", this, SLOT ( pasteButton() ), toolbar ); UndoButton->setEnabled ( false ); RedoButton->setEnabled ( false ); CutButton->setEnabled ( false ); CopyButton->setEnabled ( false ); PasteButton->setEnabled ( false ); ToolsMenu = new QPopupMenu ( this ); #ifdef TOOL_TOOLBAR toolbar = new toAllocBar ( this, "Tools", QString::null ); #else toolbar->addSeparator(); #endif int toolID = TO_TOOLS; int lastPriorityPix = 0; int lastPriorityMenu = 0; SQLEditor = -1; DefaultTool = toolID; QString defName = toTool::globalConfig ( CONF_DEFAULT_TOOL, "" ); HelpMenu = new QPopupMenu ( this ); HelpMenu->insertItem ( "C&urrent Context", TO_HELP_CONTEXT ); HelpMenu->insertItem ( "&Contents", TO_HELP_CONTENTS ); HelpMenu->insertSeparator(); HelpMenu->insertItem ( "&About TOra", TO_HELP_ABOUT ); HelpMenu->insertItem ( "&License", TO_HELP_LICENSE ); HelpMenu->insertItem ( "&Quotes", TO_HELP_QUOTES ); HelpMenu->setAccel ( Key_F1, TO_HELP_CONTEXT ); if ( !toFreeware() ) { HelpMenu->insertSeparator(); HelpMenu->insertItem ( "&Register", TO_HELP_REGISTER ); } QPopupMenu *toolAbout = NULL; for ( std::map<QString, toTool *>::iterator i = tools.begin();i != tools.end();i++ ) { const QPixmap *pixmap = ( *i ).second->toolbarImage(); const char *toolTip = ( *i ).second->toolbarTip(); const char *menuName = ( *i ).second->menuItem(); QString tmp = ( *i ).second->name(); tmp += CONF_TOOL_ENABLE; if ( toTool::globalConfig ( tmp, "Yes" ).isEmpty() ) continue; if ( defName == menuName ) DefaultTool = toolID; int priority = ( *i ).second->priority(); if ( priority / 100 != lastPriorityPix / 100 && pixmap ) { toolbar->addSeparator(); lastPriorityPix = priority; } if ( priority / 100 != lastPriorityMenu / 100 && menuName ) { ToolsMenu->insertSeparator(); lastPriorityMenu = priority; } if ( pixmap ) { if ( !toolTip ) toolTip = ""; NeedConnection[new QToolButton ( *pixmap, toolTip, toolTip, ( *i ).second, SLOT ( createWindow ( void ) ), toolbar ) ] = ( *i ).second; } if ( menuName ) { if ( pixmap ) ToolsMenu->insertItem ( *pixmap, menuName, toolID ); else ToolsMenu->insertItem ( menuName, toolID ); ToolsMenu->setItemEnabled ( toolID, false ); } if ( ( *i ).second->hasAbout() && menuName ) { if ( !toolAbout ) { toolAbout = new QPopupMenu ( this ); HelpMenu->insertItem ( "Tools", toolAbout ); } if ( pixmap ) toolAbout->insertItem ( *pixmap, menuName, toolID + TO_ABOUT_ID_OFFSET ); else toolAbout->insertItem ( menuName, toolID + TO_ABOUT_ID_OFFSET ); } Tools[toolID] = ( *i ).second; toolID++; } #ifndef TOOL_TOOLBAR toolbar->setStretchableWidget ( new QLabel ( "", toolbar ) ); #endif new QToolButton ( QPixmap ( ( const char ** ) connect_xpm ), "Connect to database", "Connect to database", this, SLOT ( addConnection() ), toolbar ); DisconnectButton = new QToolButton ( QPixmap ( ( const char ** ) disconnect_xpm ), "Disconnect current connection", "Disconnect current connection", this, SLOT ( delConnection() ), toolbar ); DisconnectButton->setEnabled ( false ); toolbar->addSeparator(); NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) commit_xpm ), "Commit connection", "Commit connection", this,SLOT ( commitButton() ),toolbar ) ] = NULL; NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) rollback_xpm ), "Rollback connection", "Rollback connection", this,SLOT ( rollbackButton() ),toolbar ) ] = NULL; toolbar->addSeparator(); ConnectionSelection = new QComboBox ( toolbar ); ConnectionSelection->setFixedWidth ( 200 ); ConnectionSelection->setFocusPolicy ( NoFocus ); connect ( ConnectionSelection, SIGNAL ( activated ( int ) ), this, SLOT ( changeConnection() ) ); menuBar() ->insertItem ( "&Tools", ToolsMenu, TO_TOOLS_MENU ); WindowsMenu = new QPopupMenu ( this ); WindowsMenu->setCheckable ( true ); connect ( WindowsMenu, SIGNAL ( aboutToShow() ), this, SLOT ( windowsMenu() ) ); menuBar() ->insertItem ( "&Window", WindowsMenu, TO_WINDOWS_MENU ); menuBar() ->insertSeparator(); menuBar() ->insertItem ( "&Help", HelpMenu, TO_HELP_MENU ); char buffer[100]; sprintf ( buffer, DEFAULT_TITLE, TOVERSION ); setCaption ( buffer ); #ifdef TO_KDE KDockWidget *mainDock = createDockWidget ( buffer, QPixmap ( ( const char ** ) toramini_xpm ) ); Workspace = new QWorkspace ( mainDock ); mainDock->setWidget ( Workspace ); setView ( mainDock ); setMainDockWidget ( mainDock ); mainDock->setEnableDocking ( KDockWidget::DockNone ); #else Workspace = new QWorkspace ( this ); setCentralWidget ( Workspace ); #endif setIcon ( QPixmap ( ( const char ** ) toramini_xpm ) ); statusBar() ->message ( "Ready" ); menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, false ); menuBar() ->setItemEnabled ( TO_FILE_COMMIT, false ); menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, false ); menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, false ); DisconnectButton->setEnabled ( false ); for ( std::map<QToolButton *, toTool *>::iterator j = NeedConnection.begin(); j != NeedConnection.end();j++ ) ( *j ).first->setEnabled ( false ); connect ( menuBar(), SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) ); RowLabel = new QLabel ( statusBar() ); statusBar() ->addWidget ( RowLabel, 0, true ); RowLabel->setMinimumWidth ( 60 ); RowLabel->hide(); ColumnLabel = new QLabel ( statusBar() ); statusBar() ->addWidget ( ColumnLabel, 0, true ); ColumnLabel->setMinimumWidth ( 60 ); ColumnLabel->hide(); QToolButton *dispStatus = new toPopupButton ( statusBar() ); dispStatus->setIconSet ( QPixmap ( ( const char ** ) up_xpm ) ); statusBar() ->addWidget ( dispStatus, 0, true ); StatusMenu = new QPopupMenu ( dispStatus ); dispStatus->setPopup ( StatusMenu ); connect ( StatusMenu, SIGNAL ( aboutToShow() ), this, SLOT ( statusMenu() ) ); connect ( StatusMenu, SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) ); toolID = TO_TOOLS; for ( std::map<QString, toTool *>::iterator k = tools.begin();k != tools.end();k++ ) { ( *k ).second->customSetup ( toolID ); toolID++; } Search = NULL; if ( !toTool::globalConfig ( CONF_MAXIMIZE_MAIN, "Yes" ).isEmpty() ) showMaximized(); show(); QString welcome; do { welcome = toCheckLicense ( false ); } while ( welcome.isNull() ); toStatusMessage ( welcome, true ); connect ( &Poll, SIGNAL ( timeout() ), this, SLOT ( checkCaching() ) ); try { toNewConnection newConnection ( this, "First connection", true ); toConnection *conn; do { conn = NULL; if ( newConnection.exec() ) { conn = newConnection.makeConnection(); } else { break; } } while ( !conn ); if ( conn ) addConnection ( conn ); } TOCATCH connect ( toMainWidget() ->workspace(), SIGNAL ( windowActivated ( QWidget * ) ), this, SLOT ( windowActivated ( QWidget * ) ) ); }
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); }
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(); }
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); }
OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) : QWidget( parent ), m_sel( sel ) { m_all = false; QVBoxLayout* lay = new QVBoxLayout( this ); m_currentDir = startDir; /* * now we add a special bar * One Button For Up * Home * Doc * And a dropdown menu with FileSystems * FUTURE: one to change dir with lineedit * Bookmarks * Create Dir */ QHBox* box = new QHBox(this ); box->setBackgroundMode( PaletteButton ); box->setSpacing( 0 ); QToolButton *btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("up") ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdUP() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("home") ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdHome() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("DocsIcon") ); connect(btn, SIGNAL(clicked() ), this, SLOT(cdDoc() ) ); m_btnNew = new QToolButton( box ); m_btnNew->setIconSet( Resource::loadIconSet("new") ); connect(m_btnNew, SIGNAL(clicked() ), this, SLOT(slotNew() ) ); m_btnClose = new QToolButton( box ); m_btnClose->setIconSet( Resource::loadIconSet("close") ); connect(m_btnClose, SIGNAL(clicked() ), selector(), SIGNAL(closeMe() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("pcmcia") ); /* let's fill device parts */ QPopupMenu* pop = new QPopupMenu(this); connect(pop, SIGNAL( activated(int) ), this, SLOT(slotFSActivated(int) ) ); StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it(fs); for ( ; it.current(); ++it ) { const QString disk = (*it)->name(); const QString path = (*it)->path(); m_dev.insert( disk, path ); pop->insertItem( disk ); } m_fsPop = pop; btn->setPopup( pop ); lay->addWidget( box ); m_view = new QListView( this ); m_view->installEventFilter(this); QPEApplication::setStylusOperation( m_view->viewport(), QPEApplication::RightOnHold); m_view->addColumn(" " ); m_view->addColumn(tr("Name"), 135 ); m_view->addColumn(tr("Size"), -1 ); m_view->addColumn(tr("Date"), 60 ); m_view->addColumn(tr("Mime Type"), -1 ); m_view->setSorting( 1 ); m_view->setAllColumnsShowFocus( TRUE ); lay->addWidget( m_view, 1000 ); connectSlots(); }