#!/bin/sh

# (c) 2001, 2002, 2003 - MandrakeSoft, David BAUDENS <baudens@mandrakesoft.com>
# Copyright under GPL version 2

# Basic script for KDE Desktop configuration

if [ ! -d $HOME/Desktop ]; then
        mkdir -p $HOME/Desktop
fi

#if [ ! -e $HOME/Desktop/.directory-mdkgalaxy ] && [ -r /usr/share/nautilus/default-desktop/Welcome.desktop ]; then
#	cp -f /usr/share/nautilus/default-desktop/Welcome.desktop $HOME/Desktop/
#	touch $HOME/Desktop/.directory-mdkgalaxy
#fi
	
cd $HOME/Desktop

[ -e $HOME/Desktop/.directory ]|| cat << EOF > .directory
[IconPosition::CDROM]
X=8
Y=208

[IconPosition::Calc]
X=16
Y=278

[IconPosition::Corbeille]
X=9
Y=351

[IconPosition::Disquette]
X=8
Y=145

[IconPosition::Office]
X=17
Y=81

[IconPosition::WEB]
X=17
Y=16
EOF


# Floppy
if [ ! -e $HOME/Desktop/.localfloppy ]; then
touch $HOME/Desktop/.localfloppy
cat << EOF > Disquette
[Desktop Entry]
Encoding=UTF-8
Icon=3floppy_unmount
Name[fr]=Disquette
Type=Link
URL=$HOME/local/floppy
EOF
fi

# CD-ROM
if [ ! -e $HOME/Desktop/.localcdrom ]; then
touch $HOME/Desktop/.localcdrom
cat << EOF > CDROM
[Desktop Entry]
Encoding=UTF-8
Icon=cdrom_unmount
Name[fr]=CDROM
Type=Link
URL=$HOME/local/cdrom
EOF
fi

if [ ! -e $HOME/Desktop/.web ]; then
touch $HOME/Desktop/.web
cat << EOF > WEB
[Desktop Entry]
Comment=
Comment[fr]=
Encoding=UTF-8
Exec=soundwrapper /usr/bin/mozilla %u
GenericName=
GenericName[fr]=
Icon=netscape
MimeType=
Name=WEB
Name[fr]=WEB
Path=
ServiceTypes=
SwallowExec=
SwallowTitle=
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
EOF
fi


if [ ! -e $HOME/Desktop/.calc ]; then
touch $HOME/Desktop/.calc
cat << EOF > Calc
[Desktop Entry]
Comment=
Comment[fr]=
Encoding=UTF-8
Exec=kcalc
GenericName=
GenericName[fr]=
Icon=kcalc
MimeType=
Name=CALC
Name[fr]=CALC
Path=
ServiceTypes=
SwallowExec=
SwallowTitle=
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
EOF
fi

#if [ ! -e $HOME/Desktop/.email ]; then
#touch $HOME/Desktop/.email
#cat << EOF > Mail
#[Desktop Entry]
#Comment=Mail
#Comment[fr]=Mail
#Exec=/usr/bin/mozilla  -mail
#GenericName=
#GenericName[fr]=
#Icon=email
#MimeType=
#Name=Mail
#Name[fr]=Mail
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#EOF
#fi

#if [ ! -e $HOME/Desktop/.mp3 ]; then
#touch $HOME/Desktop/.mp3
#cat << EOF > MP3
#[Desktop Entry]
#Comment=Lecteur multimédia
#Comment[fr]=Lecteur multimédia
#Exec=soundwrapper xmms
#GenericName=
#GenericName[fr]=
#Icon=xmms.xpm
#MimeType=application/x-ogg;audio/x-mp3;audio/x-mpegurl;audio/x-ogg;audio/x-wav;video/mpeg
#Name=MP3
#Name[fr]=MP3
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#EOF
#fi

if [ ! -e $HOME/Desktop/.office ]; then
touch $HOME/Desktop/.office
cat << EOF > Office
[Desktop Entry]
Comment=OpenOffice.org
Comment[fr]=OpenOffice.org
Exec=oowriter
GenericName=
GenericName[fr]=
Icon=wp
MimeType=application/msword;application/vnd.ms-word;application/vnd.stardivision.writer;application/vnd.sun.xml.writer;application/x-doc;text/rtf
Name=Office
Name[fr]=Office
ServiceTypes=
SwallowExec=
SwallowTitle=
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
EOF
fi

