void KMoneyThingMainWidget::slotSave()
{
  KTempFile temp;
  QString fileName = mCurrentFile->kurl().path();
  
  if (fileName == "")
  {
    slotSaveAs();
    return;
  }
  
  if (!mCurrentFile->kurl().isLocalFile())
  {
    fileName = temp.name();
  }
  
  emit(setStatus(i18n("Saving file...")));
  QByteArray dump = qCompress(mCurrentFile->dump());
  QFile file(fileName);
  file.open(IO_WriteOnly);
  QDataStream stream(&file);
  stream << (QString) "KMoneyThingFile" << dump;
  file.close();
  
  if (!mCurrentFile->kurl().isLocalFile())
  {
    emit(setStatus(i18n("Uploading file...")));
    if (!KIO::NetAccess::upload(fileName, mCurrentFile->kurl(), this))
      KMessageBox::error(this, i18n("Failed to upload file."));
  }
  
  temp.unlink();
  
  emit(setStatus(i18n("Ready.")));
}
void 
PolicyEditorClass::slotNew()
{
  if (document_.getModified()) {

    int rc = QMessageBox::warning(this, "PolicyEditor", "The document"
				+policyFileName_+" has been modified\n"+"Do you want to save it?",
				  "&Save...", "&Dont't Save", "&Cancel", 0,2);

    switch(rc) {
    case 0: 
      slotSaveAs(); 
      break;
    case 1:
      break;
    case 2:
      return;
    }
  }  
 
  view_->prepareFileClosing();
  document_.loadXML(miroRoot_ + "/etc/PolicyEditorNewFile.xml");
  document_.setModified(false);

  //   std::cout <<"opened new document" << std::endl;

  setCaption("new document");
  policyFileName_="_";
  QString message;
  message.sprintf("New document opend");
  statusBar()->message(message, 3000);
  view_->setVerticalScrollValue(0);
  view_->setHorizontalScrollValue(0);
  view_->update();     
}
Example #3
0
void ClsQSAList::slotSave() {
//    cout << "ClsQSAList::slotSave()" << endl;
    if(strFilename.length()<=0) {
	slotSaveAs();
    }
    
    ofstream ofstr;
    ofstr.open(strFilename.c_str());

    if(!ofstr) {
	cerr << "ERROR saving to: " << strFilename << endl;
	return;
    }
        
    int iCount = getCount();
    for(int ii=0; ii<iCount; ii++) {
	QListBoxItem * lbi = qlbox->item(ii);
	if(lbi!=NULL) {
	    vector <vector<double> > v = dynamic_cast<ClsListBoxSA*>(lbi)->getMatrix(); //!!!!!!!! use valarry<double>!!
	    ofstr << v;
	    if(ii+1 < iCount) {
		ofstr << endl;
	    }
	    ofstr << flush;
	}
    }
    ofstr.close();
}
void 
PolicyEditorClass::closeEvent(QCloseEvent *e)
{
  if (document_.getModified()) {
    int rc = QMessageBox::warning(this, 
				  "PolicyEditor", "The document"
				+policyFileName_+" has been modified\n"+"Do you want to save it?",
				  "&Save...", "&Don't Save", "&Cancel", 0, 2);
    switch(rc) {
    case 0: 
      if (policyFileName_!="_") {
	document_.saveXML(policyFileName_);
	document_.setModified(false);
	QString message;
	message.sprintf("%s saved", (const char*) policyFileName_);
	statusBar()->message(message, 3000);
      }
      else {
	slotSaveAs();
	if (policyFileName_=="_") 
	  return;//SaveAs-Dialog wurde mit Cancel geschlossen;
      }
    case 1: 
      e->accept();
      return;
    case 2:
      e->ignore(); 
      return;
    }
  }
  else {
    e->accept();
  }
}
Example #5
0
///////////////////////////////////////////////////////////
//                                                       //
// File Menu                                             //
//                                                       //
///////////////////////////////////////////////////////////
void WinImage::setupFileMenu()
{
  // Actions
  QAction* open = new QAction( "&Open", this );
  open->setShortcut( Qt::CTRL + Qt::Key_O );
  open->setStatusTip( "This will open a file");
  connect( open, SIGNAL( triggered() ), this, SLOT( slotOpen() ) );

  //QAction* save = new QAction( "&Save", this );
  //connect( save, SIGNAL( triggered() ), this, SLOT( save() ) );

  QAction* saveAs = new QAction( "Save &As", this );
  saveAs->setShortcut( Qt::CTRL + Qt::Key_A );
  connect( saveAs, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) );

  QAction* quit = new QAction( "&Quit", this );
  quit->setShortcut( Qt::CTRL + Qt::Key_Q );
  quit->setStatusTip("This will quit the application unconditionally");
  quit->setWhatsThis("This is a button, stupid!");
  connect( quit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );

  // Menubarvoid Test::paintEvent( QPaintEvent* )

  QMenu* file = new QMenu( "&File", menuBar());
  menuBar()->addMenu( file);
  file->addAction( open);
  //file->addAction( save);
  file->addAction( saveAs);
  file->addAction( quit);
}
Example #6
0
bool AnnoqtConfEditor::slotSave()
{
  if ( m_currentAnnotationConfigurationFile.isEmpty() )
  {
    return slotSaveAs();
  }
  else
  {
    return saveFile( m_currentAnnotationConfigurationFile );
  }
}
Example #7
0
void MainWindow::slotSave()
{
	if(m_filename.isEmpty())
	{
		slotSaveAs();
	}
	else
	{
		saveTextFile(m_filename);
	}
}
Example #8
0
// ----------------- CodeDialog
CodeDialog::CodeDialog(QWidget *parent) :
    QDialog(parent),
    m_impl(new CodeDialogPrivate)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    QVBoxLayout *vBoxLayout = new QVBoxLayout;

    // Edit tool bar
    QToolBar *toolBar = new QToolBar;

    const QIcon saveIcon = createIconSet(QLatin1String("filesave.png"));
    QAction *saveAction = toolBar->addAction(saveIcon, tr("Save..."));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(slotSaveAs()));

    const QIcon copyIcon = createIconSet(QLatin1String("editcopy.png"));
    QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All"));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copyAll()));

    QAction *findAction = toolBar->addAction(
                              TextEditFindWidget::findIconSet(),
                              tr("&Find in Text..."),
                              m_impl->m_findWidget, SLOT(activate()));
    findAction->setShortcut(QKeySequence::Find);

    vBoxLayout->addWidget(toolBar);

    // Edit
    m_impl->m_textEdit->setReadOnly(true);
    m_impl->m_textEdit->setMinimumSize(QSize(
                                           m_impl->m_findWidget->minimumSize().width(),
                                           500));
    vBoxLayout->addWidget(m_impl->m_textEdit);

    // Find
    m_impl->m_findWidget->setTextEdit(m_impl->m_textEdit);
    vBoxLayout->addWidget(m_impl->m_findWidget);

    // Button box
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Disable auto default
    QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
    closeButton->setAutoDefault(false);
    vBoxLayout->addWidget(buttonBox);

    setLayout(vBoxLayout);
}
Example #9
0
void QG_ExitDialog::clicked(QAbstractButton * button){
    QDialogButtonBox::StandardButton bt = buttonBox->standardButton ( button );
    switch (bt){
    case QDialogButtonBox::Close:
        emit accept();
        break;
    case QDialogButtonBox::Save:
        slotSave();
        break;
    case QDialogButtonBox::SaveAll:
        slotSaveAs();
        break;
    default:
        emit reject();
    };
}
void 
PolicyEditorClass::slotSave()
{
  if (policyFileName_!="_")
  {
    document_.saveXML(policyFileName_);
    document_.setModified(false);
    QString message;
    message.sprintf("%s saved", (const char*) policyFileName_);
    statusBar()->message(message, 3000);
  }
  else
  {
    slotSaveAs();
  }
}
Example #11
0
void AnnoqtConfEditor::createActions()
{
  newAct = new QAction( QIcon( ":/filenew.xpm" ), tr( "&New" ), this );
  newAct->setShortcut( tr( "Ctrl+N" ) );
  newAct->setStatusTip( tr( "Create a new file" ) );
  connect( newAct, SIGNAL( triggered() ), this, SLOT( slotNewConfiguration() ) );

  openAct = new QAction( QIcon( ":/fileopen.xpm" ), tr( "&Open..." ), this );
  openAct->setShortcut( tr( "Ctrl+O" ) );
  openAct->setStatusTip( tr( "Open an existing file" ) );
  connect( openAct, SIGNAL( triggered() ), this, SLOT( slotOpen() ) );

  saveAct = new QAction( QIcon( ":/filesave.xpm" ), tr( "&Save" ), this );
  saveAct->setShortcut( tr( "Ctrl+S" ) );
  saveAct->setStatusTip( tr( "Save the document to disk" ) );
  connect( saveAct, SIGNAL( triggered() ), this, SLOT( slotSave() ) );

  saveAsAct = new QAction( tr( "Save &As..." ), this );
  saveAsAct->setStatusTip( tr( "Save the document under a new name" ) );
  connect( saveAsAct, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) );

  exitAct = new QAction( tr( "E&xit" ), this );
  exitAct->setShortcut( tr( "Ctrl+Q" ) );
  exitAct->setStatusTip( tr( "Exit the application" ) );
  connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) );

  cutAct = new QAction( QIcon( ":/editcut.xpm" ), tr( "Cu&t" ), this );
  cutAct->setShortcut( tr( "Ctrl+X" ) );
  cutAct->setStatusTip( tr( "Cut the current selection's contents to the "
                            "clipboard" ) );
  connect( cutAct, SIGNAL( triggered() ), this, SLOT( slotCut() ) );

  addItemAction = new QAction( QIcon( ":/item.xpm" ), tr( "New entity type" ), this );
  addItemAction->setShortcut( tr( "Ctrl+E" ) );
  addItemAction->setStatusTip( tr( "Add a new entity type" ) );
  connect( addItemAction, SIGNAL( triggered() ), this, SLOT( slotAddItemAction() ) );
  
  aboutAct = new QAction( tr( "&About" ), this );
  aboutAct->setStatusTip( tr( "Show the application's About box" ) );
  connect( aboutAct, SIGNAL( triggered() ), this, SLOT( slotAbout() ) );

  aboutQtAct = new QAction( tr( "About &Qt" ), this );
  aboutQtAct->setStatusTip( tr( "Show the Qt library's About box" ) );
  connect( aboutQtAct, SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) );

  cutAct->setEnabled( true );
}
Example #12
0
void KWatchGnuPGMainWindow::createActions()
{
  (void)new KAction( i18n("C&lear History"), "history_clear", CTRL+Key_L,
		     this, SLOT( slotClear() ),
		     actionCollection(), "clear_log" );
  (void)KStdAction::saveAs( this, SLOT(slotSaveAs()), actionCollection() );
  (void)KStdAction::close( this, SLOT(close()), actionCollection() );
  (void)KStdAction::quit( this, SLOT(slotQuit()), actionCollection() );
  (void)KStdAction::preferences( this, SLOT(slotConfigure()), actionCollection() );
  ( void )KStdAction::keyBindings(this, SLOT(configureShortcuts()), actionCollection());
  ( void )KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());

