Exemplo n.º 1
0
bool BrailleMusicEditor::fileSave() {
  if (fileName.isEmpty()) return fileSaveAs();
  if (fileName.startsWith(QStringLiteral(":/"))) return fileSaveAs();

  QTextDocumentWriter writer(fileName);
  bool success = writer.write(textEdit->document());
  if (success) textEdit->document()->setModified(false);
  return success;
}
Exemplo n.º 2
0
bool CodeEditor::fileSave()			// 保存缓存区到文件。
{
	QFile file(getFilePath());
	if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
		QMessageBox::StandardButton ret;
		ret = QMessageBox::question(this, tr("无法保存该文件"),
									tr("是否选择另存为该文件: %1",
									   "点击【OK】另存为, 点击【Cancel】放弃该文件的修改").arg(getFilePath()),
									QMessageBox::Ok | QMessageBox::Cancel,
									QMessageBox::Ok);
		
		switch (ret) {
		case QMessageBox::Ok:
			while(!fileSaveAs());
			return true;
		case QMessageBox::Cancel:
			return false;
		default:
			return false;
		}
	}
	
	QTextStream out(&file);
	out << plainEditor->toPlainText();
	file.close();
	
	plainEditor->document()->setModified(false);
	return true;	
} // fileSave
Exemplo n.º 3
0
void CSVAtlasWindow::fileSave()
{
  if(_filename.isEmpty())
  {
    fileSaveAs();
    if(_filename.isEmpty())
      return;
  }
  sMapChanged(_map->currentIndex());

  QDomDocument doc = QDomDocument("openCSVAtlasDef");
  doc.appendChild(_atlas->createElement(doc));

  QFile file(_filename);
  if(file.open(QIODevice::WriteOnly))
  {
    QTextStream ts(&file);
    ts << doc.toString();
    file.close();
  }
  else
    _msghandler->message(QtWarningMsg, tr("Error Opening File"),
                         tr("<p>Could not open the file %1 for writing: %2")
                           .arg(_filename, file.errorString()),
                         QUrl::fromLocalFile(_filename), QSourceLocation());
}
Exemplo n.º 4
0
bool TextEdit::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: fileNew(); break;
    case 1: fileOpen(); break;
    case 2: fileSave(); break;
    case 3: fileSaveAs(); break;
    case 4: filePrint(); break;
    case 5: fileClose(); break;
    case 6: fileExit(); break;
    case 7: editUndo(); break;
    case 8: editRedo(); break;
    case 9: editCut(); break;
    case 10: editCopy(); break;
    case 11: editPaste(); break;
    case 12: textBold(); break;
    case 13: textUnderline(); break;
    case 14: textItalic(); break;
    case 15: textFamily((const QString&)static_QUType_QString.get(_o+1)); break;
    case 16: textSize((const QString&)static_QUType_QString.get(_o+1)); break;
    case 17: textColor(); break;
    case 18: textAlign((QAction*)static_QUType_ptr.get(_o+1)); break;
    case 19: fontChanged((const QFont&)*((const QFont*)static_QUType_ptr.get(_o+1))); break;
    case 20: colorChanged((const QColor&)*((const QColor*)static_QUType_ptr.get(_o+1))); break;
    case 21: alignmentChanged((int)static_QUType_int.get(_o+1)); break;
    case 22: editorChanged((QWidget*)static_QUType_ptr.get(_o+1)); break;
    default:
	return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 5
