mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
kmail: new application to send e-mail
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4329ee885b
commit
6e488f98fa
4 changed files with 115 additions and 0 deletions
|
@ -346,6 +346,7 @@ add_subdirectory(kdialog)
|
|||
add_subdirectory(keditbookmarks)
|
||||
add_subdirectory(kfind)
|
||||
add_subdirectory(kmediaplayer)
|
||||
add_subdirectory(kmail)
|
||||
add_subdirectory(konsole)
|
||||
# Background processes
|
||||
add_subdirectory(kdontchangethehostname)
|
||||
|
|
18
kmail/CMakeLists.txt
Normal file
18
kmail/CMakeLists.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
project(KMail)
|
||||
|
||||
add_executable(kmail main.cpp)
|
||||
|
||||
target_link_libraries(kmail
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KEMAIL_LIBS}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS kmail
|
||||
DESTINATION ${KDE4_BIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
PROGRAMS kmail.desktop
|
||||
DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR}
|
||||
)
|
10
kmail/kmail.desktop
Normal file
10
kmail/kmail.desktop
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Desktop Entry]
|
||||
Icon=internet-mail
|
||||
Name=KMail
|
||||
GenericName=Mail sender
|
||||
Comment=A simple program to send e-mail
|
||||
Exec=kmail --icon '%i' --caption '%c' %U
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Qt;KDE;Network;Email;
|
||||
MimeType=x-scheme-handler/mailto;
|
86
kmail/main.cpp
Normal file
86
kmail/main.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2022 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <KAboutData>
|
||||
#include <KCmdLineArgs>
|
||||
#include <KApplication>
|
||||
#include <KLocale>
|
||||
#include <KEMailDialog>
|
||||
#include <KDebug>
|
||||
|
||||
static QStringList splitMailArg(const QString &arg)
|
||||
{
|
||||
return arg.split(QLatin1Char(','));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
KAboutData aboutData(
|
||||
"kmail", 0, ki18n("KMail"),
|
||||
"1.0.0", ki18n("Simple e-mail sender for KDE."),
|
||||
KAboutData::License_GPL_V2,
|
||||
ki18n("(c) 2022 Ivailo Monev"),
|
||||
KLocalizedString(),
|
||||
"https://osdn.net/projects/kde/"
|
||||
);
|
||||
|
||||
aboutData.addAuthor(
|
||||
ki18n("Ivailo Monev"),
|
||||
ki18n("Maintainer"),
|
||||
"xakepa10@gmail.com"
|
||||
);
|
||||
aboutData.setProgramIconName(QLatin1String("internet-mail"));
|
||||
aboutData.setOrganizationDomain("kde.org");
|
||||
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KCmdLineOptions option;
|
||||
option.add("+[url]", ki18n("URL to be opened"));
|
||||
KCmdLineArgs::addCmdLineOptions(option);
|
||||
|
||||
KApplication *app = new KApplication();
|
||||
KEMailDialog *dialog = new KEMailDialog();
|
||||
dialog->show();
|
||||
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
for (int pos = 0; pos < args->count(); pos++) {
|
||||
const KUrl argurl = args->url(pos);
|
||||
|
||||
if (argurl.hasQueryItem("subject")) {
|
||||
dialog->setSubject(argurl.queryItemValue("subject"));
|
||||
}
|
||||
|
||||
QStringList mailto;
|
||||
if (argurl.hasQueryItem("to")) {
|
||||
mailto.append(splitMailArg(argurl.queryItemValue("to")));
|
||||
}
|
||||
if (argurl.hasQueryItem("cc")) {
|
||||
mailto.append(splitMailArg(argurl.queryItemValue("cc")));
|
||||
}
|
||||
dialog->setTo(mailto);
|
||||
|
||||
if (argurl.hasQueryItem("body")) {
|
||||
dialog->setMessage(argurl.queryItemValue("body"));
|
||||
}
|
||||
|
||||
if (argurl.hasQueryItem("attach")) {
|
||||
dialog->setAttach(splitMailArg(argurl.queryItemValue("attach")));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return app->exec();
|
||||
}
|
Loading…
Add table
Reference in a new issue