%define qtversion 3.3.8

%define with_kontact 1

Name:          basket
Version:       1.0.3.1
Release:       1%{?_dist_release}
Summary:       Taking care of your ideas

Group:         Applications/Productivity
License:       GPLv2+
URL:           http://basket.kde.org/
Packager:      tomop
Source0:       http://basket.kde.org/downloads/%{name}-%{version}.tar.gz
# Make it appear in Kontact from enterprise branch
Patch0:        basket-1.0.2-kdepimenterprise.patch
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: kdelibs-devel gpgme-devel gettext desktop-file-utils arts-devel
BuildRequires: jack-audio-connection-kit
%if 0%{?with_kontact}
BuildRequires: kdepim-devel
%endif 
Requires:      arts jack-audio-connection-kit

%description
A multi-purpose note-taking application that makes it easy to write down ideas
as you think, and quickly find them later.  You can collect, import or share
any data, tag your notes and secure it some or all of it with passwords and/or
encryption.

%if 0%{?with_kontact}
%package kontact
Group:          Applications/Productivity
Summary:        Basket plugin for Kontact
Requires:       %{name} = %{version}-%{release}
Requires:       kdepim

%description kontact
This package contains the kontact plugin for BasKet.
%endif

%prep
%setup -q
iconv -f ISO_8859-1 -t UTF-8 AUTHORS > AUTHORS.tmp
touch -r AUTHORS AUTHORS.tmp
mv AUTHORS.tmp AUTHORS
%patch0 -p0 -b .kdepimenterprise

%build
unset QTDIR && . %{_sysconfdir}/profile.d/qt.sh
%configure --disable-rpath --disable-debug --with-qt-libraries=%{_libdir}/qt-%{qtversion}/lib
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

# Icons: use hicolor instead of crystalsvg
mv $RPM_BUILD_ROOT%{_datadir}/icons/{crystalsvg,hicolor}

# Menu
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install  --vendor fedora \
        --dir $RPM_BUILD_ROOT%{_datadir}/applications \
        --delete-original \
        --add-category Utility \
        --add-category Qt \
        --add-category KDE \
        $RPM_BUILD_ROOT%{_datadir}/applications/kde/%{name}.desktop

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la
# Removing a random sym link created during the build process
# This will be needed again when/if basket ever provides HTML docs -- Rex
rm -f $RPM_BUILD_ROOT%{_docdir}/HTML/en/basket/common

%{find_lang} %{name}
# HTML
for lang_dir in $RPM_BUILD_ROOT%{_docdir}/HTML/* ; do
  lang=$(basename $lang_dir)
  [ "$lang" == "en" ] && d=en/%{name} || d=$lang
  echo "%lang($lang) %doc %{_docdir}/HTML/$d" >> %{name}.lang
done

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc README AUTHORS COPYING ChangeLog NEWS TODO
%{_bindir}/basket
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/actions/*.png
%{_datadir}/icons/hicolor/*/mimetypes/*.png
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/apps/basket
%{_libdir}/kde3/kcm_basket.*
%{_libdir}/kde3/libbasketpart.*
%{_libdir}/kde3/basketthumbcreator.*
%{_libdir}/libbasketcommon.so
%{_datadir}/services/*.desktop
%{_datadir}/config/magic/basket.magic
%{_datadir}/mimelnk/application/*.desktop

%if 0%{?with_kontact}
%files kontact
%defattr(-,root,root,-)
%{_datadir}/apps/kontact/ksettingsdialog/kontact_basketplugin.setdlg
%{_datadir}/services/kontact/*.desktop
%{_libdir}/kde3/libkontact_basket.*
%endif

%post
/sbin/ldconfig
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
    %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi
update-desktop-database &> /dev/null || :

%postun
/sbin/ldconfig
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
    %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi
update-desktop-database &> /dev/null || :

%changelog
* Mon Jun  8 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.0.3.1-1
- built for Vine Linux.

    * Thu Dec 04 2008 Rex Dieter <rdieter@fedoraproject.org> 1.0.3.1-4
    - fix ->F-10+ upgrade path
    - Cannot configure basket, kcm_basket.la missing (#474425)
    - drop needless Requires: hicolor-icon-theme

    * Sat Nov 15 2008 Christopher D. Stover <quantumburnz@hotmail.com> 1.0.3.1-3
    - resolved kontact broken dependency

    * Mon Nov 10 2008 Christopher D. Stover <quantumburnz@hotmail.com> 1.0.3.1-2
    - added a requires for hicolor-icon-theme
    - removed -p from the main package /sbin/ldconfig

    * Sat Oct 25 2008 Christopher D. Stover <quantumburnz@hotmail.com> 1.0.3.1-1
    - version 1.0.3.1
    - gcc43 patch is no longer needed

    * Sat Jun 07 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 1.0.2-7
    - disable -kontact for F10+ (can't integrate KDE 3 app into KDE 4 Kontact)

    * Sun Jun 01 2008 Aurelien Bompard <abompard@fedoraproject.org> 1.0.2-6
    - rebuild

    * Wed Mar 02 2008 Rex Dieter <rdieter@fedoraproject.org> 1.0.2-5
    - fix rawhide build (#433960)
    - summary: s/for KDE//

    * Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> 1.0.2-4
    - Autorebuild for GCC 4.3

    * Sat Oct 27 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0.2-3
    - fix kontact plugin for kdepim-enterprise (bug 354771)

    * Sat Aug 25 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0.2-2
    - rebuild for BuildID
    - fix license tag

    * Tue Apr 24 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0.2-1
    - version 1.0.2 (bug 237660)

    * Sun Mar 18 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0.1-1
    - version 1.0.1

    * Sat Feb 17 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0-2
    - split off the kontact plugin, patch by Laurent Rineau (see bug 228966)

    * Mon Feb 12 2007 Aurelien Bompard <abompard@fedoraproject.org> 1.0-1
    - version 1.0

    * Wed Oct 25 2006 Aurelien Bompard <abompard@fedoraproject.org> 0.6.0-1
    - version 0.6.0

    * Thu Oct 05 2006 Christian Iseli <Christian.Iseli@licr.org> 0.5.0-10
    - rebuilt for unwind info generation, broken in gcc-4.1.1-21

    * Tue Sep 19 2006 Aurelien Bompard <abompard@fedoraproject.org> 0.5.0-9
    - add explicit linking to libfam

    * Tue Sep 19 2006 Aurelien Bompard <abompard@fedoraproject.org> 0.5.0-8
    - rebuild

    * Wed Aug 30 2006 Aurelien Bompard <abompard@fedoraproject.org> 0.5.0-7
    - BR: gamin-devel

    * Wed Aug 30 2006 Aurelien Bompard <abompard@fedoraproject.org> 0.5.0-6
    - rebuild

    * Tue Feb 21 2006 Aurelien Bompard <gauret[AT]free.fr> 0.5.0-5
    - rebuild for FC5

    * Mon Oct 17 2005 Aurelien Bompard <gauret[AT]free.fr> 0.5.0-4
    - add patch for 64 bits

    * Fri Oct 14 2005 Aurelien Bompard <gauret[AT]free.fr> 0.5.0-3
    - don't add the extension to the icon, it's useless
    - touch the icon dir in post and postun

    * Fri Oct 14 2005 Aurelien Bompard <gauret[AT]free.fr> 0.5.0-2
    - own the doc dir
    - use hicolor instead of crystalsvg as icon theme
    - add extension to the icon in the desktop file

    * Wed Oct 12 2005 Aurelien Bompard <gauret[AT]free.fr> 0.5.0-1
    - port to Fedora from Mandriva (release 3)