0
void TextEdit::setupFileActions()
{
    QToolBar *tb = new QToolBar( this );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&File" ), menu );

    QAction *a;
    a = new QAction( tr( "New" ), QPixmap( "textdrawing/filenew.png" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Open" ), QPixmap( "textdrawing/fileopen.png" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Save" ), QPixmap( "textdrawing/filesave.png" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Save As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Print" ), QPixmap( "textdrawing/print.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Close" ), QPixmap(), tr( "&Close" ), 0, this, "fileClose" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) );
    a->addTo( menu );
}
Exemplo n.º 6
0
void Kandy::setupActions()
{
    KStdAction::open(this, SLOT(fileOpen()), actionCollection());
    KStdAction::save(this, SLOT(fileSave()), actionCollection());
    KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
    //  KStdAction::print(this, SLOT(filePrint()), actionCollection());
    KStdAction::quit(this, SLOT(close()), actionCollection());

    createStandardStatusBarAction();
    setStandardToolBarMenuEnabled(true);

    KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
    KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
    KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    new KAction(i18n("Mobile GUI"), 0, this, SLOT(showMobileGui()),
                actionCollection(), "show_mobilegui");

    mConnectAction = new KAction(i18n("Connect"), 0, this, SLOT(modemConnect()),
                                 actionCollection(), "modem_connect");
    mDisconnectAction = new KAction(i18n("Disconnect"), 0, this,
                                    SLOT(modemDisconnect()), actionCollection(),
                                    "modem_disconnect");

    createGUI();
}
Exemplo n.º 7
0
void kerp::setupActions()
{
    KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
    KStdAction::open(this, SLOT(fileOpen()), actionCollection());
    KStdAction::save(this, SLOT(fileSave()), actionCollection());
    KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
    KStdAction::print(this, SLOT(filePrint()), actionCollection());
    KStdAction::quit(kapp, SLOT(quit()), actionCollection());

    m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection());
    m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection());

    KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
    KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
    KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    // this doesn't do anything useful.  it's just here to illustrate
    // how to insert a custom menu and menu item
    KAction *city_action = new KAction(i18n("&City/province"), 0,
                                  this, SLOT(city_action()),
                                  actionCollection(), "city_action");
    KAction *invoice_action=new KAction(i18n("&Invoice"),0,
    					this,SLOT(invoice_action()),
					actionCollection(),"invoice_action");

    KAction * partner_action = new KAction(i18n("&Partner"),0,
    									this,SLOT( partner_action()),
    									actionCollection(),"partner_action");

    createGUI();
}
Exemplo n.º 8
0
/** Create an APrivateWindow object
  \param appName The name of the application
  \param orgName The organisation name
  \param domainName The domain of the organisation
  \param version The version of the application
  \param parent The parent of the main window ( usually 0 )
  */