#if [ ! -e $HOME/Desktop/.cdaudio ]; then
#touch $HOME/Desktop/.cdaudio
#cat << EOF > CDAudio
#[Desktop Entry]
#Comment=
#Comment[fr]=
#Encoding=UTF-8
#Exec=grip --small
#GenericName=
#GenericName[fr]=
#Icon=cdaudio_unmount
#MimeType=
#Name=CD audio
#Name[fr]=CD audio
#Path=
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#EOF
#fi

#if [ ! -e $HOME/Desktop/.modem ]; then
#touch $HOME/Desktop/.modem
#cat << EOF > ConnectionModem
#[Desktop Entry]
#Comment=
#Comment[fr]=
#Encoding=UTF-8
#Exec=kppp
#GenericName=
#GenericName[fr]=
#Icon=kppp
#MimeType=
#Name=Connection Modem
#Name[fr]=Connection Modem
#Path=
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#
#EOF
#fi

#if [ ! -e $HOME/Desktop/.palm ]; then
#touch $HOME/Desktop/.palm
#cat << EOF > PALM
#[Desktop Entry]
#Comment=
#Comment[fr]=
#Encoding=UTF-8
#Exec=jpilot
#GenericName=
#GenericName[fr]=
#Icon=pda_blue
#MimeType=
#Name=PALM
#Name[fr]=PALM
#Path=
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#EOF
#fi

#if [ ! -e $HOME/Desktop/.dvd ]; then
#touch $HOME/Desktop/.dvd
#cat << EOF > DVD
#[Desktop Entry]
#Comment=Lecteur DVD
#Comment[fr]=Lecteur DVD
#Exec=/usr/share/oem/apps/dvd
#GenericName=
#GenericName[fr]=
#Icon=dvd_unmount
#MimeType=application/x-ogg;audio/x-mp3;audio/x-mpeg;audio/x-wav;video/mpeg;video/msvideo;video/quicktime;video/x-avi;video/x-fli;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo
#Name=DVD
#Name[fr]=DVD
#ServiceTypes=
#SwallowExec=
#SwallowTitle=
#Terminal=false
#TerminalOptions=
#Type=Application
#X-KDE-SubstituteUID=false
#X-KDE-Username=
#EOF
#fi

#if [ ! -e $HOME/Desktop/.office ]; then
#touch $HOME/Desktop/.office
#cat << EOF > Office
#EOF
#fi

#sleep 2s
#/usr/bin/dcop kdesktop KDesktopIface lineupIcons


mkdir -p $HOME/.kde/share/apps/kdisplay/color-schemes/
cd $HOME/.kde/share/apps/kdisplay/color-schemes/
[ -f OEM.kcsrc ] || cat << EOF > OEM.kcsrc
[Color Scheme]
Name=OEM
activeBackground=32,113,32
activeBlend=24,113,24
activeForeground=255,255,255
activeTitleBtnBg=220,220,220
alternateBackground=238,246,255
background=220,220,220
buttonBackground=228,228,228
buttonForeground=0,0,0
contrast=7
foreground=0,0,0
inactiveBackground=0,0,0
inactiveBlend=0,0,0
inactiveForeground=255,255,255
inactiveTitleBtnBg=220,220,220
linkColor=0,0,192
selectBackground=119,131,189
selectForeground=255,255,255
visitedLinkColor=128,0,128
windowBackground=255,255,255
windowForeground=0,0,0
EOF

cd $HOME/.kde/share/config
if [ ! -f $HOME/.kde/.OEM ];then
#/usr/bin/dcop kdesktop KDesktopIface rearrangeIcons
touch $HOME/.kde/.OEM
fi

[ -f konsolerc ] || cat << EOF > konsolerc
[Desktop Entry]
ActiveSession=0
DefaultSession=shell.desktop
Fullscreen=false
Height 768=344
MenuBar=Enabled
Width 1024=502
bellmode=1
class=konsole-mainwindow#1
defaultfont=Clean,10,-1,5,48,0,0,0,1,0
font=7
has frame=true
history=1000
historyenabled=true
keytab=default
schema=Linux.schema
scrollbar=2

[TipOfDay]
RunOnStart=false

