Example #1
0
ViewInterface* Session::openAlways(const QString& file_name,
        std::function<ViewInterface*()> view_factory,
        const QString& view_context )
{
    // Create the data objects
    auto log_data          = std::make_shared<LogData>();
    auto log_filtered_data =
        std::shared_ptr<LogFilteredData>( log_data->getNewFilteredData() );

    ViewInterface* view = view_factory();
    view->setData( log_data, log_filtered_data );
    view->setQuickFindPattern( quickFindPattern_ );
    view->setSavedSearches( savedSearches_ );

    if ( !view_context.isEmpty() )
        view->setViewContext( view_context );

    // Insert in the hash
    openFiles_.insert( { view,
            { file_name,
            log_data,
            log_filtered_data,
            view } } );

    // Start loading the file
    log_data->attachFile( file_name );

    return view;
}
Example #2
0
ViewInterface* Session::open( const std::string& file_name,
        std::function<ViewInterface*()> view_factory )
{
    ViewInterface* view = nullptr;

    QFileInfo fileInfo( file_name.c_str() );
    if ( fileInfo.isReadable() )
    {
        // Create the data objects
        auto log_data          = std::make_shared<LogData>();
        auto log_filtered_data =
            std::shared_ptr<LogFilteredData>( log_data->getNewFilteredData() );

        view = view_factory();
        view->setData( log_data, log_filtered_data );

        // Insert in the hash
        open_files_.insert( { view,
                { file_name,
                  log_data,
                  log_filtered_data,
                  view } } );

        // Start loading the file
        log_data->attachFile( QString( file_name.c_str() ) );
    }
    else {
        // throw
    }

    return view;
}
Example #3
0
void XFE_ComposeAttachFolderView::doCommand(CommandType command, void*,XFE_CommandInfo* info)
{
    if (command==xfeCmdAttachFile) {
        attachFile();
    } else if (command==xfeCmdAttachWebPage) {
        attachLocation();
    } else if ((command==xfeCmdDelete || command==xfeCmdDeleteAttachment) &&
               _folderVisible) {
        deleteAttach();
    } else if (command==xfeCmdShowPopup) {
        // Handle popup menu
        XEvent *event = info->event;
        Widget w = XtWindowToWidget(event->xany.display, event->xany.window);

        if (w == NULL) w=getBaseWidget();

        if (_xfePopup) {
            _xfePopup->position(event);
            _xfePopup->show();
        }
    }
}
Example #4
0
// Override the constructor so we always use a NWebPage
// rather than a QWebPage
NWebView::NWebView(NBrowserWindow *parent) :
    QWebView(parent)
{
    this->parent = parent;
    editorPage = new NWebPage(this);
    setPage(editorPage);
    isDirty = false;
    this->setFont(global.getGuiFont(font()));

    contextMenu = new QMenu(this);
    openAction = new QAction(tr("Open"), this);
    contextMenu->addAction(openAction);
    contextMenu->addSeparator();
    contextMenu->setFont(global.getGuiFont(font()));

    cutAction = new QAction(tr("Cut"), this);
    this->setupShortcut(cutAction, "Edit_Cut");
    contextMenu->addAction(cutAction);
    connect(cutAction, SIGNAL(triggered()), parent, SLOT(cutButtonPressed()));

    copyAction = new QAction(tr("Copy"), this);
    this->setupShortcut(copyAction, "Edit_Copy");
    contextMenu->addAction(copyAction);
    connect(copyAction, SIGNAL(triggered()), parent, SLOT(copyButtonPressed()));

    pasteAction = new QAction(tr("Paste"), this);
    setupShortcut(pasteAction, "Edit_Paste");
    contextMenu->addAction(pasteAction);
    connect(pasteAction, SIGNAL(triggered()), parent, SLOT(pasteButtonPressed()));

    pasteWithoutFormatAction = new QAction(tr("Paste as Unformatted Text"), this);
    this->setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting");
    contextMenu->addAction(pasteWithoutFormatAction);
    connect(pasteWithoutFormatAction, SIGNAL(triggered()), parent, SLOT(pasteWithoutFormatButtonPressed()));

    removeFormattingAction = new QAction(tr("Remove Formatting"), this);
    this->setupShortcut(removeFormattingAction, "Edit_Remove_Formatting");
    contextMenu->addAction(removeFormattingAction);
    connect(removeFormattingAction, SIGNAL(triggered()), parent, SLOT(removeFormatButtonPressed()));

    contextMenu->addSeparator();

    QMenu *colorMenu = new QMenu(tr("Background Color"), this);
    colorMenu->setFont(global.getGuiFont(font()));
    QAction *action = setupColorMenuOption(tr("White"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundWhite()));
    action = setupColorMenuOption(tr("Red"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundRed()));
    action = setupColorMenuOption(tr("Blue"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlue()));
    action = setupColorMenuOption(tr("Green"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGreen()));
    action = setupColorMenuOption(tr("Yellow"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundYellow()));
    action = setupColorMenuOption(tr("Black"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlack()));
    action = setupColorMenuOption(tr("Grey"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGrey()));
    action = setupColorMenuOption(tr("Purple"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPurple()));
    action = setupColorMenuOption(tr("Brown"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBrown()));
    action = setupColorMenuOption(tr("Orange"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundOrange()));
    action = setupColorMenuOption(tr("Powder Blue"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPowderBlue()));

    contextMenu->addMenu(colorMenu);
    contextMenu->addSeparator();

    todoAction = new QAction(tr("To-do"), this);
    contextMenu->addAction(todoAction);
    this->setupShortcut(todoAction, "Edit_Insert_Todo");
    connect(todoAction, SIGNAL(triggered()), parent, SLOT(todoButtonPressed()));

    contextMenu->addSeparator();

    insertHtmlEntitiesAction = new QAction(tr("HTML Entities"),this);
    contextMenu->addAction(insertHtmlEntitiesAction);
    this->setupShortcut(insertHtmlEntitiesAction, "Edit_Insert_Html_Entities");
    connect(insertHtmlEntitiesAction, SIGNAL(triggered()), parent, SLOT(insertHtmlEntities()));

    contextMenu->addSeparator();

    encryptAction = new QAction(tr("Encrypted Selected Text"), this);
    contextMenu->addAction(encryptAction);
    this->setupShortcut(encryptAction, "Edit_EncryptText");
    connect(encryptAction, SIGNAL(triggered()), parent, SLOT(encryptButtonPressed()));

    insertLinkAction = new QAction(tr("Insert Hyperlink"), this);
    contextMenu->addAction(insertLinkAction);
    this->setupShortcut(insertLinkAction, "Edit_InsertHyperlink");
    connect(insertLinkAction, SIGNAL(triggered()),parent, SLOT(insertLinkButtonPressed()));    

    insertQuickLinkAction = new QAction(tr("Quick Link"), this);
    contextMenu->addAction(insertQuickLinkAction);
    this->setupShortcut(insertQuickLinkAction, "Edit_InsertQuickLink");
    connect(insertQuickLinkAction, SIGNAL(triggered()),parent, SLOT(insertQuickLinkButtonPressed()));

    removeLinkAction = new QAction(tr("Remove Hyperlink"), this);
    contextMenu->addAction(removeLinkAction);
    this->setupShortcut(removeLinkAction, "Edit_RemoveHyperlink");
    connect(removeLinkAction, SIGNAL(triggered()),parent, SLOT(removeLinkButtonPressed()));

    attachFileAction = new QAction(tr("Attach File"), this);
    contextMenu->addAction(attachFileAction);
    this->setupShortcut(attachFileAction, "Edit_Attach_File");
    connect(attachFileAction, SIGNAL(triggered()),parent, SLOT(attachFile()));
    contextMenu->addSeparator();

    insertLatexAction = new QAction(tr("Insert LaTeX Formula"), this);
    contextMenu->addAction(insertLatexAction);
    this->setupShortcut(insertLatexAction, "Edit_Insert_Latex");
    connect(insertLatexAction, SIGNAL(triggered()),parent, SLOT(insertLatexButtonPressed()));
    contextMenu->addSeparator();

    tableMenu = new QMenu(tr("Table"), this);
    tableMenu->setFont(global.getGuiFont(font()));
    contextMenu->addMenu(tableMenu);
    insertTableAction = new QAction(tr("Insert Table"), this);
    this->setupShortcut(insertTableAction, "Edit_Insert_Table");
    tableMenu->addAction(insertTableAction);
    connect(insertTableAction, SIGNAL(triggered()), parent, SLOT(insertTableButtonPressed()));
    tableMenu->addSeparator();
    insertTableRowAction = new QAction(tr("Insert Row"), this);
    this->setupShortcut(insertTableRowAction, "Edit_Insert_Table_Row");
    tableMenu->addAction(insertTableRowAction);
    connect(insertTableRowAction, SIGNAL(triggered()), parent, SLOT(insertTableRowButtonPressed()));
    insertTableColumnAction = new QAction(tr("Insert Column"), this);
    this->setupShortcut(insertTableColumnAction, "Edit_Insert_Table_Column");
    tableMenu->addAction(insertTableColumnAction);
    connect(insertTableColumnAction, SIGNAL(triggered()), parent, SLOT(insertTableColumnButtonPressed()));
    tableMenu->addSeparator();
    deleteTableRowAction = new QAction(tr("Delete Row"), this);
    tableMenu->addAction(deleteTableRowAction);
    this->setupShortcut(deleteTableRowAction, "Edit_Delete_Table_Row");
    connect(deleteTableRowAction, SIGNAL(triggered()), parent, SLOT(deleteTableRowButtonPressed()));
    deleteTableColumnAction = new QAction(tr("Delete Column"), this);
    tableMenu->addAction(deleteTableColumnAction);
    this->setupShortcut(deleteTableColumnAction, "Edit_Delete_Table_Column");
    connect(deleteTableColumnAction, SIGNAL(triggered()), parent, SLOT(deleteTableColumnButtonPressed()));
    contextMenu->addSeparator();

    imageMenu = new QMenu(tr("Image"), this);
    imageMenu->setFont(global.getGuiFont(font()));
    contextMenu->addMenu(imageMenu);
    downloadImageAction()->setText(tr("Save Image"));
    imageMenu->addAction(downloadImageAction());
    // Don't connect this signal.  The download attachmen signal will handle it.  Otherwise
    // the signal fires twice.
    //connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));

    imageMenu->addSeparator();

    rotateImageLeftAction = new QAction(tr("Rotate Left"), this);
    imageMenu->addAction(rotateImageLeftAction);
    this->setupShortcut(rotateImageLeftAction, "Edit_Image_Rotate_Left");
    connect(rotateImageLeftAction, SIGNAL(triggered()), parent, SLOT(rotateImageLeftButtonPressed()));
    rotateImageRightAction = new QAction(tr("Rotate Right"), this);
    this->setupShortcut(rotateImageRightAction, "Edit_Image_Rotate_Right");
    imageMenu->addAction(rotateImageRightAction);
    connect(rotateImageRightAction, SIGNAL(triggered()), parent, SLOT(rotateImageRightButtonPressed()));
    contextMenu->addSeparator();

    downloadAttachmentAction()->setText(tr("Save Attachment"));
    contextMenu->addAction(downloadAttachmentAction());
    connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));

    connect(editorPage, SIGNAL(contentsChanged()), this, SLOT(editAlert()));
    editorPage->setContentEditable(true);

    // Set some of the menus as disabled until a user selects an image or attachment
    downloadAttachmentAction()->setEnabled(false);
    rotateImageRightAction->setEnabled(false);
    rotateImageLeftAction->setEnabled(false);
    openAction->setEnabled(false);
    downloadImageAction()->setEnabled(false);

    connect(this->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exposeToJavascript()));

        //this->setStyleSheet("QWebView,html,body { background-color : red; foreground-color : white; }");
    QString qss = global.fileManager.getQssDirPathUser("");
    if (qss == "")
        qss = global.fileManager.getQssDirPath("");
    this->settings()->setUserStyleSheetUrl(QUrl("file://"+qss+"editor.css"));

}
Example #5
0
Composer::Composer( QWidget *parent )
: QWidget( parent )
{
	QGridLayout * layout = new QGridLayout( this, 1, 1, 6 );

	uint line = 0;
	
	layout->addWidget( new QLabel( tr( "SMTP:" ), this ), line, 0 );
	smtp_server = new QLineEdit( this );
	//smtp_server->setText("10.10.11.7"); 
	smtp_server->setText("10.10.11.7");
	layout->addWidget( smtp_server, line, 1 );
	line++;

	layout->addWidget( new QLabel( tr( "From:" ), this ), line, 0 );
	from = new QLineEdit( this );
	from->setText("Lukasz Iwaszkiewicz <*****@*****.**>");
	layout->addWidget( from, line, 1 );
	line++;

	layout->addWidget( new QLabel( tr( "To:" ), this ), line, 0 );
	to = new QLineEdit( this );
	//to->setText("[email protected], [email protected]");
	to->setText("*****@*****.**");
	layout->addWidget( to, line, 1 );
	line++;
	
	layout->addWidget( new QLabel( tr( "Cc:" ), this ), line, 0 );
	cc = new QLineEdit( this );
	//cc->setText("*****@*****.**");
	cc->setText("");
	layout->addWidget( cc, line, 1 );
	line++;
	
	layout->addWidget( new QLabel( tr( "Bcc:" ), this ), line, 0 );
	bcc = new QLineEdit( this );
	//bcc->setText("*****@*****.**");
	bcc->setText("");
	layout->addWidget( bcc, line, 1 );
	line++;

	layout->addWidget( new QLabel( tr( "Encoding" ), this ), line, 0 );
	enc = new QLineEdit( this );
	//bcc->setText("*****@*****.**");
	enc->setText("ISO-8859-2");
	layout->addWidget( enc, line, 1 );
	line++;

	layout->addWidget( new QLabel( tr( "Subject:" ), this ), line, 0 );
	subject = new QLineEdit( this );
	//subject->setText("test");
	subject->setText(tr("test"));
	layout->addWidget( subject, line, 1 );
	line++;

	layout->addWidget( new QLabel( tr( "Send as HTML:" ), this ), line, 0 );
	html = new QCheckBox( this );
	layout->addWidget( html , line, 1 );
	line++;

	bold = new QPushButton( tr( "Bold" ), this );
	layout->addWidget( bold, line, 0 );
	connect( bold, SIGNAL( clicked() ), this, SLOT( setBold() ) );
	line++;
	
	message = new QTextEdit( this );
	message->setText("test");
	//message->setTextFormat(Qt::RichText);
	layout->addMultiCellWidget( message, line, line, 0, 1 );
	line++;

	attach = new QPushButton( tr( "&Attach" ), this );
	layout->addWidget( attach, line, 0 );
	connect( attach, SIGNAL( clicked() ), this, SLOT( attachFile() ) );

	forward = new QPushButton( tr( "Attach &Forward" ), this );
	layout->addWidget( forward, line, 1 );
	connect( forward, SIGNAL( clicked() ), this, SLOT( attachForward() ) );
	line++;

	files = new QListView( this );
	files->addColumn(tr("Attached Files"));
	layout->addMultiCellWidget( files, line, line, 0, 1 );
	line++;

	send = new QPushButton( tr( "S&end" ), this );
	layout->addWidget( send, line, 0 );
	connect( send, SIGNAL( clicked() ), this, SLOT( sendMessage() ) );

	save = new QPushButton( tr( "&Save" ), this );
	layout->addWidget( save, line, 1 );
	connect( save, SIGNAL( clicked() ), this, SLOT( saveMessage() ) );
	line++;

	sendStatus = new QLabel( this );
	layout->addMultiCellWidget( sendStatus, line, line, 0, 1 );

	LHMail::initMailSystem();

	smtp = 0;
}