#if 0
  (void)new KAction( i18n("Configure KWatchGnuPG..."), QString::fromLatin1("configure"),
					 0, this, SLOT( slotConfigure() ),
					 actionCollection(), "configure" );
#endif

}
void 
PolicyEditorClass::slotLoad()
{
  // show file dialog //
  if (document_.getModified())
  {
    int rc = QMessageBox::warning(this, "PolicyEditor", "The document"
				  + policyFileName_ + " has been modified\n"+"Do you want to save it?",
				  "&Save...", "&Dont't Save", "&Cancel", 0, 2);

    switch(rc)
    {
    case 0: 
      slotSaveAs();
      break;
    case 1:
      break;
    case 2:
      return;
    }
  } 
  QString filename = QFileDialog::getOpenFileName(0, "Polycies *.xml\nAlle Dateien *", this);
  if (filename.isNull())
    return;
  view_->prepareFileClosing();

  // load selected XML file
  document_.loadXML(filename);
  document_.setModified(false);
  policyFileName_=filename;

  // set new caption and status bar
  setCaption(policyFileName_);
  QString message;
  message.sprintf("%s loaded", (const char*)filename);
  statusBar()->message(message, 3000);
  
  // update the view
  view_->setVerticalScrollValue(0);
  view_->setHorizontalScrollValue(0);
  view_->update();
}
void
PolicyEditorClass::slotSaveAs()
{
  // show file dialog
  QString filename = QFileDialog::getSaveFileName(0, "*.xml", this);
	
  if (filename.isNull()) return;
  if (filename.contains('.',false)==0) filename.append(".xml");
  QFile *qFile=new QFile(filename);
  if (qFile->exists())  {
    int rc = QMessageBox::warning(this, "PolicyEditor", "The file"
				+filename+" alread exists!\n"+"Do you want to overwrite the existing file?",
				  "&Yes", "&No", "&Cancel", 0,2);

    switch(rc)
    {
    case 0: 
      break;
    case 1:
      slotSaveAs();
      return;
    case 2:
      return;		 
    }
  }

  // save with selected file name
  document_.saveXML(filename);
  document_.setModified(false);
  policyFileName_=filename;

  // set new caption and status bar
  setCaption(filename);
  QString message;
  message.sprintf("%s saved", (const char*)filename);
  statusBar()->message(message, 3000);
}
Example #15
0
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
	, m_ui(new Ui::MainWindow)
	, m_inst(0)
	, m_aspect(-1)
	, m_preview(0)
	, m_previewDock(0)
	, m_posBoxLock(false)
	, m_accelBoxLock(false)
	, m_pos(0)
	, m_setPosLock(false)
{
	static_mainWindow = this;
	m_ui->setupUi(this);

	setWindowTitle("Teleprompter - DViz");
	setWindowIcon(QIcon(":/data/icon-d.png"));

	connect(m_ui->actionOpen_Text_File, SIGNAL(triggered()), this, SLOT(slotOpen()));
	connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSave()));
	connect(m_ui->actionSave_As, SIGNAL(triggered()), this, SLOT(slotSaveAs()));
	connect(m_ui->actionSetup_Outputs, SIGNAL(triggered()), this, SLOT(slotOutputSetup()));
	connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
	
	m_ui->playBtn->setIcon(QIcon(":/data/action-play.png"));
	connect(m_ui->playBtn, SIGNAL(clicked()), this, SLOT(slotTogglePlay()));
	
	connect(m_ui->posBox, SIGNAL(valueChanged(int)), this, SLOT(slotPosBoxChanged(int)));
	connect(m_ui->accelBox, SIGNAL(valueChanged(int)), this, SLOT(slotAccelBoxChanged(int)));
	connect(m_ui->accelResetBtn, SIGNAL(clicked()), this, SLOT(slotResetAccel()));
	m_ui->accelResetBtn->setIcon(QIcon(":/data/stock-undo.png"));
	m_ui->accelResetBtn->setToolTip("Reset to Normal Speed (CTRL+SHIFT+Z)");
	m_ui->accelResetBtn->setShortcut(QString(tr("CTRL+SHIFT+Z")));
	
	connect(&m_animTimer, SIGNAL(timeout()), this, SLOT(animate()));
	m_animTimer.setInterval(ANIMATE_BASE_MS);
	
	m_editor = new RichTextEditorWidget(m_ui->mainWidget);
	QLayoutItem * firstItem = m_ui->mainWidget->layout()->takeAt(0);
	m_ui->mainWidget->layout()->addWidget(m_editor);
	m_ui->mainWidget->layout()->addItem(firstItem);
	
	connect(m_editor, SIGNAL(contentsChanged()), this, SLOT(slotTextChanged()));
	
	m_ui->actionSetup_Outputs->setIcon(QIcon(":data/stock-preferences.png"));

	QSettings s;
	bool flag = s.value("teleprompter/firstrun",true).toBool();
	if(flag)
	{
		s.setValue("teleprompter/firstrun",false);
		slotOutputSetup();
	}
	
	AppSettings::setGridEnabled(false);
	

	Output * output = AppSettings::outputs().first();
	m_previewDock = new QDockWidget(QString(tr("%1 Preiew")).arg(output->name()), this);
	m_previewDock->setObjectName(output->name());

	m_preview = new OutputViewer(0,m_previewDock);
	m_previewDock->setWidget(m_preview);
	addDockWidget(Qt::BottomDockWidgetArea, m_previewDock);
	
	m_group = new SlideGroup();
	m_group->setGroupTitle("Group"); //AbstractItem::guessTitle(QFileInfo(fileName).baseName()));
		
	m_slide = new Slide();
	
	m_textbox = new TextBoxItem();
	m_textbox->setItemId(ItemFactory::nextId());
	m_textbox->setItemName(QString("TextBoxItem%1").arg(m_textbox->itemId()));



	AbstractVisualItem * bg = dynamic_cast<AbstractVisualItem*>(m_slide->background());

