1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
#include "QvkMail.h"
using namespace std;
QvkMail::QvkMail()
{
}
QvkMail::QvkMail( QWidget *object )
{
(void)object;
newDialog = new QDialog;
newDialog->setModal( true );
myUiMailDialog.setupUi( newDialog );
newDialog->show();
connect( myUiMailDialog.sendPushButton, SIGNAL( clicked() ), this, SLOT( selection() ) );
connect( myUiMailDialog.cancelPushButton, SIGNAL( clicked() ), this, SLOT( closeDialog() ) ) ;
/*
dialog = new QDialog( object );
dialog->setFixedSize( 470, 200 );
QFont qfont = dialog->font();
qfont.setPixelSize( 12 );
dialog->setFont( qfont );
QLabel* label = new QLabel( dialog );
label->setText("");
label->setGeometry( QRect( 20, 30, 150, 150) );
label->setAlignment( Qt::AlignCenter );
label->show();
QImage* qImage = new QImage( ":pictures/sem_soc_net.png" );
label->setPixmap( QPixmap::fromImage( *qImage, Qt::AutoColor ) );
label->setScaledContents( true );
mailRadioButton = new QRadioButton( dialog );
mailRadioButton->setGeometry( QRect( 200, 60, 200, 21 ) );
mailRadioButton->setText( tr( "Mail last Video" ) );
mailRadioButton->setChecked( true );
mailSelectedRadioButton = new QRadioButton( dialog );
mailSelectedRadioButton->setGeometry( QRect( 200, 90, 300, 21 ) );
mailSelectedRadioButton->setText( tr( "Mail one or more selected Video" ) );
QPushButton * sendPushbutton = new QPushButton( dialog );
sendPushbutton->setGeometry( 290, 170, 80, 30 );
sendPushbutton->setText( tr( "Send" ) );
sendPushbutton->show();
connect( sendPushbutton, SIGNAL( clicked() ), this, SLOT( selection() ) );
QPushButton * closePushbutton = new QPushButton( dialog );
closePushbutton->setGeometry( 380, 170, 80, 30 );
closePushbutton->setText( tr( "Close" ) );
closePushbutton->show();
connect( closePushbutton, SIGNAL( clicked() ), this, SLOT( closeDialog() ) ) ;
dialog->exec();
*/
}
QvkMail::~QvkMail()
{
}
void QvkMail::closeDialog()
{
newDialog->close();
}
void QvkMail::selection()
{
if ( myUiMailDialog.mailRadioButton->isChecked() )
startMailClientWithLastFile( lastMovie() );
if ( myUiMailDialog.mailSelectedRadioButton->isChecked() )
startMailClientWithSelectedFiles( selectedMail() );
}
void QvkMail::startMailClientWithLastFile( QString file )
{
if ( file > "" )
{
// The body String like not Space
QString bodyString = tr( "You find the Video as attachment" );
QString processString = "xdg-email --utf8 --attach " + file + " --body \"" + bodyString + "\"";
//QString processString = "xdg-email --utf8 --attach \"" + file + "\"" + " --body \"" + bodyString + "\"";
qDebug() << "[vokoscreen]" << "startMailClientWithLastFile:" << processString;
QProcess Process;
Process.startDetached( processString );
Process.close();
}
newDialog->close();
}
void QvkMail::startMailClientWithSelectedFiles( QStringList fileList )
{
// The body String like not Space
QString bodyString = tr( "You find the Video as attachment" );
QString files;
for ( int i = 1; i <= fileList.count(); i++ )
{
files = files + " --attach ";
files = files + fileList[ i - 1 ] ;
}
if ( not fileList.empty())
{
QString processString = "xdg-email --utf8" + files + " --body \"" + bodyString + "\"";
qDebug() << "[vokoscreen]" << "startMailClientWithSelectedFiles:" << processString;
QProcess Process;
Process.startDetached( processString );
Process.close();
}
newDialog->close();
}
QString QvkMail::lastMovie()
{
QDir dir( QDesktopServices::storageLocation( QDesktopServices::MoviesLocation ) );
QStringList filters;
filters << "vokoscreen*";
QStringList List = dir.entryList( filters, QDir::Files, QDir::Time );
if ( List.isEmpty() )
return "";
else
return dir.filePath( List.first() );
}
QStringList QvkMail::selectedMail()
{
QString a = QDesktopServices::storageLocation( QDesktopServices::MoviesLocation );
QStringList files = QFileDialog::getOpenFileNames( newDialog,
tr( "Select one or more files" ),
QDesktopServices::storageLocation( QDesktopServices::MoviesLocation ) ,
"*.*" );
return files;
}
|