void RKStandardComponentGUI::showEvent (QShowEvent *e) { RK_TRACE (PLUGIN); QWidget::showEvent (e); if (toggle_code_button) { // this is a dialog, not wizard QTimer::singleShot (0, this, SLOT (toggleCode ())); } }
/** Constructor */ CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags) : mBlogId(cId), QMainWindow (parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); setupFileActions(); setupEditActions(); setupViewActions(); setupInsertActions(); setupParagraphActions(); setAcceptDrops(true); setStartupText(); newBlogMsg(); ui.toolBar_2->addAction(ui.actionIncreasefontsize); ui.toolBar_2->addAction(ui.actionDecreasefontsize); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionOrderedlist); ui.toolBar_2->addAction(ui.actionUnorderedlist); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionCode); ui.toolBar_2->addAction(ui.actionsplitPost); setupTextActions(); connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg())); connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew())); connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease())); connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease())); connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote())); connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode())); connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter())); connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList())); connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList())); //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect( ui.msgEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); QPalette palette = QApplication::palette(); codeBackground = palette.color( QPalette::Active, QPalette::Midlight ); fontChanged(ui.msgEdit->font()); colorChanged(ui.msgEdit->textColor()); alignmentChanged(ui.msgEdit->alignment()); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), ui.actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified( ui.msgEdit->document()->isModified()); actionSave->setEnabled( ui.msgEdit->document()->isModified()); actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste())); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif //defaultCharFormat defaultCharFormat = ui.msgEdit->currentCharFormat(); const QFont defaultFont = ui.msgEdit->document()->defaultFont(); defaultCharFormat.setFont( defaultFont ); defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() ); defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); defaultCharFormat.setBackground( palette.color( QPalette::Active, QPalette::Base ) ); defaultCharFormat.setProperty( TextFormat::HasCodeStyle, QVariant( false ) ); //defaultBlockFormat defaultBlockFormat = ui.msgEdit->textCursor().blockFormat(); }
void RKStandardComponentGUI::createDialog (bool switchable) { RK_TRACE (PLUGIN); QVBoxLayout *main_vbox = new QVBoxLayout (this); main_vbox->setContentsMargins (0, 0, 0, 0); QWidget *upper_widget = new QWidget (this); QHBoxLayout *hbox = new QHBoxLayout (upper_widget); // build standard elements main_widget = new KVBox (upper_widget); hbox->addWidget (main_widget); // lines QFrame *line = new QFrame (upper_widget); line->setFrameShape (QFrame::VLine); line->setFrameShadow (QFrame::Plain); hbox->addWidget (line); // buttons QVBoxLayout* vbox = new QVBoxLayout (); hbox->addLayout (vbox); vbox->setContentsMargins (0, 0, 0, 0); vbox->setSpacing (RKGlobals::spacingHint ()); ok_button = new QPushButton (i18n ("Submit"), upper_widget); connect (ok_button, SIGNAL (clicked ()), this, SLOT (ok ())); vbox->addWidget (ok_button); if (enslaved) ok_button->hide (); cancel_button = new QPushButton (i18n ("Close"), upper_widget); connect (cancel_button, SIGNAL (clicked ()), this, SLOT (cancel ())); vbox->addWidget (cancel_button); auto_close_box = new QCheckBox (i18n ("Auto close"), upper_widget); auto_close_box->setChecked (true); vbox->addWidget (auto_close_box); if (enslaved) auto_close_box->hide (); vbox->addStretch (1); help_button = new QPushButton (i18n ("Help"), upper_widget); help_button->setEnabled (component->haveHelp ()); connect (help_button, SIGNAL (clicked ()), this, SLOT (help ())); vbox->addWidget (help_button); if (switchable && (!enslaved)) { switch_button = new QPushButton (i18n ("Use Wizard"), upper_widget); connect (switch_button, SIGNAL (clicked ()), this, SLOT (switchInterface ())); vbox->addWidget (switch_button); } vbox->addStretch (2); toggle_code_button = new QPushButton (i18n ("Code"), upper_widget); toggle_code_button->setCheckable (true); connect (toggle_code_button, SIGNAL (clicked ()), this, SLOT (toggleCode ())); vbox->addWidget (toggle_code_button); if (enslaved) toggle_code_button->hide (); // code display code_display = new RKCommandEditorWindow (this, true); code_display->setMinimumHeight (RKSettingsModulePlugins::defaultCodeHeight ()); code_display->hide (); main_vbox->addWidget (upper_widget); main_vbox->addWidget (code_display); if (!enslaved && RKSettingsModulePlugins::showCodeByDefault ()) { toggle_code_button->setChecked (true); // will trigger showing the code along with the dialog } }