// 	qDebug() << "Slide "<<slideNum<<": [\n"<<tmpList.join("\n")<<"\n]";;

	bg->setFillType(AbstractVisualItem::Solid);
	bg->setFillBrush(Qt::black);


	// Outline pen for the text
	QPen pen = QPen(Qt::black,1.5);
	pen.setJoinStyle(Qt::MiterJoin);

	m_textbox->setPos(QPointF(0,0));
	m_textbox->setOutlinePen(pen);
	m_textbox->setOutlineEnabled(true);
	m_textbox->setFillBrush(Qt::white);
	m_textbox->setFillType(AbstractVisualItem::Solid);
	m_textbox->setShadowEnabled(false);
// 	m_textbox->setShadowBrush(Qt::red);
//  	m_textbox->setShadowBlurRadius(3);

	m_slide->addItem(m_textbox);
	
	m_slide->setSlideNumber(0);
	m_group->addSlide(m_slide);
	
	openOutput();
	
	m_inst->setSlideGroup(m_group);
	
	openTextFile("test.txt");
	
}
Example #16
0
ClsQSAList::ClsQSAList ( QWidget * parent, ClsQGroupStateManip* _clsQGroupStateManip, const char * name, WFlags f) : 
    QFrame ( parent, name, f ), clsQGroupStateManip(_clsQGroupStateManip)  {


    strFilename = "";///home/ulysses/STATESEQ";
    
    QVBoxLayout* layoutMain = new QVBoxLayout( this, 5, -1, "mainL");


/* ------------------------------- */
    qlbox = new QListBox( this );
    qlbox->setVScrollBarMode(QScrollView::AlwaysOn);
//    qlbox->setHScrollBarMode(QScrollView::AlwaysOff);
//    qlbox->setColumnMode ( QListBox::FitToWidth );
//    qlbox->setColumnMode ( QListBox::FixedNumber );
    qlbox->setFixedWidth ( 150 );
//    qlbox->setResizePolicy(QScrollView::AutoOne);

    qlbox->setSelectionMode(QListBox::Extended);

    cQListBoxToolTip = new GQListBoxToolTip(qlbox);
   
    connect(qlbox, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(slotDoubleClicked(QListBoxItem*)));
    layoutMain->addWidget(qlbox,10);
//    layoutMain->addMultiCellWidget(qlbox, 0, 0,0,3);


    QGridLayout* layoutButtons = new QGridLayout( 2, 6, -1, "layoutButtons");
    layoutButtons->setColStretch ( 0, 50 );

/* ------------------------------- */	
//--    QHBoxLayout* qlayoutEdit = new QHBoxLayout( layoutMain);

    QPushButton* qpbtnMoveUp = new QPushButton (QIconSet(QPixmap(up)), "",this);
    qpbtnMoveUp->setFlat(TRUE);
    connect(qpbtnMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUp()));
//--    qlayoutEdit->addWidget(qpbtnMoveUp);
    layoutButtons->addWidget(qpbtnMoveUp,0,1);
	
    QPushButton* qpbtnMoveDown = new QPushButton (QIconSet(QPixmap(down)), "",this);
    qpbtnMoveDown->setFlat(TRUE);
    connect(qpbtnMoveDown, SIGNAL(clicked()), this, SLOT(slotMoveDown()));
//--    qlayoutEdit->addWidget(qpbtnMoveDown);
    layoutButtons->addWidget(qpbtnMoveDown,0,2);

    QPushButton* qpbtnInvert = new QPushButton (QIconSet(QPixmap(invert2)), "",this);
    qpbtnInvert->setFlat(TRUE);
    connect(qpbtnInvert, SIGNAL(clicked()), this, SLOT(slotInvert()));
//--    qlayoutEdit->addWidget(qpbtnInvert);
    layoutButtons->addWidget(qpbtnInvert,0,3);

    QPushButton* qpbtnDelete = new QPushButton (QIconSet(QPixmap(trash2)), "",this);
    connect(qpbtnDelete, SIGNAL(clicked()), this, SLOT(slotDeleteItem()));
    qpbtnDelete->setFlat(TRUE);
//--    qlayoutEdit->addWidget(qpbtnDelete);
    layoutButtons->addWidget(qpbtnDelete,0,4);