[konsole-mainwindow#1 Toolbar style]
IconSize=16

[options]
schema=Linux.schema
EOF

[ -f kcmdisplayrc ] || cat << EOF > kcpdisplayrc
[X11]
exportKDEColors=true
EOF

[ -f kdeglobals ] || cat << EOF > kdeglobals
[Desktops]
Name_1=1
Name_2=2
Number=2

[General]
background=220,220,220
buttonBackground=228,228,228
selectForeground=255,255,255

[KDE]
SingleClick=false
colorScheme=OEM.kcsrc
contrast=7

[DesktopIcons]
Size=32

[Icons]
Theme=OEM

[WM]
activeBackground=32,113,32
activeBlend=24,113,24
activeTitleBtnBg=220,220,220
inactiveBackground=0,0,0
inactiveBlend=0,0,0
inactiveTitleBtnBg=220,220,220
EOF

[ -f ktaskbarrc ] || cat << EOF > ktaskbarrc
[General]
GroupTasks=false
LeftButtonAction=Show Task List
MiddleButtonAction=Activate, Raise or Minimize Task
RightButtonAction=Show Operations Menu
ShowAllWindows=true
ShowIcon=true
ShowWindowListBtn=true
SortByDesktop=true

EOF

[ -f kwinrc ] || cat << EOF > kwinrc
[Style]
ButtonsOnLeft=MS
ButtonsOnRight=HIAX
CustomButtonPositions=false
PluginLib=kwin_redmond
ShowToolTips=true
EOF

[ -f korgarc ] || cat << EOF > korgarc
[General]
Autostart=false
EOF

[ -f korgacrc ] || cat << EOF > korgacrc
[General]
Autostart=false
EOF

[ -f kickerrc ] || cat << EOF > kickerrc
[Applet_1]
ConfigFile=minipager_panelapplet
DesktopFile=minipagerapplet.desktop
FreeSpace=0
WidthForHeightHint=44

[Applet_2]
ConfigFile=taskbar_panelappletrc
DesktopFile=taskbarapplet.desktop
FreeSpace=0.0119403
WidthForHeightHint=208

[Applet_3]
ConfigFile=lockout_panelapplet
DesktopFile=lockout.desktop
FreeSpace=1
WidthForHeightHint=38

[Applet_4]
ConfigFile=systemtray_panelappletrc
DesktopFile=systemtrayapplet.desktop
FreeSpace=1
WidthForHeightHint=36

[Applet_5]
ConfigFile=clock_panelappletrc
DesktopFile=clockapplet.desktop
FreeSpace=1
WidthForHeightHint=75

[DesktopButton_1]
FreeSpace=0

[General]
Applets=KMenuButton_1,DesktopButton_1,ServiceButton_1,ServiceButton_2,Applet_1,Applet_2,ServiceButton_3,Applet_3,Applet_4,Applet_5

[KMenuButton_1]
FreeSpace=0

[ServiceButton_1]
DesktopFile=Terminals/konsole.desktop
FreeSpace=0

[ServiceButton_2]
DesktopFile=Configuration/Mandrake Control Center.desktop
FreeSpace=0

[ServiceButton_3]
DesktopFile=Applications/Monitoring/Xkill.desktop
FreeSpace=1
EOF

[ -f kdesktoprc ] || cat << EOF > kdesktoprc
[Background Common]
CacheSize=2048
CommonDesktop=false
Dock=true
Export=false
LimitCache=true

[Desktop0]
Wallpaper=/usr/share/mdk/backgrounds/default.png

[Desktop1]
BackgroundMode=Flat
BlendBalance=100
BlendMode=NoBlending
ChangeInterval=60
Color1=33,68,156
Color2=192,192,192
CurrentWallpaper=0
LastChange=0
MinOptimizationDepth=1
MultiWallpaperMode=NoMulti
Pattern=
Program=
ReverseBlending=false
UseSHM=false
Wallpaper=/usr/share/mdk/backgrounds/default.png
WallpaperList=
WallpaperMode=Scaled

[FMSettings]
StandardFont=Sans,10,-1,5,50,0,0,0,0,0

[ScreenSaver]
BottomLeftCorner=false
BottomRightCorner=false
Saver=Krozat.desktop
TopLeftCorner=false
TopRightCorner=false

[Version]
KDEVersionMinor=1
KDEVersionRelease=0
EOF

[ -f kppprc ] || cat << EOF > kppprc
[Account0]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Abacom (Sherbrooke, QC)
Phonenumber=8202404
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account1]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=NetRevolution (Sherbrooke, QC)
Phonenumber=340-3002
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account2]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Netconnexion (Sherbrooke, QC)
Phonenumber=575-8010
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account3]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Sympatico (Sherbrooke, QC)
Phonenumber=829-1638
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account4]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Sympatico (Montreal, QC)
Phonenumber=350-1638
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account5]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Sympatico (Quebec, QC)
Phonenumber=694-1638
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account6]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Vidéotron (Sherbrooke, QC)
Phonenumber=562-1864
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account7]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Vidéotron (Montréal, QC)
Phonenumber=599-2743
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account8]
AccountingEnabled=0
AccountingFile=
Authentication=4
AutoDNS=1
AutoName=0
BeforeConnect=
BeforeDisconnect=
Command=
DNS=
DefaultRoute=1
DisconnectCommand=
Domain=
ExDNSDisabled=0
Gateway=0.0.0.0
IPAddr=0.0.0.0
Name=Vidéotron (Québec, QC)
Phonenumber=521-5596
ScriptArguments=
ScriptCommands=
StorePassword=1
SubnetMask=0.0.0.0
VolumeAccountingEnabled=0
pppdArguments=

