I'm not sure anymore what that was, but pointing out that kwin could

simply use kdialog was right.

svn path=/trunk/kdebase/kwin/; revision=261293
This commit is contained in:
Luboš Luňák 2003-10-23 13:38:42 +00:00
parent 7d10a9a2c9
commit 26a5b0bfb4
4 changed files with 25 additions and 94 deletions

View file

@ -1,6 +1,6 @@
INCLUDES = -I$(srcdir)/lib $(all_includes)
SUBDIRS = lib . killer dialog kcmkwin pics clients oldheaders
SUBDIRS = lib . killer kcmkwin pics clients oldheaders
bin_PROGRAMS =
lib_LTLIBRARIES =

View file

@ -1,9 +0,0 @@
INCLUDES = $(all_includes)
bin_PROGRAMS = kwin_dialog_helper
kwin_dialog_helper_SOURCES = dialog.cpp
kwin_dialog_helper_LDADD = $(LIB_KDEUI)
kwin_dialog_helper_LDFLAGS = $(all_libraries) $(KDE_RPATH)
METASOURCES = AUTO

View file

@ -1,75 +0,0 @@
/****************************************************************************
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
****************************************************************************/
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kmessagebox.h>
#include <kprocess.h>
#include <klocale.h>
#include <unistd.h>
#include <kwin.h>
#include <X11/Xlib.h>
static const KCmdLineOptions options[] =
{ // no need for I18N_NOOP(), this is not supposed to be used directly
{ "message <message>", "Type of dialog message.", 0 },
{ "type <type>", "Dont show again type of dialog message.", 0 },
{ "window <wid>", "Window for which the dialog is shown.", 0 },
{ "+[data]", "Additional data.", 0 },
KCmdLineLastOption
};
int main( int argc, char* argv[] )
{
KCmdLineArgs::init( argc, argv, "kwin_dialog_helper", I18N_NOOP( "KWin" ),
I18N_NOOP( "KWin helper utility" ), "1.0" );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
KGlobal::locale()->insertCatalogue( "kwin" ); // the messages are in kwin's .po file
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QString message = args->getOption( "message" );
QString type = args->getOption( "type" );
QString text;
WId window = args->getOption( "window" ).toULong();
if( message == "noborderaltf3" && args->count() == 1 )
text = i18n( "You have selected to show a window without its border.\n"
"Without the border, you won't be able to enable the border "
"again using the mouse. Use the window operations menu instead, "
"activated using the %1 keyboard shortcut." ).arg( args->arg( 0 ));
else if( message == "fullscreenaltf3" && args->count() == 1 )
text = i18n( "You have selected to show a window in fullscreen mode.\n"
"If the application itself doesn't have an option to turn the fullscreen "
"mode off, you won't be able to disable it "
"again using the mouse. Use the window operations menu instead, "
"activated using the %1 keyboard shortcut." ).arg( args->arg( 0 ));
else
{
KCmdLineArgs::usage( i18n( "This helper utility is not supposed to be called directly!" ));
return 1;
}
if( window != 0 )
KMessageBox::informationWId( window, text, "", type );
else
KMessageBox::information( NULL, text, "", type );
}

View file

@ -1858,26 +1858,41 @@ void Workspace::helperDialog( const QString& message, const Client* c )
{
QStringList args;
QString type;
if( message == "noborderaltf3" || message == "fullscreenaltf3" )
if( message == "noborderaltf3" )
{
args.append( "\'" + keys->shortcut( "Window Operations Menu" ).seq( 0 ).toString() + "\'" );
args << "--msgbox" << ( "\'"
+ i18n( "You have selected to show a window without its border.\n"
"Without the border, you won't be able to enable the border "
"again using the mouse. Use the window operations menu instead, "
"activated using the %1 keyboard shortcut." )
.arg( keys->shortcut( "Window Operations Menu" ).seq( 0 ).toString()) + "\'" );
type = "altf3warning";
}
else if( message == "fullscreenaltf3" )
{
args << "--msgbox" << ( "\'"
+ i18n( "You have selected to show a window in fullscreen mode.\n"
"If the application itself doesn't have an option to turn the fullscreen "
"mode off, you won't be able to disable it "
"again using the mouse. Use the window operations menu instead, "
"activated using the %1 keyboard shortcut." )
.arg( keys->shortcut( "Window Operations Menu" ).seq( 0 ).toString()) + "\'" );
type = "altf3warning";
}
else
return;
assert( false );
KProcess proc;
proc << "kwin_dialog_helper" << "--message" << message;
proc << "kdialog" << args;
if( !type.isEmpty())
{
KConfig cfg( "kwin_dialog_helperrc" );
KConfig cfg( "kwin_dialogsrc" );
cfg.setGroup( "Notification Messages" ); // this depends on KMessageBox
if( !cfg.readBoolEntry( type, true )) // has don't show again checked
return;
proc << "--type" << type;
return; // save launching kdialog
proc << "--dontagain" << "kwin_dialogsrc:" + type;
}
if( c != NULL )
proc << "--window" << QString::number( c->window());
proc << "--" << args;
proc << "--embed" << QString::number( c->window());
proc.start( KProcess::DontCare );
}