/* ------------------------------- */
//--    QHBoxLayout* qlayout2 = new QHBoxLayout( layoutMain);

    QPushButton* qpbtnSave = new QPushButton (QIconSet(QPixmap(filesave)), "",this);
    connect(qpbtnSave, SIGNAL(clicked()), this, SLOT(slotSave()));
    qpbtnSave->setFlat(TRUE);
//--    qlayout2->addWidget(qpbtnSave);
    layoutButtons->addWidget(qpbtnSave,1,1);

    QPushButton* qpbtnSaveAs = new QPushButton (QIconSet(QPixmap(filesaveas)), "",this);
    connect(qpbtnSaveAs, SIGNAL(clicked()), this, SLOT(slotSaveAs()));
    qpbtnSaveAs->setFlat(TRUE);
//--    qlayout2->addWidget(qpbtnSaveAs);
    layoutButtons->addWidget(qpbtnSaveAs,1,2);

    QPushButton* qpbtnLoad = new QPushButton (QIconSet(QPixmap(fileopen)), "",this);
    connect(qpbtnLoad, SIGNAL(clicked()), this, SLOT(slotLoad()));
    qpbtnLoad->setFlat(TRUE);
//--    qlayout2->addWidget(qpbtnLoad);
    layoutButtons->addWidget(qpbtnLoad,1,4);
    
    layoutButtons->setColStretch ( 5, 50 );
    
    QToolTip::add(qpbtnMoveUp, "Move up");
    QToolTip::add(qpbtnMoveDown, "Move down");
    QToolTip::add(qpbtnInvert, "Invert order");
    QToolTip::add(qpbtnDelete, "Delete");
    QToolTip::add(qpbtnSave, "Save Sequence");
    QToolTip::add(qpbtnSaveAs, "Save Sequence under new name");
    QToolTip::add(qpbtnLoad, "Load Sequence");

    qpbtnMoveUp->setMaximumSize (QSize(22,22));
    qpbtnMoveDown->setMaximumSize (QSize(22,22));
    qpbtnInvert->setMaximumSize (QSize(22,22));
    qpbtnDelete->setMaximumSize (QSize(22,22));
    qpbtnSave->setMaximumSize (QSize(22,22));
    qpbtnSaveAs->setMaximumSize (QSize(22,22));
    qpbtnLoad->setMaximumSize (QSize(22,22));
    

//    layoutMain->setResizeMode (QLayout::Fixed);

    layoutMain->addLayout(layoutButtons);
//    this->setFixedWidth(this->sizeHint().width());
//    cout << "qlbox->visibleWidth (): " << qlbox->visibleWidth () << endl;
    iListViewVisibleWidth = qlbox->visibleWidth () + 5;//- qlbox->verticalScrollBar()->width();
}
Example #17
0
AbstractConfig::AbstractConfig(AbstractContent * content, QWidget * parent)
    : QDialog(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
    , m_closeButton(0)
    , m_okButton(0)
    , m_frame(FrameFactory::defaultPanelFrame())
{
   

	// WIDGET setup
	QWidget * widget = new QWidget(this);
// 	#if QT_VERSION < 0x040500
// 	widget->setAttribute(Qt::WA_NoSystemBackground, true);
// 	#else
// 	widget->setAttribute(Qt::WA_TranslucentBackground, true);
// 	#endif
	m_commonUi->setupUi(widget);
	
	populateFrameList();
	
	// select the frame
	quint32 frameClass = m_content->frameClass();
	if (frameClass != Frame::NoFrame) {
		for (int i = 0; i < m_commonUi->listWidget->count(); ++i) {
		QListWidgetItem * item = m_commonUi->listWidget->item(i);
		if (item->data(Qt::UserRole).toUInt() == frameClass) {
			item->setSelected(true);
			break;
		}
		}
	}
	
	// read other properties
	m_commonUi->reflection->setChecked(m_content->mirrorEnabled());
	
	connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
	connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
	connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
	connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
	connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(backgroundMe()));
	connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
	connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(deleteItem()), Qt::QueuedConnection);
	// autoconnection doesn't work because we don't do ->setupUi(this), so here we connect manually
	connect(m_commonUi->applyLooks, SIGNAL(clicked()), this, SLOT(on_applyLooks_clicked()));
	connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(on_newFrame_clicked()));
	connect(m_commonUi->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(on_listWidget_itemSelectionChanged()));
	connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(on_reflection_toggled(bool)));

//     // ITEM setup
//     setWidget(widget);
//     static qreal s_propZBase = 99999;
//     setZValue(s_propZBase++);

	QBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(widget);
// 	layout->addWidget(rotateSlider);
// 	layout->addLayout(controlLayout);
	
	m_okButton = new QPushButton(tr("Ok"));
	m_okButton->setDefault(true);
	connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
	
	m_closeButton = new QPushButton(tr("Cancel"));
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject()));
	
	setWindowTitle("Item Settings");
	
	QBoxLayout *controlLayout = new QHBoxLayout;
	controlLayout->addStretch(1);
	controlLayout->addWidget(m_closeButton);
	controlLayout->addWidget(m_okButton);
	layout->addLayout(controlLayout);
	
	
	
	setLayout(layout);