APrivateWindow::APrivateWindow(QIcon icon, QString appName, bool userPluginInterface, bool needsCreateMenu, QString orgName, QString domainName, QString version, QWidget *parent )
        : QMainWindow( parent ), _document( appName, orgName, domainName, version ),
        _plugins( new APrivatePluginDialog( this, userPluginInterface ) ), ui(new Ui::appBase), _log( 0 ),
        _centralDock( 0 ), _currentContextDock( 0 ), _sdk( this )
    {
    // setup global application data
    QCoreApplication::setApplicationName( appName );
    QCoreApplication::setOrganizationName( orgName );
    QCoreApplication::setOrganizationDomain( domainName );
    QCoreApplication::setApplicationVersion( version );

    // icon
    QApplication::setWindowIcon( icon );

    // setup form based UI
    ui->setupUi(this);

    if( !needsCreateMenu )
        {
        delete ui->menuCreate;
        ui->menuCreate = 0;
        }

    // setup the workspace manager
    _workspace = new APrivateWorkspaceDialog( this );

    // we like dock nesting
    setDockNestingEnabled( TRUE );

    // our basic log
    _log = new APrivateLogDock;
    addDockedItem( "Log", _log );

    // setup plugins
    _plugins->ensureLoaded();

    // developing code
#if 0
    QByteArray state( _plugins->saveState() );
    _plugins->restoreState( state );
#endif


    // connect UI to this class
    connect( ui->actionNew, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
    connect( ui->actionOpen, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
    connect( ui->actionSave, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
    connect( ui->actionSave_As, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) );
    connect( ui->actionExit, SIGNAL( triggered() ), this, SLOT( close() ) );
    connect( ui->menuFile, SIGNAL( aboutToShow() ), this, SLOT( rebuildFileMenu() ) );
    connect( ui->menuWindow, SIGNAL( aboutToShow() ), this, SLOT( rebuildWindowMenu() ) );
    connect( ui->menuWindow, SIGNAL( triggered( QAction * ) ), this, SLOT( pollWindowMenuStates( QAction * ) ) );
    connect( ui->menuRecent_Files, SIGNAL(triggered(QAction*)), this, SLOT(openRecent(QAction*)) );

    if( ui->menuCreate )
        {
        connect( ui->menuCreate, SIGNAL( triggered( QAction * ) ), this, SLOT( createTriggered( QAction * ) ) );
        connect( ui->menuCreate, SIGNAL( aboutToShow() ), this, SLOT( rebuildCreateMenu() ) );
        }
Exemplo n.º 9
0
void MainWindow::fileSave()
{
  if (!m_FileName.isEmpty()) {
    m_WorkSpace->save(m_FileName);
  } else {
    fileSaveAs();
  }
}
Exemplo n.º 10
0
void ABMainWindow::fileSave()
{
    if ( filename.isEmpty() ) {
        fileSaveAs();
        return;
    }

    view->save( filename );
}
Exemplo n.º 11
0
void KVirtual::fileSave()
{
	if ( m_confFilename.isNull() )
	{
		fileSaveAs();
		return;
	}

	m_options->save( m_confFilename );
}
Exemplo n.º 12
0
bool CreateBlogMsg::fileSave()
{
    if (fileName.isEmpty())
        return fileSaveAs();

    QTextDocumentWriter writer(fileName);
    bool success = writer.write(ui.msgEdit->document());
    if (success)
        ui.msgEdit->document()->setModified(false);
    return success;
}
Exemplo n.º 13
0
void MainWindow::closeEvent( QCloseEvent* event )
{
    if ( NULL != currentFile ) {
        fileSave();
    }
    else if ( ui->plainTextEdit->document()->isModified() ) {
        fileSaveAs();
    }

    QMainWindow::closeEvent( event );
}
Exemplo n.º 14
0
void MainWindow::fileSave()
{
	if (!currentFileName.isEmpty())
	{
		Q_EMIT fileSave(currentFileName);
	}
	else
	{
		fileSaveAs();
	}
}
Exemplo n.º 15
0
bool TextEdit::fileSave()
{
    if (fileName.isEmpty())
        return fileSaveAs();

    QTextDocumentWriter writer(fileName);
    bool success = writer.write(textEdit->document());
    if (success)
        textEdit->document()->setModified(false);
    return success;
}
Exemplo n.º 16
0
void MainWindow::fileSave() {
    if (_sdata->fileName().isEmpty()){
//      no file have been specified, call save as...
        return fileSaveAs();
    }

    SensorNetwork net(40);
    net.save(_sdata->fileName().toStdString());

    _sdata->setSaved(true);
}
Exemplo n.º 17
0
bool fileSave()
{
	if (fileName.empty())
		return fileSaveAs();

	if (!document.save(fileName.c_str())) {
		document.sendSaveCommand();
		error("Failed to save file");
		return false;
	}
	return true;
}
Exemplo n.º 18
0
void MainWindow::createActions() {
    _fileNewAct = new QAction(tr("&New..."), this);
    _fileNewAct->setShortcut(QKeySequence::New);
    _fileNewAct->setStatusTip(tr("Create new simulation"));
    _fileNewAct->setIcon(QIcon::fromTheme("document-new", QIcon(":/icons/new.png")));
    connect(_fileNewAct, SIGNAL(triggered()), this, SLOT(fileNew()));


    _fileOpenAct = new QAction(tr("&Open..."), this);
    _fileOpenAct->setShortcut(QKeySequence::Open);
    _fileOpenAct->setStatusTip(tr("Load existing simulation data"));
    _fileOpenAct->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/open.png")));
    connect(_fileOpenAct, SIGNAL(triggered()), this, SLOT(fileOpen()));

    _fileCloseAct = new QAction(tr("&Close..."), this);
    _fileCloseAct->setShortcut(QKeySequence::Close);
    _fileCloseAct->setStatusTip(tr("Exit current simulation"));
    connect(_fileCloseAct, SIGNAL(triggered()), this, SLOT(fileClose()));

    _fileSaveAct = new QAction(tr("&Save"), this);
    _fileSaveAct->setShortcut(QKeySequence::Save);
    _fileSaveAct->setStatusTip(tr("Save simulation data to file"));
    _fileSaveAct->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/save.png")));
    connect(_fileSaveAct, SIGNAL(triggered()), this, SLOT(fileSave()));

    _fileSaveAsAct = new QAction(tr("Save &as..."), this);
    _fileSaveAsAct->setShortcut(QKeySequence::SaveAs);
    _fileSaveAsAct->setStatusTip(tr("Save simulation data to file"));
    _fileSaveAsAct->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/icons/save.png")));
    connect(_fileSaveAsAct, SIGNAL(triggered()), this, SLOT(fileSaveAs()));

    _fileExitAct = new QAction(tr("E&xit..."), this);
    _fileExitAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    _fileExitAct->setStatusTip(tr("Exit program"));
    _fileExitAct->setIcon(QIcon::fromTheme("application-exit"));
    connect(_fileExitAct, SIGNAL(triggered()), this, SLOT(close()));


    _helpAboutAct = new QAction(tr("&About"), this);
    _helpAboutAct->setStatusTip(tr("About HPC program"));
    _helpAboutAct->setIcon(QIcon::fromTheme("help-about"));
    connect(_helpAboutAct, SIGNAL(triggered()), this, SLOT(helpAbout()));

    _helpAboutQtAct = new QAction(tr("&About Qt"), this);
    _helpAboutQtAct->setStatusTip(tr("About Qt framework"));
    _helpAboutQtAct->setIcon(QIcon::fromTheme("help-about"));
    connect(_helpAboutQtAct, SIGNAL(triggered()), this, SLOT(helpAboutQt()));

    _fileSaveAct->setEnabled(false);
    _fileSaveAsAct->setEnabled(false);
    _fileCloseAct->setEnabled(false);
}
Exemplo n.º 19
0
static bool fileSave()
{
	SyncDocument *doc = trackView->getDocument();
	if (doc->fileName.empty())
		return fileSaveAs();

	if (!doc->save(doc->fileName)) {
		doc->clientSocket.sendSaveCommand();
		error("Failed to save file");
		return false;
	}
	return true;
}
Exemplo n.º 20
0
bool MainWindow::fileSave()
{
    QTextEdit *pEdit = textEditor.editor;
    QString fileName = textEditor.fileName;
    if (fileName.isEmpty())
        return fileSaveAs();

    QTextDocumentWriter writer(fileName);
    bool success = writer.write(pEdit->document());
    if (success)
        pEdit->document()->setModified(false);
    return success;
}
Exemplo n.º 21
0
void CreateBlogMsg::setupFileActions()
{
    QMenu *menu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(menu);

    QAction *a;

    a = new QAction(QIcon(":/images/textedit/filenew.png"), tr("&New"), this);
    a->setShortcut(QKeySequence::New);
    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
    menu->addAction(a);

    a = new QAction(QIcon(":/images/textedit/fileopen.png"), tr("&Open..."), this);
    a->setShortcut(QKeySequence::Open);
    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
    menu->addAction(a);

    menu->addSeparator();

    actionSave = a = new QAction(QIcon(":/images/textedit/filesave.png"), tr("&Save"), this);
    a->setShortcut(QKeySequence::Save);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
    a->setEnabled(false);
    menu->addAction(a);

    a = new QAction(tr("Save &As..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    menu->addAction(a);
    menu->addSeparator();

    a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("&Print..."), this);
    a->setShortcut(QKeySequence::Print);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
    menu->addAction(a);

    a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
    menu->addAction(a);

    a = new QAction(QIcon(":/images/textedit/exportpdf.png"), tr("&Export PDF..."), this);
    a->setShortcut(Qt::CTRL + Qt::Key_D);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
    menu->addAction(a);

    menu->addSeparator();

    a = new QAction(tr("&Quit"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(a, SIGNAL(triggered()), this, SLOT(cancelMsg()));
    menu->addAction(a);
}
Exemplo n.º 22
0
bool TextEdit::fileSave()
{
    if (fileName.isEmpty())
        return fileSaveAs();

    QFile file(fileName);
    if (!file.open(QFile::WriteOnly))
        return false;
    QTextStream ts(&file);
    ts.setCodec(QTextCodec::codecForName("UTF-8"));
    ts << textEdit->document()->toPlainText();
    textEdit->document()->setModified(false);
    return true;
}
Exemplo n.º 23
0
void TextEdit::fileSave()
{
    if ( !currentEditor() )
	return;
    QString fn;
    if ( filenames.find( currentEditor() ) == filenames.end() ) {
	fileSaveAs();
    } else {
	QFile file( *filenames.find( currentEditor() ) );
	if ( !file.open( IO_WriteOnly ) )
	    return;
	QTextStream ts( &file );
	ts << currentEditor()->text();
    }
}
Exemplo n.º 24
0
void MainWindow::createConnections()
{
    connect(fileNewAction, SIGNAL(triggered()),
            this, SLOT(fileNew()));
    connect(fileOpenAction, SIGNAL(triggered()),
            this, SLOT(fileOpen()));
    connect(fileSaveAction, SIGNAL(triggered()),
            this, SLOT(fileSave()));
    connect(fileSaveAsAction, SIGNAL(triggered()),
            this, SLOT(fileSaveAs()));
    connect(fileExportAction, SIGNAL(triggered()),
            this, SLOT(fileExport()));
    connect(filePrintAction, SIGNAL(triggered()),
            this, SLOT(filePrint()));
    connect(fileQuitAction, SIGNAL(triggered()),
            this, SLOT(close()));
    connect(editSelectedItemAction, SIGNAL(triggered()),
            this, SLOT(editSelectedItem()));
    connect(editAddTextAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editAddBoxAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editAddSmileyAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editCopyAction, SIGNAL(triggered()),
            this, SLOT(editCopy()));
    connect(editCutAction, SIGNAL(triggered()),
            this, SLOT(editCut()));
    connect(editPasteAction, SIGNAL(triggered()),
            this, SLOT(editPaste()));
    connect(QApplication::clipboard(), SIGNAL(dataChanged()),
            this, SLOT(updateUi()));
    foreach (QAction *action, QList<QAction*>()
             << editAlignmentAction << editAlignLeftAction
             << editAlignRightAction << editAlignTopAction
             << editAlignBottomAction)
        connect(action, SIGNAL(triggered()), this, SLOT(editAlign()));
    connect(editClearTransformsAction, SIGNAL(triggered()),
            this, SLOT(editClearTransforms()));
    connect(scene, SIGNAL(selectionChanged()),
            this, SLOT(selectionChanged()));
    connect(viewShowGridAction, SIGNAL(toggled(bool)),
            this, SLOT(viewShowGrid(bool)));
    connect(viewZoomInAction, SIGNAL(triggered()),
            view, SLOT(zoomIn()));
    connect(viewZoomOutAction, SIGNAL(triggered()),
            view, SLOT(zoomOut()));
}
Exemplo n.º 25
0
void ABMainWindow::setupMenuBar()
{
    QPopupMenu *file = new QPopupMenu( this );
    menuBar()->insertItem( "&File", file );

    file->insertItem( "New", this, SLOT( fileNew() ), CTRL + Key_N );
    file->insertItem( QPixmap( "fileopen.xpm" ), "Open", this, SLOT( fileOpen() ), CTRL + Key_O );
    file->insertSeparator();
    file->insertItem( QPixmap( "filesave.xpm" ), "Save", this, SLOT( fileSave() ), CTRL + Key_S );
    file->insertItem( "Save As...", this, SLOT( fileSaveAs() ) );
    file->insertSeparator();
    file->insertItem( QPixmap( "fileprint.xpm" ), "Print...", this, SLOT( filePrint() ), CTRL + Key_P );
    file->insertSeparator();
    file->insertItem( "Close", this, SLOT( closeWindow() ), CTRL + Key_W );
    file->insertItem( "Quit", qApp, SLOT( quit() ), CTRL + Key_Q );
}
Exemplo n.º 26
0
void Korrent::setupActions()
{
    KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
    KStdAction::open(this, SLOT(fileOpen()), actionCollection());
    KStdAction::save(this, SLOT(fileSave()), actionCollection());
    KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
    KStdAction::print(this, SLOT(filePrint()), actionCollection());
    KStdAction::quit(kapp, SLOT(quit()), actionCollection());

    KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    // this doesn't do anything useful.  it's just here to illustrate
    // how to insert a custom menu and menu item
    KAction *custom = new KAction(i18n("Cus&tom Menuitem"), 0,
                                  this, SLOT(optionsPreferences()),
                                  actionCollection(), "custom_action");
}
Exemplo n.º 27
0
/** Constructor */
CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
    : ConfigPage(parent, flags)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
  connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
  connect(ui._includeSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(load()));
  connect(ui._copyLink_PB, SIGNAL(clicked()), this, SLOT(copyRSLink()));
  connect(ui._useOldFormat_CB, SIGNAL(toggled(bool)), this, SLOT(load()));

  /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
Exemplo n.º 28
0
KMiniEdit::KMiniEdit() : KMainWindow(0)
{
  edit = new QMultiLineEdit(this);
  setCentralWidget(edit);

  KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
  KStdAction::open(this, SLOT(fileOpen()), actionCollection());

  recentAction = KStdAction::openRecent(0, 0, actionCollection());
  recentAction->loadEntries(KGlobal::config());
  connect(recentAction, SIGNAL(urlSelected(const KURL &)), this, SLOT(fileOpenRecent(const KURL &)));

  saveAction = KStdAction::save(this, SLOT(fileSave()), actionCollection());
  checkEdited();
  connect(edit, SIGNAL(textChanged()), this, SLOT(checkEdited()));

  KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
  KStdAction::close(this, SLOT(fileClose()), actionCollection());

  KAction *a;

  a = KStdAction::undo(edit, SLOT(undo()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)));
  
  a = KStdAction::redo(edit, SLOT(redo()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)));

  a = KStdAction::cut(edit, SLOT(cut()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)));

  a = KStdAction::copy(edit, SLOT(copy()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)));

  pasteAction = KStdAction::paste(edit, SLOT(paste()), actionCollection());
  checkClipboard();
  connect(kapp->clipboard(), SIGNAL(dataChanged()), this, SLOT(checkClipboard()));

  KStdAction::selectAll(edit, SLOT(selectAll()), actionCollection());

  createGUI();
}
Exemplo n.º 29
0
bool HtmlEditor::fileSave()
{
    if (fileName.isEmpty() || fileName.startsWith(QLatin1String(":/")))
        return fileSaveAs();

    QFile file(fileName);
    bool success = file.open(QIODevice::WriteOnly);
    if (success) {
        // FIXME: here we always use UTF-8 encoding
        QString content = ui->webView->page()->mainFrame()->toHtml();
        QByteArray data = content.toUtf8();
        qint64 c = file.write(data);
        success = (c >= data.length());
    }

    setWindowModified(false);
    return success;
}
Exemplo n.º 30
0
void TextEdit::setupFileActions()
{
    QMenu *menu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(menu);

    QAction *a;

    a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
    a->setShortcut(QKeySequence::New);
    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
    menu->addAction(a);

    a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this);
    a->setShortcut(QKeySequence::Open);
    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
    menu->addAction(a);

    menu->addSeparator();

    actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this);
    a->setShortcut(QKeySequence::Save);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
    a->setEnabled(false);
    menu->addAction(a);

    a = new QAction(tr("Save &As..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    menu->addAction(a);
    menu->addSeparator();

    a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this);
    a->setShortcut(QKeySequence::Print);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
    menu->addAction(a);

    menu->addSeparator();

    a = new QAction(tr("&Quit"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(a, SIGNAL(triggered()), this, SLOT(close()));
    menu->addAction(a);
}