[Account9]
pppdArguments=

[General]
DefaultAccount=Abacom (Sherbrooke, QC)
NumberOfAccounts=9
PPPDebug=0

[Graph]
Background=255,255,255
Enabled=true
InBytes=0,0,255
OutBytes=255,0,0
Text=0,0,0

[Modem]
Speed=115200

[Notification Messages]
Annuler=No
EOF


[ -f klipperrc ] || cat << EOF > klipperrc
[General]
AutoStart=false
ClipboardData=
EOF

[ -f kdeprintrc ] || cat << EOF > kdeprintrc
[General]
PrintSystem=cups
ViewMenuBar=false
EOF

[ -f kmixrc ] || cat << EOF > kmixrc
AllowDocking=true
Labels=false
Menubar=true
Position=260,253
Size=250,189
Tabs=1
Tickmarks=false
TrayVolumeControl=true
Visible=false
EOF

cd  $HOME/.kde/Autostart
rm -f ArrangeIcons.desktop

if [ ! -e $HOME/Desktop/.kmix ]; then
touch $HOME/Desktop/.kmix
cat << EOF > kmix.desktop
# KDE Config File
[Desktop Entry]
Encoding=UTF-8
Name=Mixer
Name[fr]=Mixeur
Exec=kmix
Icon=kmix
Type=Application
GenericName=Mixer
GenericName[fr]=Mixeur
Terminal=0
X-KDE-autostart-after=panel
X-KDE-autostart-condition=kmixrc:General:AllowDocking:true
NoDisplay=true
EOF
fi

#SPL="$HOME/.kde/share/apps/ksplash/pics"
#if [ ! -e $SPL ]; then
#mkdir -p $SPL
#cp -f /usr/share/oem/ksplash/* $SPL
#fi

if grep -q kmix $HOME/.kde/share/config/ksmserverrc;then
rm -f $HOME/.kde/Autostart/kmix.desktop
fi

if [ ! -e $HOME/.menu ];then
mkdir $HOME/.menu
cd $HOME/.menu
cat << EOF > kdeutils-kcalc
?package(kdeutils): needs="x11" kde_filename="kcalc" section="Office" title="KCalc" icon="kcalc.png" command="kcalc" kde_command="kcalc  -caption \"%c\" %i %m" kde_opt="\\nEncoding=UTF-8\\nDocPath=kcalc/index.html\\nGenericName=Scientific Calculator\\nTerminal=0\\nX-KDE-StartupNotify=true"
EOF
cat << EOF > jpilot
?package(jpilot):   needs=x11  section=Office  title=J-Pilot  longtitle="A tools for your palm pilot"   icon=jpilot.png  command=jpilot
EOF
for files in aumix ee gtkam ImageMagick joe kdebase-kate \
	kdegraphics-kcolorchooser kdegraphics-kcoloredit kdegraphics-kiconedit \
	kdegraphics-kooka kdegraphics-kpaint kdegraphics-kpovmodeler \
	kdegraphics-kruler kdegraphics-kuickshow kdegraphics-kview \
	kdemultimedia-artsbuilder kdemultimedia-artscontrol kdemultimedia-kaboodle\
	kdemultimedia-kaudiocreator kdemultimedia-kmid kdemultimedia-ktimidity \
	kdemultimedia-noatun kdenetwork-kit kdepim-kandy kdepim-kpilot \
	kdeutils-khexedit chbg eog
do echo -n > $files
done
fi
update-menus