/*
#if QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif*/
}
Example #18
0
void KMMimePartTree::itemRightClicked( QListViewItem* item,
                                       const QPoint& point )
{
    // TODO: remove this member var?
    mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item );
    if ( 0 == mCurrentContextMenuItem ) {
        kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl;
    }
    else {
        kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl;

        QPopupMenu* popup = new QPopupMenu;
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) );
          popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) );
          popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) );
        }
        popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) );
        /*
         * FIXME mkae optional?
        popup->insertItem( i18n( "Save as &Encoded..." ), this,
                           SLOT( slotSaveAsEncoded() ) );
        */
        popup->insertItem( i18n( "Save All Attachments..." ), this,
                           SLOT( slotSaveAll() ) );
        // edit + delete only for attachments
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) );
          if ( GlobalSettings::self()->allowAttachmentDeletion() )
            popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ),
                               this, SLOT( slotDelete() ) );
          if ( GlobalSettings::self()->allowAttachmentEditing() )
            popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ),
                               this, SLOT( slotEdit() ) );
        }
        if ( mCurrentContextMenuItem->node()->nodeId() > 0 )
          popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) );
        popup->exec( point );
        delete popup;
        mCurrentContextMenuItem = 0;
    }
}
Example #19
0
// decoupled from resetActions in toplevel.cpp
// as resetActions simply uses the action groups
// specified in the ui.rc file
void KEBApp::createActions() {

    m_actionsImpl = new ActionsImpl(this, GlobalBookmarkManager::self()->model());

    connect(m_actionsImpl->testLinkHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelTestsEnabled(bool)));
    connect(m_actionsImpl->favIconHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelFavIconUpdatesEnabled(bool)));

    // save and quit should probably not be in the toplevel???
    (void) KStandardAction::quit(
        this, SLOT( close() ), actionCollection());
    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
    (void) KStandardAction::configureToolbars(
        this, SLOT( slotConfigureToolbars() ), actionCollection());

    if (m_browser) {
        (void) KStandardAction::open(
            m_actionsImpl, SLOT( slotLoad() ), actionCollection());
        (void) KStandardAction::saveAs(
            m_actionsImpl, SLOT( slotSaveAs() ), actionCollection());
    }

    (void) KStandardAction::cut(m_actionsImpl, SLOT( slotCut() ), actionCollection());
    (void) KStandardAction::copy(m_actionsImpl, SLOT( slotCopy() ), actionCollection());
    (void) KStandardAction::paste(m_actionsImpl, SLOT( slotPaste() ), actionCollection());

    // actions
    KAction* m_actionsImplDelete = actionCollection()->addAction("delete");
    m_actionsImplDelete->setIcon(KIcon("edit-delete"));
    m_actionsImplDelete->setText(i18n("&Delete"));
    m_actionsImplDelete->setShortcut(Qt::Key_Delete);
    connect(m_actionsImplDelete, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotDelete() ));

    KAction* m_actionsImplRename = actionCollection()->addAction("rename");
    m_actionsImplRename->setIcon(KIcon("edit-rename"));
    m_actionsImplRename->setText(i18n("Rename"));
    m_actionsImplRename->setShortcut(Qt::Key_F2);
    connect(m_actionsImplRename, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRename() ));

    KAction* m_actionsImplChangeURL = actionCollection()->addAction("changeurl");
    m_actionsImplChangeURL->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeURL->setText(i18n("C&hange Location"));
    m_actionsImplChangeURL->setShortcut(Qt::Key_F3);
    connect(m_actionsImplChangeURL, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeURL() ));

    KAction* m_actionsImplChangeComment = actionCollection()->addAction("changecomment");
    m_actionsImplChangeComment->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeComment->setText(i18n("C&hange Comment"));
    m_actionsImplChangeComment->setShortcut(Qt::Key_F4);
    connect(m_actionsImplChangeComment, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeComment() ));

    KAction* m_actionsImplChangeIcon = actionCollection()->addAction("changeicon");
    m_actionsImplChangeIcon->setIcon(KIcon("preferences-desktop-icons"));
    m_actionsImplChangeIcon->setText(i18n("Chan&ge Icon..."));
    connect(m_actionsImplChangeIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeIcon() ));

    KAction* m_actionsImplUpdateFavIcon = actionCollection()->addAction("updatefavicon");
    m_actionsImplUpdateFavIcon->setText(i18n("Update Favicon"));
    connect(m_actionsImplUpdateFavIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateFavIcon() ));

    KAction* m_actionsImplRecursiveSort = actionCollection()->addAction("recursivesort");
    m_actionsImplRecursiveSort->setText(i18n("Recursive Sort"));
    connect(m_actionsImplRecursiveSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRecursiveSort() ));

    KAction* m_actionsImplNewFolder = actionCollection()->addAction("newfolder");
    m_actionsImplNewFolder->setIcon(KIcon("folder-new"));
    m_actionsImplNewFolder->setText(i18n("&New Folder..."));
    m_actionsImplNewFolder->setShortcut(Qt::CTRL+Qt::Key_N);
    connect(m_actionsImplNewFolder, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewFolder() ));

    KAction* m_actionsImplNewBookmark = actionCollection()->addAction("newbookmark");
    m_actionsImplNewBookmark->setIcon(KIcon("bookmark-new"));
    m_actionsImplNewBookmark->setText(i18n("&New Bookmark"));
    connect(m_actionsImplNewBookmark, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewBookmark() ));

    KAction* m_actionsImplInsertSeparator = actionCollection()->addAction("insertseparator");
    m_actionsImplInsertSeparator->setText(i18n("&Insert Separator"));
    m_actionsImplInsertSeparator->setShortcut(Qt::CTRL+Qt::Key_I);
    connect(m_actionsImplInsertSeparator, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotInsertSeparator() ));

    KAction* m_actionsImplSort = actionCollection()->addAction("sort");
    m_actionsImplSort->setText(i18n("&Sort Alphabetically"));
    connect(m_actionsImplSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSort() ));

    KAction* m_actionsImplSetAsToolbar = actionCollection()->addAction("setastoolbar");
    m_actionsImplSetAsToolbar->setIcon(KIcon("bookmark-toolbar"));
    m_actionsImplSetAsToolbar->setText(i18n("Set as T&oolbar Folder"));
    connect(m_actionsImplSetAsToolbar, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSetAsToolbar() ));

    KAction* m_actionsImplExpandAll = actionCollection()->addAction("expandall");
    m_actionsImplExpandAll->setText(i18n("&Expand All Folders"));
    connect(m_actionsImplExpandAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExpandAll() ));

    KAction* m_actionsImplCollapseAll = actionCollection()->addAction("collapseall");
    m_actionsImplCollapseAll->setText(i18n("Collapse &All Folders"));
    connect(m_actionsImplCollapseAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCollapseAll() ));

    KAction* m_actionsImplOpenLink = actionCollection()->addAction("openlink");
    m_actionsImplOpenLink->setIcon(KIcon("document-open"));
    m_actionsImplOpenLink->setText(i18n("&Open in Konqueror"));
    connect(m_actionsImplOpenLink, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotOpenLink() ));

    KAction* m_actionsImplTestSelection = actionCollection()->addAction("testlink");
    m_actionsImplTestSelection->setIcon(KIcon("bookmarks"));
    m_actionsImplTestSelection->setText(i18n("Check &Status"));
    connect(m_actionsImplTestSelection, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestSelection() ));

    KAction* m_actionsImplTestAll = actionCollection()->addAction("testall");
    m_actionsImplTestAll->setText(i18n("Check Status: &All"));
    connect(m_actionsImplTestAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestAll() ));

    KAction* m_actionsImplUpdateAllFavIcons = actionCollection()->addAction("updateallfavicons");
    m_actionsImplUpdateAllFavIcons->setText(i18n("Update All &Favicons"));
    connect(m_actionsImplUpdateAllFavIcons, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateAllFavIcons() ));

    KAction* m_actionsImplCancelAllTests = actionCollection()->addAction("canceltests");
    m_actionsImplCancelAllTests->setText(i18n("Cancel &Checks"));
    connect(m_actionsImplCancelAllTests, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelAllTests() ));

    KAction* m_actionsImplCancelFavIconUpdates = actionCollection()->addAction("cancelfaviconupdates");
    m_actionsImplCancelFavIconUpdates->setText(i18n("Cancel &Favicon Updates"));
    connect(m_actionsImplCancelFavIconUpdates, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelFavIconUpdates() ));

    KAction* m_actionsImplImportNS = actionCollection()->addAction("importNS");
    m_actionsImplImportNS->setObjectName( QLatin1String("NS" ));
    m_actionsImplImportNS->setIcon(KIcon("netscape"));
    m_actionsImplImportNS->setText(i18n("Import &Netscape Bookmarks..."));
    connect(m_actionsImplImportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportOpera = actionCollection()->addAction("importOpera");
    m_actionsImplImportOpera->setObjectName( QLatin1String("Opera" ));
    m_actionsImplImportOpera->setIcon(KIcon("opera"));
    m_actionsImplImportOpera->setText(i18n("Import &Opera Bookmarks..."));
    connect(m_actionsImplImportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
/*
    KAction* m_actionsImplImportCrashes = actionCollection()->addAction("importCrashes");
    m_actionsImplImportCrashes->setObjectName( QLatin1String("Crashes" ));
    m_actionsImplImportCrashes->setText(i18n("Import All &Crash Sessions as Bookmarks..."));
    connect(m_actionsImplImportCrashes, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
*/
    KAction* m_actionsImplImportGaleon = actionCollection()->addAction("importGaleon");
    m_actionsImplImportGaleon->setObjectName( QLatin1String("Galeon" ));
    m_actionsImplImportGaleon->setText(i18n("Import &Galeon Bookmarks..."));
    connect(m_actionsImplImportGaleon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportKDE2 = actionCollection()->addAction("importKDE2");
    m_actionsImplImportKDE2->setObjectName( QLatin1String("KDE2" ));
    m_actionsImplImportKDE2->setIcon(KIcon("kde"));
    m_actionsImplImportKDE2->setText(i18n("Import &KDE 2 or KDE 3 Bookmarks..."));

    connect(m_actionsImplImportKDE2, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportIE = actionCollection()->addAction("importIE");
    m_actionsImplImportIE->setObjectName( QLatin1String("IE" ));
    m_actionsImplImportIE->setText(i18n("Import &Internet Explorer Bookmarks..."));
    connect(m_actionsImplImportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportMoz = actionCollection()->addAction("importMoz");
    m_actionsImplImportMoz->setObjectName( QLatin1String("Moz" ));
    m_actionsImplImportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplImportMoz->setText(i18n("Import &Mozilla Bookmarks..."));
    connect(m_actionsImplImportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplExportNS = actionCollection()->addAction("exportNS");
    m_actionsImplExportNS->setIcon(KIcon("netscape"));
    m_actionsImplExportNS->setText(i18n("Export &Netscape Bookmarks"));
    connect(m_actionsImplExportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportNS() ));

    KAction* m_actionsImplExportOpera = actionCollection()->addAction("exportOpera");
    m_actionsImplExportOpera->setIcon(KIcon("opera"));
    m_actionsImplExportOpera->setText(i18n("Export &Opera Bookmarks..."));
    connect(m_actionsImplExportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportOpera() ));

    KAction* m_actionsImplExportHTML = actionCollection()->addAction("exportHTML");
    m_actionsImplExportHTML->setIcon(KIcon("text-html"));
    m_actionsImplExportHTML->setText(i18n("Export &HTML Bookmarks..."));
    connect(m_actionsImplExportHTML, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportHTML() ));

    KAction* m_actionsImplExportIE = actionCollection()->addAction("exportIE");
    m_actionsImplExportIE->setText(i18n("Export &Internet Explorer Bookmarks..."));
    connect(m_actionsImplExportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportIE() ));

    KAction* m_actionsImplExportMoz = actionCollection()->addAction("exportMoz");
    m_actionsImplExportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplExportMoz->setText(i18n("Export &Mozilla Bookmarks..."));
    connect(m_actionsImplExportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportMoz() ));
}
Example #20
0
AbstractConfig::AbstractConfig(AbstractContent * content, AbstractConfig_PARENT * parent)
    : AbstractConfig_TYPE(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
#if !defined(MOBILE_UI)
    , m_closeButton(0)
    , m_okButton(0)
#endif
    , m_frame(FrameFactory::defaultPanelFrame())
{
#if !defined(MOBILE_UI)
    // close button
    m_closeButton = new StyledButtonItem(tr(" x "), font(), this);//this, ":/data/button-close.png", ":/data/button-close-hovered.png", ":/data/button-close-pressed.png");
    connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(requestClose()));

    // WIDGET setup (populate contents and set base palette (only) to transparent)
    QWidget * widget = new QWidget();
    m_commonUi->setupUi(widget);
    QPalette pal;
    QColor oldColor = pal.window().color();
    pal.setBrush(QPalette::Window, Qt::transparent);
    widget->setPalette(pal);
    pal.setBrush(QPalette::Window, oldColor);
    m_commonUi->tab->setPalette(pal);
#else
    m_commonUi->setupUi(this);
#endif

    populateFrameList();

    // select the frame
    quint32 frameClass = m_content->frameClass();
    if (frameClass != Frame::NoFrame) {
        for (int i = 0; i < m_commonUi->framesList->count(); ++i) {
            QListWidgetItem * item = m_commonUi->framesList->item(i);
            if (item->data(Qt::UserRole).toUInt() == frameClass) {
                item->setSelected(true);
                break;
            }
        }
    }

    // read other properties
    m_commonUi->reflection->setChecked(m_content->mirrored());
    m_commonUi->contentLocked->setChecked(m_content->locked());
    m_commonUi->fixedPosition->setChecked(m_content->fixedPosition());
    m_commonUi->fixedRotation->setChecked(m_content->fixedRotation());
    m_commonUi->fixedPerspective->setChecked(m_content->fixedPerspective());

    connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
    connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
    connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
    connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
    connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
    connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(requestBackgrounding()));
    connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(requestRemoval()));

    connect(m_commonUi->contentLocked, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetLocked(int)));
    connect(m_commonUi->fixedPosition, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPosition(int)));
    connect(m_commonUi->fixedRotation, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedRotation(int)));
    connect(m_commonUi->fixedPerspective, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPerspective(int)));

    connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(slotAddFrame()));
    connect(m_commonUi->removeFrame, SIGNAL(clicked()), this, SLOT(slotRemoveFrame()));
    connect(m_commonUi->lookApplyAll, SIGNAL(clicked()), this, SLOT(slotLookApplyAll()));
    connect(m_commonUi->framesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotFrameSelectionChanged()));
    connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(slotReflectionToggled(bool)));

    // ITEM setup
#if !defined(MOBILE_UI)
    setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
    setWidget(widget);
    static qreal s_propZBase = 99999;
    setZValue(s_propZBase++);
#endif

#if !defined(MOBILE_UI) && QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif
}
Example #21
0
ClsQSAList::ClsQSAList ( QWidget * parent, ClsQGroupStateManip* _clsQGroupStateManip, const char * name, Qt::WindowFlags f) :
    QFrame ( parent, name, f ), clsQGroupStateManip(_clsQGroupStateManip)  {


    strFilename = "";

    QVBoxLayout* layoutMain = new QVBoxLayout( this, 5, -1, "mainL");


    /* ------------------------------- */
    qlbox = new QListWidget ( this );
    qlbox->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn );
//    qlbox->setViewMode(QListView::IconMode);
    qlbox->setIconSize(QSize(60, 60));
    qlbox->setSpacing(10);


    qlbox->setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(qlbox, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotDoubleClicked(const QModelIndex &)));
    layoutMain->addWidget(qlbox,10);


    QGridLayout* layoutButtons = new QGridLayout( 2, 6, -1, "layoutButtons");
    layoutButtons->setColStretch ( 0, 50 );

    /* ------------------------------- */

    QPushButton* qpbtnMoveUp = new QPushButton (QIconSet(QPixmap(up)), "",this);
    qpbtnMoveUp->setFlat(TRUE);
    connect(qpbtnMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUp()));
    layoutButtons->addWidget(qpbtnMoveUp,0,1);

    QPushButton* qpbtnMoveDown = new QPushButton (QIconSet(QPixmap(down)), "",this);
    qpbtnMoveDown->setFlat(TRUE);
    connect(qpbtnMoveDown, SIGNAL(clicked()), this, SLOT(slotMoveDown()));
    layoutButtons->addWidget(qpbtnMoveDown,0,2);

    QPushButton* qpbtnInvert = new QPushButton (QIconSet(QPixmap(invert2)), "",this);
    qpbtnInvert->setFlat(TRUE);
    connect(qpbtnInvert, SIGNAL(clicked()), this, SLOT(slotInvert()));
    layoutButtons->addWidget(qpbtnInvert,0,3);

    QPushButton* qpbtnDelete = new QPushButton (QIconSet(QPixmap(trash2)), "",this);
    connect(qpbtnDelete, SIGNAL(clicked()), this, SLOT(slotDeleteItem()));
    qpbtnDelete->setFlat(TRUE);
    layoutButtons->addWidget(qpbtnDelete,0,4);

    /* ------------------------------- */

    QPushButton* qpbtnSave = new QPushButton (QIconSet(QPixmap(fileSave_xpm)), "",this);
    connect(qpbtnSave, SIGNAL(clicked()), this, SLOT(slotSave()));
    qpbtnSave->setFlat(TRUE);
    layoutButtons->addWidget(qpbtnSave,1,1);

    QPushButton* qpbtnSaveAs = new QPushButton (QIconSet(QPixmap(fileSaveAs_xpm)), "",this);
    connect(qpbtnSaveAs, SIGNAL(clicked()), this, SLOT(slotSaveAs()));
    qpbtnSaveAs->setFlat(TRUE);
    layoutButtons->addWidget(qpbtnSaveAs,1,2);

    QPushButton* qpbtnLoad = new QPushButton (QIconSet(QPixmap(fileOpen_xpm)), "",this);
    connect(qpbtnLoad, SIGNAL(clicked()), this, SLOT(slotLoad()));
    qpbtnLoad->setFlat(TRUE);
    layoutButtons->addWidget(qpbtnLoad,1,4);

    layoutButtons->setColStretch ( 5, 50 );

    QToolTip::add(qpbtnMoveUp, "Move up");
    QToolTip::add(qpbtnMoveDown, "Move down");
    QToolTip::add(qpbtnInvert, "Invert order");
    QToolTip::add(qpbtnDelete, "Delete");
    QToolTip::add(qpbtnSave, "Save Sequence");
    QToolTip::add(qpbtnSaveAs, "Save Sequence under new name");
    QToolTip::add(qpbtnLoad, "Load Sequence");

    qpbtnMoveUp->setMaximumSize (QSize(22,22));
    qpbtnMoveDown->setMaximumSize (QSize(22,22));
    qpbtnInvert->setMaximumSize (QSize(22,22));
    qpbtnDelete->setMaximumSize (QSize(22,22));
    qpbtnSave->setMaximumSize (QSize(22,22));
    qpbtnSaveAs->setMaximumSize (QSize(22,22));
    qpbtnLoad->setMaximumSize (QSize(22,22));

    layoutMain->addLayout(layoutButtons);
}
Example #22
0
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
  : DCOPObject("interface"), 
    KDialogBase(parent, name, true, QString::null, Help|User1, User1, 
    true, KStdGuiItem::quit() )
{
    grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
    grabber->move( -1000, -1000 );
    grabber->installEventFilter( this );

    KStartupInfo::appStarted();

    QVBox *vbox = makeVBoxMainWidget();
    mainWidget = new KSnapshotWidget( vbox, "mainWidget" );

    connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));

    connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
    connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) );
    connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );
    connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) );

    grabber->show();
    grabber->grabMouse( waitCursor );

    if ( !grabCurrent )
	snapshot = QPixmap::grabWindow( qt_xrootwin() );
    else {
	mainWidget->setMode( WindowUnderCursor );
	mainWidget->setIncludeDecorations( true );
	performGrab();
    }

    updatePreview();
    grabber->releaseMouse();
    grabber->hide();

    KConfig *conf=KGlobal::config();
    conf->setGroup("GENERAL");
    mainWidget->setDelay(conf->readNumEntry("delay",0));
    mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
    mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));
    filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));

    // Make sure the name is not already being used
    while(KIO::NetAccess::exists( filename, false, this )) {
	autoincFilename();
    }

    connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );
    connect( &updateTimer, SIGNAL( timeout() ), this, SLOT(  updatePreview() ) );
    QTimer::singleShot( 0, this, SLOT( updateCaption() ) );

    KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);

    QPushButton *helpButton = actionButton( Help );
    helpButton->setPopup(helpMenu->menu());

    KAccel* accel = new KAccel(this);
    accel->insert(KStdAccel::Quit, kapp, SLOT(quit()));
    accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user without showing the file dialog."),
		   CTRL+SHIFT+Key_S, this, SLOT(slotSave()));
    accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs()));
//    accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs()));
    accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user."),
		   CTRL+Key_A, this, SLOT(slotSaveAs()));
    accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
    accel->insert(KStdAccel::New, this, SLOT(slotGrab()));
    accel->insert(KStdAccel::Copy, this, SLOT(slotCopy()));

    accel->insert( "Quit2", Key_Q, this, SLOT(slotSave()));
    accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs()));
    accel->insert( "Print2", Key_P, this, SLOT(slotPrint()));
    accel->insert( "New2", Key_N, this, SLOT(slotGrab()));
    accel->insert( "New3", Key_Space, this, SLOT(slotGrab()));

    setEscapeButton( User1 );
    connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );

    mainWidget->btnNew->setFocus();
}
PolicyEditorClass::PolicyEditorClass(int argc, char** argv, Miro::Client& _client) :
  QMainWindow(NULL, "PolicyEditor"),
  client_(_client),
  miroRoot_(getenv("MIRO_ROOT")),
  policyFileName_("_"),
  robot_(getenv("HOST"))
{
  resize(600, 500);

  //-----------//
  // init menu //
  //-----------//

  // file menu
  QPopupMenu* MenuFile = new QPopupMenu();
  menuBar()->insertItem("&File", MenuFile);

  MenuFile->insertItem("New",         this, SLOT(slotNew()));
  MenuFile->insertItem("Open ...",    this, SLOT(slotLoad()));
  MenuFile->insertItem("Save",        this, SLOT(slotSave())); 
  MenuFile->insertItem("Save As ...", this, SLOT(slotSaveAs()));
  MenuFile->insertSeparator();
  MenuFile->insertItem("Send to ...", this, SLOT(slotSendTo()));
  MenuFile->insertSeparator();
  MenuFile->insertItem("Quit",        this, SLOT(quit()));

  // options menue
  QPopupMenu* MenuOptions = new QPopupMenu();
  menuBar()->insertItem("&Options", MenuOptions);

  //MenuOptions->insertItem("&Configuration ..",  this, SLOT(slotConfiguration()));
  //  MenuEdit->insertItem("Add Basic Behaviour ..", this, NULL);
  MenuOptions->insertItem("&Behaviour-Description-Filename..", this, SLOT(getBehaviourDescriptionFileName()));
  MenuOptions->insertItem("&Load Behaviour-Description-Filename..", this, SLOT(setBehaviourDescriptionFileName()));


  // help menu
  QPopupMenu* MenuHelp = new QPopupMenu();
  menuBar()->insertSeparator();
  menuBar()->insertItem("&Help", MenuHelp);
  
  MenuHelp->insertItem("About PolicyEditor", this, SLOT(slotAbout()));
  MenuHelp->insertItem("About Qt",           this, SLOT(slotAboutQt()));
  

  //---------------//
  // init document //
  //---------------//

  // load database file
  document_.loadDatabase("behaviours.dat");
  document_.setModified(false);

  // if given -> load policy file
  if (argc > 1) {
    document_.loadXML(argv[1]);
    policyFileName_=argv[1];
    statusBar()->message(policyFileName_+" geladen!", 1000);
  }
  else {
    document_.loadXML(miroRoot_ + "/etc/PolicyEditorNewFile.xml");
    document_.setModified(false);

    setCaption("new document");
    policyFileName_="_";
    QString message;
    message.sprintf("New document opend");
    statusBar()->message(message, 3000);
  }

  //-----------//
  // init view //
  //-----------//
  view_ = new PolicyViewClass(this, document_);
  setCentralWidget(view_);

#ifdef ASDF
  // load pattern database //
  QMessageBox::information(this, "Policy Editor", "Hallo,\n\nfirst, you have to select your\nbehaviour database ...");
  QString filename = QFileDialog::getOpenFileName(0, "*.dat", this);
  if (filename.isNull()) 
  { 
    std::cout << "database must be chosen !" << std::endl; 
    exit(0); 
  }
  document_.LoadDatabase(string(filename));
#endif
 
}
Example #24
0
void ndManager::setupActions()
{
    //File Menu
    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));

    mNewAction = fileMenu->addAction(tr("&New..."));
    mNewAction->setIcon(QPixmap(":/shared-icons/document-new"));
    mNewAction->setShortcut(QKeySequence::New);
    connect(mNewAction, SIGNAL(triggered()), this, SLOT(slotNewFile()));


    mOpenAction = fileMenu->addAction(tr("&Open..."));
    mOpenAction->setIcon(QPixmap(":/shared-icons/document-open"));
    mOpenAction->setShortcut(QKeySequence::Open);
    connect(mOpenAction, SIGNAL(triggered()), this, SLOT(slotFileOpen()));

    mFileOpenRecent = new QRecentFileAction(this);
    QSettings settings;
    mFileOpenRecent->setRecentFiles(settings.value(QLatin1String("Recent Files"),QStringList()).toStringList());
    fileMenu->addAction(mFileOpenRecent);
    connect(mFileOpenRecent, SIGNAL(recentFileSelected(QString)), this, SLOT(slotFileOpenRecent(QString)));
    connect(mFileOpenRecent, SIGNAL(recentFileListChanged()), this, SLOT(slotSaveRecentFiles()));

    mUseTemplateAction = fileMenu->addAction(tr("Use &Template..."));
    connect(mUseTemplateAction, SIGNAL(triggered()), this, SLOT(slotImport()));

    fileMenu->addSeparator();
    mSaveAction = fileMenu->addAction(tr("Save..."));
    mSaveAction->setIcon(QPixmap(":/shared-icons/document-save"));
    mSaveAction->setShortcut(QKeySequence::Save);
    connect(mSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));

    mSaveAsAction = fileMenu->addAction(tr("&Save As..."));
    mSaveAsAction->setIcon(QPixmap(":/shared-icons/document-save-as"));
    mSaveAsAction->setShortcut(QKeySequence::SaveAs);
    connect(mSaveAsAction, SIGNAL(triggered()), this, SLOT(slotSaveAs()));


    mSaveAsDefaultAction = fileMenu->addAction(tr("Save as &Default"));
    connect(mSaveAsDefaultAction, SIGNAL(triggered()), this, SLOT(slotSaveDefault()));

    mReloadAction = fileMenu->addAction(tr("&Reload"));
    mReloadAction->setShortcut(Qt::Key_F5);
    connect(mReloadAction, SIGNAL(triggered()), this, SLOT(slotReload()));


    fileMenu->addSeparator();


    mCloseAction = fileMenu->addAction(tr("Close"));
    mCloseAction->setIcon(QPixmap(":/shared-icons/document-close"));
    mCloseAction->setShortcut(QKeySequence::Close);
    connect(mCloseAction, SIGNAL(triggered()), this, SLOT(slotFileClose()));


    fileMenu->addSeparator();

    mQuitAction = fileMenu->addAction(tr("Quit"));
    mQuitAction->setIcon(QPixmap(":/shared-icons/window-close"));
    mQuitAction->setShortcut(QKeySequence::Quit);
    connect(mQuitAction, SIGNAL(triggered()), this, SLOT(close()));


    QMenu *actionMenu = menuBar()->addMenu(tr("&Actions"));
    mQueryAction = actionMenu->addAction(tr("&Query"));
#ifndef Q_OS_UNIX
    mQueryAction->setEnabled(false);
#endif
    connect(mQueryAction, SIGNAL(triggered()), this, SLOT(slotQuery()));

    //mProcessingManager = actionMenu->addAction(tr("Show Processing Manager"));

    QMenu *settingsMenu = menuBar()->addMenu(tr("&Settings"));

    //Settings
    mExpertMode = settingsMenu->addAction(tr("&Expert Mode"));
    mExpertMode->setCheckable(true);
    connect(mExpertMode, SIGNAL(triggered(bool)), this, SLOT(slotExpertMode()));
    settingsMenu->addSeparator();

    settings.beginGroup("General");
    if ( settings.contains("expertMode")) mExpertMode->setChecked(settings.value("expertMode").toBool());
	 else mExpertMode->setChecked(true);
    settings.endGroup();

    viewMainToolBar = settingsMenu->addAction(tr("Show Main Toolbar"));

    viewMainToolBar->setCheckable(true);
    viewMainToolBar->setChecked(true);
    connect(viewMainToolBar,SIGNAL(triggered()), this,SLOT(slotViewMainToolBar()));


    viewStatusBar = settingsMenu->addAction(tr("Show StatusBar"));
    viewStatusBar->setCheckable(true);
    connect(viewStatusBar,SIGNAL(triggered()), this,SLOT(slotViewStatusBar()));
    viewStatusBar->setChecked(true);

    QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
    QAction *handbook = helpMenu->addAction(tr("Handbook"));
    handbook->setShortcut(Qt::Key_F1);
    connect(handbook,SIGNAL(triggered()), this,SLOT(slotHanbook()));

    QAction *about = helpMenu->addAction(tr("About"));
    connect(about,SIGNAL(triggered()), this,SLOT(slotAbout()));

    mMainToolBar->addAction(mNewAction);
    mMainToolBar->addAction(mOpenAction);
    mMainToolBar->addAction(mSaveAction);

    resize(800,600);
}