repo
stringlengths 5
75
| commit
stringlengths 40
40
| message
stringlengths 6
18.2k
| diff
stringlengths 60
262k
|
---|---|---|---|
cayblood/lilypond-files | a485322e88b4a5a11bbc0d6f4af915220999036b | Began engraving "Go the Distance" | diff --git a/go_the_distance/go_the_distance.ly b/go_the_distance/go_the_distance.ly
new file mode 100644
index 0000000..6ff1c4b
--- /dev/null
+++ b/go_the_distance/go_the_distance.ly
@@ -0,0 +1,42 @@
+melody = \relative c'' {
+ \clef treble
+ \key a \major
+ \time 4/4
+
+ a b c d
+}
+
+text = \lyricmode {
+ Aaa Bee Cee Dee
+}
+
+upper = \relative c'' {
+ \clef treble
+ \key a \major
+ \time 4/4
+
+ a4 b c d
+}
+
+lower = \relative c {
+ \clef bass
+ \key a \major
+ \time 4/4
+
+ a2 c
+}
+
+\score {
+ <<
+ \new Voice = "mel" { \autoBeamOff \melody }
+ \new Lyrics \lyricsto mel \text
+ \new PianoStaff <<
+ \new Staff = "upper" \upper
+ \new Staff = "lower" \lower
+ >>
+ >>
+ \layout {
+ \context { \Staff \RemoveEmptyStaves }
+ }
+ \midi { }
+}
\ No newline at end of file
|
cayblood/lilypond-files | ffb2228dbb67571fb079ea3ff25e43fd0b46acc2 | Added some old lilypond projects | diff --git a/o_holy_night/o_holy_night.ly b/o_holy_night/o_holy_night.ly
new file mode 100755
index 0000000..f9cbdcc
--- /dev/null
+++ b/o_holy_night/o_holy_night.ly
@@ -0,0 +1,542 @@
+%{
+O Holy Night
+by Adolphe Adam
+arranged by Carl Deis
+
+notated by Carl Youngblood
+%}
+
+\paper {
+ #(set-paper-size "letter")
+ top-margin = 5\mm
+ bottom-margin = 5\mm
+ head-separation = 3\mm
+ page-top-space = 0\mm
+ between-system-padding = 2\mm
+ between-system-space = 1\mm
+ after-title-space = 0\mm
+ before-title-space = 0\mm
+ between-title-space = 0\mm
+}
+
+\header{
+ title = "O Holy Night"
+ subtitle = "Cantique de Noël"
+ composer = "Adolph Adam"
+ arranger = \markup{ \italic "arranged by Carl Deis"}
+ meter = "Andante maestoso"
+}
+
+sostenuto = \markup{ \italic sostenuto }
+cresc = \markup{ \italic "cresc." }
+dim = \markup{ \italic "dim." }
+tr = \markup{ \italic \bold "tr." }
+
+soprano = \relative {
+ \clef treble
+ \key ees \major
+ \time 12/8
+
+ r1.
+ r4. r8 r g'^\mf g4.~ g4 g8
+ bes4.~ bes4 bes8 c4 c8 aes4 c8
+ ees2. bes8 r bes g4 f8
+ ees4. g4 aes8 bes4. aes4 f8 % 5
+ ees1.
+
+ r2. g4.^\mf g4 g8
+ bes4.~ bes4 bes8 c4 c8 aes4 c8
+ ees2. bes8 r bes a4 g8
+ d'4.^\< bes4 c8 d4.\! \acciaccatura f8 ees4^\> d8 % 10
+ g,2.\! r4. r8 r bes
+ bes4. c f, bes
+ c4 bes8 ees4 g,8 c4. bes8 r bes
+ bes4.^\cresc c f, bes
+ c4 bes8 ees4 g,8 bes4.~ bes4 r8 % 15
+
+ ees2.~^\f ees4. d4 c8
+ d2.~ d4.~ d8 r d
+ f2.~ f4 c8 c4 c8
+ ees2. ees4. r8 r ees
+ g2.( f4.~ f4) bes,8 % 20
+ ees2.(~ ees4. d4) c8
+ bes2.~ bes4 bes8 \acciaccatura d c4 bes8
+ bes2.~ bes4. r8 r ees
+ f2.~^\cresc f4.~ f4 bes,8
+ g'2.~ g4. f % 25
+ ees2. d8[(^\dim ees16 d c d]) ees4 f8
+ ees2. r
+ r1. r r r % 30
+ r4. g,4. ees' bes
+ g ees4 c'8 bes4. aes4 aes8
+ g1. r r % 35
+ r4. g g cis,
+ d^\< g g4\! g8 fis4^\> a8
+ bes2.\! r
+ r1. % 40
+ r4. g^\cresc g g
+ aes2.~ aes4. aes
+ g4 g8 g4 g8 g4.~ g4 r8
+ g2.^\f g4. g
+ g2. g4. g % 45
+ aes2. aes4. aes
+ g2. g
+ r4. bes bes bes
+ bes2. aes
+ g4. g aes~ aes4 aes8 % 50
+ g2.~ g4. r
+ r r8 r bes bes2.~^\cresc
+ bes4. ees, bes' aes
+ g2. aes4.^\dim aes4 aes8
+ g2. r % 55
+ r1. r
+ r2. g4.^\mf g4 g8
+ bes4. bes4 bes8 c4. aes4 c8
+ ees2. bes8 r bes g4 f8 % 60
+ ees4. g4^\< aes8 bes4. c4 d8
+ ees1.\!
+ r2. g,4. g4 g8
+ g4. g4 g8 aes4. aes4 aes8
+ g2. g8 r bes^\< a4 g8\! % 65
+ d'4. d,4 d8 d4.^\> \acciaccatura f8 ees4 d8
+ g2.\! r4. r8 r g^\mf
+ aes4. aes aes aes
+ g4 g8 g4 ees8 ees4. ees8 r bes'
+ bes4.^\cresc c f, bes % 70
+ c4 bes8 ees4 g,8 bes4.~ bes4 r8
+ r4. g4.^\f g a
+ bes1.
+ f'2.-> c4 c8 c4 c8
+ ees2. ees4. r8 r ees % 75
+ g2.(-> f4.~ f4) bes,8
+ ees2.~ ees4. d4( c8)
+ bes2.~ bes4 bes8 \acciaccatura d8 c4 bes8
+ bes2.~ bes4. r8 r ees
+ f2.~ f4.~^\cresc f4 bes,8 % 80
+ bes'2.~( \times 3/2 { bes8[ aes] } \times 3/2 { g8[) f] }
+ ees4. ees d8[( ees16 d c d] ees4) f8
+ ees2. r
+ r1. r r r r \bar "|."
+}
+
+sopranotext = \lyricmode {
+% \override Score . LyricText #'font-size = #'-1
+ O ho -- ly night! __ the stars are bright -- ly shin -- ing,
+ It is the night of the dear Sav -- ior's birth;
+
+ Long lay the world __ in sin and er -- ror pin -- ing,
+ Till he ap -- peared, and the soul felt its worth.
+ A thrill of hope the wea -- ry world re -- joic -- es,
+ For yon -- der breaks a new and glo -- rious morn. __
+
+ Fall __ on your knees! __
+ Oh, hear __ the an -- gel voic -- es!
+ O night __ di -- vine! __
+ O night when Christ was born,
+ O night di -- vine!
+ O night, O __ night di -- vine!
+
+ With glow -- ing hearts by His cra -- dle we stand;
+ Here came the wise men from the O -- rient land.
+ In all our tri -- als born to be our friend;
+ He knows our need, to our weak -- ness no stran -- ger;
+ Be -- hold your King! be -- fore the low -- ly bend! __
+ Be -- hold __ your King! your King! be -- fore Him bend!
+ Tru -- ly He taught us to love one an -- oth -- er;
+ His law is Love and His Gos -- pel is Peace.
+ Chains shall He break, for the slave is our broth -- er,
+ And in His name all op -- pres -- sion shall cease.
+ Sweet hymns of joy in grate -- ful cho -- rus raise we,
+ Let all with -- in us praise His Ho -- ly name. __
+ Christ is the Lord
+ then ev -- er, ev -- er praise we,
+ His pow'r __ and glo -- ry __ ev -- er -- more pro -- claim, __
+ His pow'r __ and glo -- ry ev -- er -- more __ pro -- claim.
+}
+
+tenor = \relative {
+ \clef treble
+ \key ees \major
+ \time 12/8
+
+ r1. r r r r r % 5
+ r2. g'4.^\mf g4 g8
+ bes4.~ bes4 bes8 c4 c8 aes4 c8
+ ees2. bes8 r bes a4 g8
+ d'4.^\< bes4 c8 d4.\! \acciaccatura f8 ees4^\> d8 % 10
+ g,2.\! r
+ r1.
+ r2. r4. r8 r bes
+ bes4.^\cresc c f, bes
+ c4 bes8 ees4 g,8 bes4.~ bes4 r8 % 15
+
+ c2.~^\f c4. d4 c8
+ bes2.~ bes4.~ bes8 r bes
+ aes2.~ aes4 aes8 aes4 aes8
+ c2. c4. r8 r c
+ ees2.( d4.~ d4) bes8 % 20
+ ees4.( d c) aes
+ g2.( aes4) aes8 aes4 aes8
+ g2.~ g4. r8 r ees'
+ d2.~^\cresc d4.~ d4 bes8
+ ees4.( d c) aes % 25
+ g2. bes4.^\dim aes4 aes8
+ g2. r
+ r1. r
+ r2. g4.^\mf g4 g8 % 30
+ bes4.~ bes4 bes8 c4 c8 aes4 c8
+ ees2. bes8 r bes g4 f8
+ ees4. g4 aes8 bes4. c4 d8
+ ees1.
+ r2. g,4. g4 g8 % 35
+ bes4. bes4 bes8 c4. aes4 c8
+ ees2. bes8 r bes a4 g8
+ d'4^\< ees8 d4.~ d4\! d8 \grace { f( } ees4)^\> d8\!
+ g2. r4. r8 r bes,
+ bes4.^\cresc c f, bes % 40
+ c4 bes8 ees4 g,8 c4. bes8 r bes
+ bes4. c f, bes
+ c4 bes8 ees4 g,8 bes4.~ bes4 r8
+ ees2.~^\f ees4. d4 c8
+ d2.~ d4. d4 d8 % 45
+ f2.~->( f4 c8) c4 c8
+ ees2. ees4. r8 r ees
+ g2.( f4.~ f4) bes,8
+ ees2.~ ees4. d4( c8)
+ bes2.~ bes4 bes8 \acciaccatura d8 c4 bes8 % 50
+ bes2.~ bes4. r8 r ees
+ f2.~^\cresc f4. bes,
+ g'2.~ g4. f
+ ees2. d8[(^\dim ees16 d c d]) ees4 f8
+ ees2. r % 55
+ r1. r
+ r2. bes4. bes4 bes8
+ g4. g4 g8 aes4. c4 aes8
+ g2. g8 r g bes4 aes8 % 60
+ g4. bes4\< c8 bes4. aes4 aes8
+ g1.\!
+ r2. g4. g4 g8
+ bes4. bes4 bes8 c4. aes4 c8
+ ees2. bes8 r cis^\< cis4 cis8 % 65
+ d4.\! bes4 bes8 a4.^\> c4 c8
+ bes2.\! r4. r8 r bes
+ bes4. c f, bes
+ c4 bes8 ees4 g,8 c4. bes8 r bes
+ bes4.^\cresc c f, bes % 70
+ ees4 ees8 g( ees) bes g4.~ g4 r8
+ ees'2.~^\f ees4. d4 c8
+ d1.
+ aes'2.-> aes4.~ aes4 aes8
+ g2. g~ % 75
+ g4 r8 bes,4. c d
+ ees( d c) ees
+ g( ees d4) d8 d4 aes'8
+ g2.~ g4. r
+ r r8 r bes,^\cresc d4.~ d4 bes8 % 80
+ g'2.~( \times 3/2 { g8[ f] } \times 3/2 { c8[) aes] }
+ g4. g bes8[( c16 bes aes bes] c4) d8
+ ees2. r
+ r1. r r r r \bar "|."
+}
+
+tenortext = \lyricmode {
+% \override Score . LyricText #'font-size = #'-1
+ Long lay the world __ in sin and er -- ror pin -- ing,
+ Till he ap -- peared, and the soul felt its worth.
+ For yon -- der breaks a new and glo -- rious morn. __
+
+ Fall __ on your knees! __
+ Oh, hear __ the an -- gel voic -- es!
+ O night __ di -- vine! __
+ O night when Christ was born,
+ O night di -- vine!
+ O night, O __ night di -- vine!
+
+
+ Led by the light __ of Faith se -- rene -- ly beam -- ing,
+ With glow -- ing hearts by His cra -- dle we stand;
+ So led by light of a star sweet -- ly gleam -- ing,
+ Here came the wise men from __ the O -- rient land.
+ The King of Kings lay thus in low -- ly man -- ger,
+ In all our tri -- als born to be our friend;
+
+ He knows our need, to our weak -- ness no stran -- ger;
+ Be -- hold __ your King! be -- fore the low -- ly bend! __
+ Be -- hold __ your King! __ your King! be -- fore Him bend!
+ Tru -- ly He taught us to love one an -- oth -- er;
+ His law is Love and His Gos -- pel is Peace.
+ Chains shall He break, for the slave is our broth -- er,
+ And in His name all op -- pres -- sion shall cease.
+ Sweet hymns of joy in grate -- ful cho -- rus raise we,
+ Let all with -- in us praise His Ho -- ly name. __
+ Christ __ is the Lord
+ then ev -- er praise we, __
+ His pow'r and glo -- ry ev -- er -- more pro -- claim, __
+ His pow'r __ and glo -- ry ev -- er -- more __ pro -- claim.
+}
+
+upper = \relative {
+ \clef treble
+ \key ees \major
+ \time 12/8
+
+
+ g8^\sostenuto_\mf ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes d bes f' d bes % 5
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g cis bes g' cis, bes
+ g d' bes g' d bes a d c fis d c % 10
+ g d' bes g' d bes g d' bes g' d bes
+ aes d bes f' d bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ aes_\cresc d bes f' d bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes % 15
+ << { r8 ees c g' ees c r ees c g' ees c } \\ { g2. g }>>
+ << { r8 d' bes g' d bes r d bes g' d bes } \\ { g2. g }>>
+ << { r8 f' c aes' f c r f c aes' f c } \\ { aes2. aes }>>
+ << { r8 ees' c g' ees c r ees c g' ees c } \\ { g2. g }>>
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. f }>> % 20
+ << { r8 g' ees bes' g ees r ees c aes' ees c } \\ { bes2. aes }>>
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. aes }>>
+ << { r8 ees' bes g' ees bes r ees bes g' ees bes } \\ { g2. g }>>
+ << { r8 d' bes f' d bes r d bes f' d bes } \\ { f2. f }>>
+ << { r8 g' ees bes' g ees r f c aes' f c } \\ { bes2. aes }>> % 25
+ << { r8 ees' bes g' ees bes <f' d bes aes>4. r } \\ { g,2. }>>
+ << {
+ <ees' bes g>8 g,_\<( bes ees g bes \times 3/2 { ees8[ f] } \times 3/2 { g[ bes]\! }
+ \times 3/2 { bes8 aes } \times 3/2 { g f } ees2.
+ d2.^\markup{ \italic \bold "tr." } \grace { c16[ d] } ees2.)
+ } \\ {
+ s2. ees4. des
+ c4. ces <bes g>2.
+ bes2. g8 ees bes g' ees bes
+ } >>
+
+ g8 ees' bes g' ees bes g ees' bes g' ees bes % 30
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes g ees' bes g' ees bes % 35
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g cis bes g' cis, bes
+ g d' bes g' d bes a d c fis d c
+ g d' bes g' d bes g d' bes g' d bes
+ aes d bes f' d bes aes d bes f' d bes % 40
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ aes_\cresc d bes f' d bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ << { r8 ees c g' ees c r ees c g' ees c } \\ { g2. g }>>
+ << { r8 d' bes g' d bes r d bes g' d bes } \\ { g2. g }>> % 45
+ << { r8 f' c aes' f c r f c aes' f c } \\ { aes2. aes }>>
+ << { r8 ees' c g' ees c r ees c g' ees c } \\ { g2. g }>>
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. f }>>
+ << { r8 g' ees bes' g ees r ees c aes' ees c } \\ { bes2. aes }>>
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. aes }>> % 50
+ << { r8 ees' bes g' ees bes r ees bes g' ees bes } \\ { g2. g }>>
+ << { r8 d' bes f' d bes r d bes f' d bes } \\ { f2. f }>>
+ << { r8 g' ees bes' g ees r f c aes' f c } \\ { bes2. aes }>>
+ << { r8 ees' bes g' ees bes <f' d bes aes>4. r } \\ { g,2. }>>
+ << {
+ <ees' bes g>8 g,_\<( bes ees g bes \times 3/2 { ees8[ f] } \times 3/2 { g[ bes]\! } % 55
+ \times 3/2 { bes8 aes } \times 3/2 { g f } ees2.
+ d2.^\markup{ \italic \bold "tr." } \grace { c16[ d] } ees2.)
+ } \\ {
+ s2. ees4. des
+ c4. ces <bes g>2.
+ bes2. g8 ees bes g' ees bes
+ } >>
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g ees' bes g' ees bes % 60
+ g ees' bes g' ees bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ g ees' bes g' ees bes aes ees' c aes' ees c
+ g ees' bes g' ees bes g cis bes g' cis, bes % 65
+ g d' bes g' d bes a d c fis d c
+ g d' bes g' d bes g d' bes g' d bes
+ aes d bes f' d bes aes d bes f' d bes
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ aes_\cresc d bes f' d bes aes d bes f' d bes % 70
+ g ees' bes g' ees bes g ees' bes g' ees bes
+ << { r8 ees c g' ees c r ees c g' ees c } \\ { g2. g }>>
+ << { r8 d' bes g' d bes r d bes g' d bes } \\ { g2. g }>>
+ << { r8 f' c aes' f c r f c aes' f c } \\ { aes2. aes }>>
+ << { r8 ees' c g' ees c r ees c g' ees c } \\ { g2. g }>> % 75
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. f }>>
+ << { r8 g' ees bes' g ees r ees c aes' ees c } \\ { bes2. aes }>>
+ << { r8 ees' bes g' ees bes r d bes f' d bes } \\ { g2. aes }>>
+ << { r8 ees' bes g' ees bes r ees bes g' ees bes } \\ { g2. g }>>
+ << { r8 d' bes f' d bes r d bes f' d bes } \\ { f2. f }>> % 80
+ << { r8 g' ees bes' g ees r f c aes' f c } \\ { bes2. aes }>>
+ << { r8 ees' bes g' ees bes <f' d bes aes>4. r } \\ { g,2. }>>
+ <ees' bes g>4. r <ees' bes ees,>~ <ees bes ees,>4 <d bes ees,>8
+ << { d4.( c) <c aes f> <c aes f>4 <c aes f>8 } \\
+ { <aes ees>2. s_\< <aes' f bes, aes>2.^(_\ff\! <g ees bes g>4.) <f c aes> } >> % 85
+ << { s2. c32[( d ees d] d4~ \startTrillSpan
+ d \stopTrillSpan ees16[ f] ees1.) } \\
+ { <ees bes g>2. aes,_\markup{ \italic "dim. e rit."} g1. r } >>
+}
+
+lower = \relative c {
+ \clef bass
+ \key ees \major
+ \time 12/8
+
+ <ees bes ees,>1.
+ <ees bes ees,>
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,> <ees g,>
+ <bes bes,>1. % 5
+ <ees bes ees,>1.
+ <ees bes ees,>1.
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,> <ees ees,>
+ <d d,> <d d,> % 10
+ g, r
+ << { f'4. bes, f' bes, } \\ { d,1. } >>
+ << { ees'4. bes ees bes } \\ { ees,1. } >>
+ << { f'4. bes, f' bes, } \\ { d,1. } >>
+ << { ees'4. bes ees } \\ { ees,2.~ ees4. } >> r4. % 15
+ \grace { c16[(^\f g'] } <c c,>1.)
+ \grace { g,16[( d'] } <g g,>1.)
+ \grace { f,16[( c'] } <f f,>1.)
+ \grace { c16[( g'] } <c c,>1.)
+ <bes bes,>2. <aes aes,> % 20
+ <g g,> <aes aes,>
+ <bes bes,> <bes bes,>
+ <ees, ees,>4.^\cresc <g g,> <bes bes,> <ees ees,>
+ <bes bes,>2. <aes aes,>
+ <g g,> <aes aes,> % 25
+ <bes bes,>^\dim <bes bes,>4. r
+ ees r \clef treble << { r8 bes' ees bes' ees, bes } \\ { g2. } >>
+
+ \overrideProperty
+ #"Score.NonMusicalPaperColumn"
+ #'line-break-system-details
+ #'((fixed-alignment-extra-space . 10))
+
+ << {
+ r8 ees' aes~ aes aes ees \clef bass r8 ees, g bes^\> ees g
+ aes2. <ees, ees,>2.\!
+ } \\ {
+ aes2. bes,
+ bes'4. bes,
+ } >>
+ <ees bes ees,>1. % 30
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,>2. <ees g,>
+ <bes bes,>1.
+ <ees bes ees,>1.
+ <ees bes ees,>1. % 35
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,>2. <ees ees,>
+ <d d,> <d d,>
+ g, r
+ << { f'4. bes, f' bes, ees bes ees bes f' bes, f' bes, } \\ { d,1. ees d } >> % 40
+ << { ees'4. bes ees } \\ { ees,2.~ ees4. } >> r4.
+ \grace { c16[(^\f g'] } <c c,>1.)
+ \grace { g,16[( d'] } <g g,>1.) % 45
+ \grace { f,16[( c'] } <f f,>1.)
+ \grace { c16[( g'] } <c c,>1.)
+ <bes bes,>2. <aes aes,>
+ <g g,> <aes aes,>
+ <bes bes,> <bes bes,> % 50
+ <ees, ees,>4.^\cresc <g g,> <bes bes,> <ees ees,>
+ <bes bes,>2. <aes aes,>
+ <g g,> <aes aes,>
+ <bes bes,>^\dim <bes bes,>4. r
+
+ \overrideProperty
+ #"Score.NonMusicalPaperColumn"
+ #'line-break-system-details
+ #'((fixed-alignment-extra-space . 3))
+
+ ees r \clef treble << { r8 bes' ees bes' ees, bes } \\ { g2. } >> % 55
+ << {
+ r8 ees' aes~ aes aes ees \clef bass r8 ees, g bes^\> ees g
+ aes2. <ees, ees,>2.\!
+ } \\ {
+ aes2. bes,
+ bes'4. bes,
+ } >>
+
+ <ees bes ees,>1.
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,> <ees g,> % 60
+ <bes bes,>1.
+ <ees bes ees,>1.
+ <ees bes ees,>1.
+ <ees bes ees,>2. <ees aes,>
+ <ees bes ees,> <ees ees,> % 65
+ <d d,> <d d,>
+ g, r
+ << { f'4. bes, f' bes, } \\ { d,1. } >>
+ << { ees'4. bes ees bes } \\ { ees,1. } >>
+ << { f'4. bes, f' bes, } \\ { d,1. } >> % 70
+ << { ees'4. bes ees } \\ { ees,2.~ ees4. } >> r4.
+ \grace { c16[(^\f g'] } <c c,>1.)
+ \grace { g,16[( d'] } <g g,>1.)
+ \grace { f,16[( c'] } <f f,>1.)
+ \grace { c16[( g'] } <c c,>1.) % 75
+ <bes bes,>2. <aes aes,>
+ <g g,> <aes aes,>
+ <bes bes,> <bes bes,>
+ <ees, ees,>4.^\cresc <g g,> <bes bes,> <ees ees,>
+ <bes bes,>2. <aes aes,> % 80
+ <g g,> <aes aes,>
+
+ \overrideProperty
+ #"Score.NonMusicalPaperColumn"
+ #'line-break-system-details
+ #'((fixed-alignment-extra-space . 10))
+
+ <bes bes,> <bes bes,>4. r
+ << { ees,8^\< g bes ees g ees r8^\f\! bes ees g ees bes } \\ { s2. g } >>
+ << { r8 c ees aes ees c r aes c f c aes } \\ { aes2. f } >>
+
+ \overrideProperty
+ #"Score.NonMusicalPaperColumn"
+ #'line-break-system-details
+ #'((fixed-alignment-extra-space . 10))
+
+ << { r8 f bes d bes f r bes ees r f aes } \\ { d,,2. ees4. <aes aes,> } >> % 85
+ << { r8 ees' g bes g ees r f aes bes aes f } \\
+ { <bes, bes,>2. <bes bes,> } >>
+ << { ees8 g bes ees
+ \change Staff = upper \stemDown g bes ees bes g
+ \change Staff = lower \stemUp ees bes g ees1.^\p } \\ { ees,1. ees } >>
+}
+
+
+\score {
+ <<
+ \new Voice = "Soprano" {
+ \set Staff.instrumentName = "Soprano "
+ \transpose ees c \soprano
+ }
+ \new Lyrics \lyricsto Soprano \sopranotext
+
+ \new Voice = "Tenor" {
+ \set Staff.instrumentName = "Tenor "
+ \transpose ees c \tenor
+ }
+ \new Lyrics \lyricsto Tenor \tenortext
+
+ \new PianoStaff \with {
+ \override VerticalAlignment #'forced-distance = #10
+ } <<
+ \set PianoStaff.instrumentName = "Piano "
+ \transpose ees c \new Staff = "upper" \upper
+ \transpose ees c \new Staff = "lower" \lower
+ >>
+ >>
+}
+
+\version "2.11.0" % necessary for upgrading to future LilyPond versions.
\ No newline at end of file
diff --git a/redeemer_of_israel/redeemer_of_israel.ly b/redeemer_of_israel/redeemer_of_israel.ly
new file mode 100755
index 0000000..61220ce
--- /dev/null
+++ b/redeemer_of_israel/redeemer_of_israel.ly
@@ -0,0 +1,69 @@
+%{
+O Holy Night
+by Adolphe Adam
+arranged by Carl Deis
+
+notated by Carl Youngblood
+%}
+
+\paper {
+ #(set-paper-size "letter")
+ top-margin = 5\mm
+ bottom-margin = 5\mm
+ head-separation = 3\mm
+ page-top-space = 0\mm
+ between-system-padding = 2\mm
+ between-system-space = 1\mm
+ after-title-space = 0\mm
+ before-title-space = 0\mm
+ between-title-space = 0\mm
+}
+
+\header{
+ title = "O Holy Night"
+ subtitle = "Cantique de Noël"
+ composer = "Adolph Adam"
+ arranger = \markup{ \italic "arranged by Carl Deis"}
+ meter = "Andante maestoso"
+}
+
+sostenuto = \markup{ \italic sostenuto }
+cresc = \markup{ \italic "cresc." }
+dim = \markup{ \italic "dim." }
+tr = \markup{ \italic \bold "tr." }
+
+sa = \relative c' {
+ \clef treble
+ \key ees \major
+ \time 4/4
+
+ \partial 4*1 r4
+ r1 r r r r r r r r r r r r r r
+ r2. ees4 % 16
+ ees( f) g aes
+ bes2 c8( bes) aes4
+ g2 f4 f
+ ees2 r4 bes' % 20
+ ees2 ees4 ees
+ d( bes) c c
+ bes2 r4 bes
+ ees2 ees8( d) c4 % 24
+ bes2 g4 bes
+ c2 c8( bes) aes( g)
+ f4 r ees( g)
+ bes4.( c8) bes4 ees, % 28
+ g2 f4 f
+ ees2. r4
+ r1 r
+ << { r2. ees4 | ees( f) g aes | bes2 c8( bes) aes4 | g2 f4 f | ees2 r4 g | ees2 ees4 ees } \\
+ { s2. ee4 | ees( d) ees f | g2 aes8( g) f4 | ees2 d4 d | ees2 r4 ees | g2 g4 g } >>
+}
+
+\score {
+ <<
+ \new ChoirStaff = "S.A." {
+ \set Staff.instrumentName = "S.A."
+ \sa
+ }
+ >>
+}
\ No newline at end of file
diff --git a/the_spirit_of_god/guds_and_som_en_ild.ly b/the_spirit_of_god/guds_and_som_en_ild.ly
index 1a055d1..1b1c299 100644
--- a/the_spirit_of_god/guds_and_som_en_ild.ly
+++ b/the_spirit_of_god/guds_and_som_en_ild.ly
@@ -1,489 +1,489 @@
\version "2.12.3"
\header {
filename = "guds_and_som_en_ild.ly"
title = "Guds Ã
nd som en Ild"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
% copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
indent = 0.0\pt
page-limit-inter-system-space = ##t
page-limit-inter-system-space-factor = 1.1
top-margin = 1\cm
bottom-margin = 1\cm
left-margin = 1\cm
right-margin = 1\cm
first-page-number = #1
between-system-space = 3.0\cm
between-system-padding = #1
ragged-bottom=##t
ragged-last-bottom=##t
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem høy -- e til -- kom -- mer all æ -- re
nå __ og __ for e -- vig! A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
når lø -- ven lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
sian -- na, Ho -- sian -- na, for Gud og __ hans Sønn! __
For dem __ høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men. Ho -- sian -- na til vår Gud! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4 d8( e8) | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem i det høy -- e til -- kom -- mer all æ -- re
nå __ og __ for e -- vig! A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
når lø -- ven lam -- met de van -- dre sam -- men
fred og i ro. Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Gud og hans Sønn!
For dem __ i høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2 f4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til Ho -- sian -- na til __ vår __ Gud, Ho __ sian -- na! __
o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kan kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
\mark \default \break % A
f2 f4 f | f2 a4 bes | g2 f4 ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
\mark \default \break % B
f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. a4 |
a1 | b | b2 b | a4( g) a g |
a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
b1 | b2 b | a2. a4 | a a g a |
a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na vår Gud vår Gud Ho __ sian -- na! __
o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kan kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
For dem til -- kom -- mer æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
\mark \default \break % D
e1 | d | f | g |
c, | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
d1 | d | b'2 b | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e a |
b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
}
basswords = \lyricmode {
Ho -- sian -- na til vår Gud Ho -- sian -- na, Ho -- sian -- na, Ho -- sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na vår Gud Ho __ sian -- na! Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
Han at -- ter har gjen -- gitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem
til -- kom -- mer all æ -- re nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre skal sam -- men
i fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Sønn!
For dem til -- kom -- mer æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g2 g4 g |
e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
\mark \default \break % D
g1 | g | a | b |
c | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
a1 | a | d2 e | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e d |
g,2. r4 | f1 | d1 ~ | d2. \bar "|."
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
\context {
\Lyrics
% This helps layout. Don't change.
\override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
% Change the number to change the font size.
\override LyricText #'font-size = #-1.0
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
- tempoWholesPerMinute = #(ly:make-moment 64 2)
+ tempoWholesPerMinute = #(ly:make-moment 58 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | e3335935cc3de455717eea3f7b629a5f6cc74c7b | Changed tempo to 64 bpm | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 96f0dbe..a9c8622 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,481 +1,481 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
% copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
indent = 0.0\pt
page-limit-inter-system-space = ##t
page-limit-inter-system-space-factor = 1.1
top-margin = 1\cm
bottom-margin = 1\cm
left-margin = 1\cm
right-margin = 1\cm
first-page-number = #1
between-system-space = 3.0\cm
between-system-padding = #1
ragged-bottom=##t
ragged-last-bottom=##t
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry in the high -- est be giv -- en
Forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
san -- na, Ho -- san -- na to God and __ the lamb __ let
glo -- ry in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4( d8) e8 | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry to them in the high -- est be giv -- en
forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing and we'll shout with the ar -- mies of heav -- en Ho --
san -- na, Ho -- san -- na to God and __ the God and the lamb! Let
glo -- ry them in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to Ho -- san -- na, to __ the __ Lord Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry to them in the high -- est be giv -- en hence -- forth __
and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
Ho -- san -- na to the Lord! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
\mark \default \break % A
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
\mark \default \break % B
f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. a4 |
a1 | b | b2 b | a4( g) a g |
a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
b1 | b2 b | a2. a4 | a a g a |
a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na the Lord, the Lord, Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en __ hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry high -- est giv -- en hence -- forth __
and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
Ho -- san -- na to the Lord! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
\mark \default \break % D
e1 | d | f | g |
c, | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
d1 | d | b'2 b | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e a |
b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na the Lord, Ho -- san -- na Ho -- san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
The knowl -- edge and pow -- er God are ex -- pand -- ing;
The veil __ o'er the earth -- is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry __ high -- est be giv -- en
forth and for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it,
to spread forth the king -- dom heav -- en a -- broad,
How bless -- ed the day when the lamb and the li -- on shall
lie __ down to -- ge -- ther with -- out __ an -- y ire,
We'll sing shout ah ah Ho -- san -- na, ho -- san -- na to God __
and the lamb! Let glo -- ry high -- est giv -- en hence -- forth
and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
Ho -- san -- na to the Lord! A -- men! __
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g2 g4 g |
e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
\mark \default \break % D
g1 | g | a | b |
c | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
a1 | a | d2 e | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e d |
g,2. r4 | f1 | d1 ~ | d2. \bar "|."
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
\context {
\Lyrics
% This helps layout. Don't change.
\override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
% Change the number to change the font size.
\override LyricText #'font-size = #-1.0
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
- tempoWholesPerMinute = #(ly:make-moment 72 2)
+ tempoWholesPerMinute = #(ly:make-moment 64 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 1ca0a1f8bf15463b54e18c3a764297ea173017f1 | Changed tempo to 64 bpm | diff --git a/the_spirit_of_god/guds_and_som_en_ild.ly b/the_spirit_of_god/guds_and_som_en_ild.ly
index 73bac4b..1a055d1 100644
--- a/the_spirit_of_god/guds_and_som_en_ild.ly
+++ b/the_spirit_of_god/guds_and_som_en_ild.ly
@@ -1,489 +1,489 @@
\version "2.12.3"
\header {
filename = "guds_and_som_en_ild.ly"
title = "Guds Ã
nd som en Ild"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
% copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
indent = 0.0\pt
page-limit-inter-system-space = ##t
page-limit-inter-system-space-factor = 1.1
top-margin = 1\cm
bottom-margin = 1\cm
left-margin = 1\cm
right-margin = 1\cm
first-page-number = #1
between-system-space = 3.0\cm
between-system-padding = #1
ragged-bottom=##t
ragged-last-bottom=##t
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem høy -- e til -- kom -- mer all æ -- re
nå __ og __ for e -- vig! A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
når lø -- ven lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
sian -- na, Ho -- sian -- na, for Gud og __ hans Sønn! __
For dem __ høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men. Ho -- sian -- na til vår Gud! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4 d8( e8) | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem i det høy -- e til -- kom -- mer all æ -- re
nå __ og __ for e -- vig! A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
når lø -- ven lam -- met de van -- dre sam -- men
fred og i ro. Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Gud og hans Sønn!
For dem __ i høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2 f4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na til Ho -- sian -- na til __ vår __ Gud, Ho __ sian -- na! __
o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kan kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
\mark \default \break % A
f2 f4 f | f2 a4 bes | g2 f4 ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
\mark \default \break % B
f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. a4 |
a1 | b | b2 b | a4( g) a g |
a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
b1 | b2 b | a2. a4 | a a g a |
a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na vår Gud vår Gud Ho __ sian -- na! __
o -- ver jor -- den
og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kan kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre sam -- men
fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
For dem til -- kom -- mer æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
\mark \default \break % D
e1 | d | f | g |
c, | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
d1 | d | b'2 b | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e a |
b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
}
basswords = \lyricmode {
Ho -- sian -- na til vår Gud Ho -- sian -- na, Ho -- sian -- na, Ho -- sian -- na!
Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
vi sis -- te dags ver -- ket på jor -- den nå ser.
Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
og det som var ut -- talt, på jor -- den skal skje.
Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
For dem __ i det høy -- e til -- kom -- mer all æ -- re
fra nå __ og for e -- vig! A -- men, ja, a -- men.
Ho -- sian -- na vår Gud Ho __ sian -- na! Ho __ sian -- na!
Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
Han at -- ter har gjen -- gitt pres -- te -- døms or -- den,
og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
Vi syng lov ah ah dem
til -- kom -- mer all æ -- re nå __ og __ for e -- vig!
A -- men, ja, a -- men.
Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
så him -- me -- lens ri -- ke kom -- me her ned,
Vel -- sig -- net er dag -- en
når lø -- ven og lam -- met de van -- dre skal sam -- men
i fred og i ro. Vi syng lov ah ah
Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Sønn!
For dem til -- kom -- mer æ -- re
fra nå __ og __ for e -- vig!
A -- men, ja, a -- men. A -- men, ja, a -- men.
Ho -- sian -- na til vår Gud! A -- men! __
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g2 g4 g |
e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
\mark \default \break % D
g1 | g | a | b |
c | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
a1 | a | d2 e | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e d |
g,2. r4 | f1 | d1 ~ | d2. \bar "|."
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
\context {
\Lyrics
% This helps layout. Don't change.
\override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
% Change the number to change the font size.
\override LyricText #'font-size = #-1.0
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
- tempoWholesPerMinute = #(ly:make-moment 72 2)
+ tempoWholesPerMinute = #(ly:make-moment 64 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 370633784a503a29a2d3c9ad39dc2a86cbd1d111 | Added Norwegian version. Updated English version. | diff --git a/the_spirit_of_god/guds_and_som_en_ild.ly b/the_spirit_of_god/guds_and_som_en_ild.ly
new file mode 100644
index 0000000..73bac4b
--- /dev/null
+++ b/the_spirit_of_god/guds_and_som_en_ild.ly
@@ -0,0 +1,489 @@
+\version "2.12.3"
+\header {
+ filename = "guds_and_som_en_ild.ly"
+ title = "Guds Ã
nd som en Ild"
+ subtitle = \markup { \teeny "(Men's Choir)" }
+ arranger = "Music: Anonymous"
+ meter = "Words: William Wines Phelps (1792-1872)"
+% copyright = "© 2003 Michael Bearden"
+ enteredby = "Carl Youngblood"
+ lastupdated = "25 March 2010"
+ style = "Hymn"
+ tagline = \markup {
+ \override #'(box-padding . 1.0)
+ \override #'(baseline-skip . 2.7)
+ \center-align {
+ \line { \teeny
+ \line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
+ }
+ }
+ } % This sets the statement at the bottom of last page.
+}
+\paper {
+ indent = 0.0\pt
+ page-limit-inter-system-space = ##t
+ page-limit-inter-system-space-factor = 1.1
+ top-margin = 1\cm
+ bottom-margin = 1\cm
+ left-margin = 1\cm
+ right-margin = 1\cm
+ first-page-number = #1
+ between-system-space = 3.0\cm
+ between-system-padding = #1
+ ragged-bottom=##t
+ ragged-last-bottom=##t
+}
+
+global = {
+ \key bes \major
+ \time 4/4
+}
+tenoronenotes = \relative c {
+ \clef "G_8"
+ \partial 4
+ r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
+ g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
+ \mark \default \break % A
+ bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 g |
+ bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
+ d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
+ bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
+ d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
+ d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
+ f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
+ d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
+ \mark \default \break % B
+ bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
+ c1 | d2. g,4 \bar "||"
+ \mark \default \break \key c \major % C
+ c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
+ e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
+ c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
+ e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
+ \mark \default \break % D
+ c1 | b | c | d |
+ e | f2 f4 f | d4.( e8) f4 c | e2 e |
+ c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
+ \mark \default \break % E
+ c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
+ r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
+ f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
+ f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
+ \mark \default \break % F
+ \key d \major d1 | cis | d | e |
+ d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
+ fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
+ fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
+ fis1 | e2 g | fis2. a,4 | d e fis a |
+ a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
+}
+tenoronewords = \lyricmode {
+ Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
+ Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
+ vi sis -- te dags ver -- ket på jor -- den nå ser.
+ Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
+ og det som var ut -- talt, på jor -- den skal skje.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og for e -- vig! A -- men, ja, a -- men.
+ Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
+ Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
+ og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
+ Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
+ det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
+ Vi syng lov ah ah dem høy -- e til -- kom -- mer all æ -- re
+ nå __ og __ for e -- vig! A -- men, ja, a -- men.
+ Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
+ Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
+ når lø -- ven lam -- met de van -- dre sam -- men
+ fred og i ro. Vi syng lov ah ah
+ sian -- na, Ho -- sian -- na, for Gud og __ hans Sønn! __
+ For dem __ høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
+ A -- men, ja, a -- men. A -- men, ja, a -- men. Ho -- sian -- na til vår Gud! __
+}
+tenortwonotes = \relative c {
+ \clef "G_8"
+ \partial 4
+ r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
+ g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
+ \mark \default \break % A
+ bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
+ d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
+ bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
+ d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
+ f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
+ bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
+ d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
+ bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
+ \mark \default \break % B
+ bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
+ c1 | d2. g,4 \bar "||"
+ \mark \default \break \key c \major % C
+ c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
+ e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
+ c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
+ e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
+ \mark \default \break % D
+ g1 | g | a | b |
+ e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
+ c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
+ \mark \default \break % E
+ c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
+ r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
+ des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
+ des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
+ d2 cis4 d | b2 cis4 b | d2 e4 d8( e8) | d4 cis8 b cis4 e |
+ e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
+ fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
+ fis1 | e2 g | fis2. a,4 | d cis d fis |
+ fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
+}
+tenortwowords = \lyricmode {
+ Ah __ sian -- na, Ho -- sian -- na, Ho __ sian -- na!
+ Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
+ vi sis -- te dags ver -- ket på jor -- den nå ser.
+ Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
+ og det som var ut -- talt, på jor -- den skal skje.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og for e -- vig! A -- men, ja, a -- men.
+ Ho -- sian -- na til __ vår __ Gud Ho -- sian -- na, Ho __ sian -- na!
+ Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
+ og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
+ Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
+ det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
+ Vi syng lov ah ah dem i det høy -- e til -- kom -- mer all æ -- re
+ nå __ og __ for e -- vig! A -- men, ja, a -- men.
+ Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
+ Ah __ kan kom -- me her ned, Vel -- sig -- net er dag -- en
+ når lø -- ven lam -- met de van -- dre sam -- men
+ fred og i ro. Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Gud og hans Sønn!
+ For dem __ i høy -- e til -- kom -- mer all æ -- re fra nå __ for e -- vig!
+ A -- men, ja, a -- men. A -- men, ja, a -- men.
+ Ho -- sian -- na til vår Gud! A -- men! __
+}
+barionenotes = \relative c' {
+ \clef "G_8"
+ \partial 4
+ r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
+ f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
+ \mark \default \break % A
+ ees2 a4 a | bes2 a4 bes | bes2 f4 bes | bes2 bes4 bes8( c) |
+ f,2 bes4 bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
+ bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
+ f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
+ bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
+ bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
+ bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
+ bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
+ \mark \default \break % B
+ bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
+ \mark \default \break \key c \major % C
+ r | r | r2 f,8( g) a( b) |
+ c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
+ g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
+ c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
+ \mark \default \break % D
+ g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
+ c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
+ a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
+ e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
+ aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
+ aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
+ \mark \default \break % F
+ \key d \major fis1 | e | g | a2 a |
+ fis2 a4 a | a( g) g2 | b b | a2. e'4 |
+ fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
+ d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
+ d1 | cis2 e | e4( d2) a4 | b a b cis |
+ d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
+}
+barionewords = \lyricmode {
+ Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
+ Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
+ vi sis -- te dags ver -- ket på jor -- den nå ser.
+ Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
+ og det som var ut -- talt, på jor -- den skal skje.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og for e -- vig! A -- men, ja, a -- men.
+ Ho -- sian -- na til Ho -- sian -- na til __ vår __ Gud, Ho __ sian -- na! __
+ o -- ver jor -- den
+ og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
+ Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
+ og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
+ til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
+ A -- men, ja, a -- men.
+ Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
+ så him -- me -- lens ri -- ke kan kom -- me her ned,
+ Vel -- sig -- net er dag -- en
+ når lø -- ven og lam -- met de van -- dre sam -- men
+ fred og i ro. Vi syng lov ah ah
+ Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og __ for e -- vig!
+ A -- men, ja, a -- men. A -- men, ja, a -- men.
+ Ho -- sian -- na til vår Gud! A -- men! __
+}
+baritwonotes = \relative c {
+ \clef "G_8"
+ f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
+ bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
+ \mark \default \break % A
+ f2 f4 f | f2 a4 bes | g2 f4 ees | f4.( ees8) d4 f8( ees) |
+ d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
+ f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
+ d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
+ f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
+ f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
+ bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
+ f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
+ \mark \default \break % B
+ f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
+ \mark \default \break \key c \major % C
+ r | r | r2 f8( g) a( b) |
+ c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
+ g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
+ c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
+ \mark \default \break % D
+ g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
+ g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
+ f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
+ e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
+ aes2 c4 c | des2 aes4 aes | aes ges2 ges4 | aes2 aes4 aes |
+ aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
+ \mark \default \break % F
+ \key d \major fis1 | e | g | a2 a |
+ fis2 a4 a | a( g) g2 | b b | a2. a4 |
+ a1 | b | b2 b | a4( g) a g |
+ a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
+ b1 | b2 b | a2. a4 | a a g a |
+ a1 ~ | a ~ | a ~ | a2. \bar "|."
+}
+baritwowords = \lyricmode {
+ Ho -- sian -- na, __ Ah Ho -- sian -- na, Ho -- sian -- na, Ho __ sian -- na!
+ Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
+ vi sis -- te dags ver -- ket på jor -- den nå ser.
+ Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
+ og det som var ut -- talt, på jor -- den skal skje.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og for e -- vig! A -- men, ja, a -- men.
+ Ho -- sian -- na vår Gud vår Gud Ho __ sian -- na! __
+ o -- ver jor -- den
+ og sam -- ler hver hel -- lig tross mørk -- het -- ens makt.
+ Han at -- ter har gjen -- gitt sitt pres -- te -- døms or -- den,
+ og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re for dem
+ til -- kom -- mer all æ -- re fra nå __ og __ for e -- vig!
+ A -- men, ja, a -- men.
+ Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
+ så him -- me -- lens ri -- ke kan kom -- me her ned,
+ Vel -- sig -- net er dag -- en
+ når lø -- ven og lam -- met de van -- dre sam -- men
+ fred og i ro. Vi syng lov ah ah
+ Ho -- sian -- na, Ho -- sian -- na, Gud og Sønn!
+ For dem til -- kom -- mer æ -- re
+ fra nå __ og __ for e -- vig!
+ A -- men, ja, a -- men. A -- men, ja, a -- men.
+ Ho -- sian -- na til vår Gud! __
+}
+bassonenotes = \relative c {
+ \clef bass
+ \partial 4
+ r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
+ \mark \default \break % A
+ d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
+ d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
+ bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
+ d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
+ bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
+ bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
+ bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
+ \mark \default \break % B
+ bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
+ \mark \default \break \key c \major % C
+ e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
+ r1 | r | r | r2. f4 |
+ e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
+ e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
+ \mark \default \break % D
+ e1 | d | f | g |
+ c, | c | c2 d4 c | b2 e |
+ f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
+ a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
+ des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
+ f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major
+ a1 | a | b | cis2 cis |
+ d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
+ d1 | d | b'2 b | a4( g) fis e |
+ d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
+ g1 | g2 e | d2. a'4 | g fis e a |
+ b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
+}
+basswords = \lyricmode {
+ Ho -- sian -- na til vår Gud Ho -- sian -- na, Ho -- sian -- na, Ho -- sian -- na!
+ Guds ånd som en ild nå be -- gyn -- ner å lu -- e,
+ vi sis -- te dags ver -- ket på jor -- den nå ser.
+ Ja, fe -- dre -- nes håp vi be -- gyn -- ner å sku -- e,
+ og det som var ut -- talt, på jor -- den skal skje.
+ Vi syng -- er en lov -- sang med him -- me -- lens hæ -- re:
+ Ho -- sian -- na, Ho -- sian -- na for Gud og hans Sønn!
+ For dem __ i det høy -- e til -- kom -- mer all æ -- re
+ fra nå __ og for e -- vig! A -- men, ja, a -- men.
+ Ho -- sian -- na vår Gud Ho __ sian -- na! Ho __ sian -- na!
+ Nå Herr -- en har ut -- rakt sin hånd o -- ver jor -- den
+ Han at -- ter har gjen -- gitt pres -- te -- døms or -- den,
+ og det -- te for -- kyn -- ner hans e -- vi -- ge pakt.
+ Vi syng lov ah ah dem
+ til -- kom -- mer all æ -- re nå __ og __ for e -- vig!
+ A -- men, ja, a -- men.
+ Vi ik -- ler oss al -- le en ån -- de -- lig styr -- ke
+ så him -- me -- lens ri -- ke kom -- me her ned,
+ Vel -- sig -- net er dag -- en
+ når lø -- ven og lam -- met de van -- dre skal sam -- men
+ i fred og i ro. Vi syng lov ah ah
+ Ho -- sian -- na, Ho -- sian -- na, for Gud og hans Sønn!
+ For dem til -- kom -- mer æ -- re
+ fra nå __ og __ for e -- vig!
+ A -- men, ja, a -- men. A -- men, ja, a -- men.
+ Ho -- sian -- na til vår Gud! A -- men! __
+}
+basstwonotes = \relative c {
+ \clef bass
+ \partial 4
+ r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
+ \mark \default \break % A
+ d2 f4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 f |
+ d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
+ bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
+ d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
+ bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
+ bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
+ bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
+ \mark \default \break % B
+ bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
+ \mark \default \break \key c \major % C
+ e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
+ r1 | r | r | r2. f4 |
+ e2 d4 d | a2 g | f d4 a' | g2 g4 g |
+ e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
+ \mark \default \break % D
+ g1 | g | a | b |
+ c | c | c2 d4 c | b2 e |
+ f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
+ a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
+ des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
+ f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major
+ a1 | a | b | cis2 cis |
+ d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
+ a1 | a | d2 e | a4( g) fis e |
+ d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
+ g1 | g2 e | d2. a'4 | g fis e d |
+ g,2. r4 | f1 | d1 ~ | d2. \bar "|."
+}
+
+\score{
+ \context ChoirStaff
+ <<
+ \context Staff = tenorone <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = tenone {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \tenoronenotes >>
+ }
+ \lyricsto "tenone" \new Lyrics \tenoronewords
+ >>
+ \context Staff = tenortwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = tentwo {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \tenortwonotes >>
+ }
+ \lyricsto "tentwo" \new Lyrics \tenortwowords
+ >>
+ \context Staff = barione <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = barone {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \barionenotes >>
+ }
+ \lyricsto "barone" \new Lyrics \barionewords
+ >>
+ \context Staff = baritwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = bartwo {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \baritwonotes >>
+ }
+ \lyricsto "bartwo" \new Lyrics \baritwowords
+ >>
+ \context Staff = bassone <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = basone {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \bassonenotes >>
+ }
+ \lyricsto "basone" \new Lyrics \basswords
+ >>
+ \context Staff = basstwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
+ \context Voice = bastwo {
+ \set midiInstrument = #"Choir Aahs"
+ << \global \basstwonotes >>
+ }
+ \lyricsto "bastwo" \new Lyrics \basswords
+ >>
+ >>
+
+ \layout {
+ \context {
+ \Lyrics
+
+ % This helps layout. Don't change.
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
+
+ % Change the number to change the font size.
+ \override LyricText #'font-size = #-1.0
+ }
+ }
+
+ \midi {
+ \context {
+ \Staff
+ \remove "Staff_performer"
+ }
+ \context {
+ \Voice
+ \consists "Staff_performer"
+ }
+ \context {
+ \Score
+ tempoWholesPerMinute = #(ly:make-moment 72 2)
+ }
+ }
+}
\ No newline at end of file
diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index ed60c51..96f0dbe 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,481 +1,481 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
% copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
indent = 0.0\pt
page-limit-inter-system-space = ##t
page-limit-inter-system-space-factor = 1.1
top-margin = 1\cm
bottom-margin = 1\cm
left-margin = 1\cm
right-margin = 1\cm
first-page-number = #1
between-system-space = 3.0\cm
between-system-padding = #1
ragged-bottom=##t
ragged-last-bottom=##t
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry in the high -- est be giv -- en
Forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
san -- na, Ho -- san -- na to God and __ the lamb __ let
glo -- ry in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4( d8) e8 | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry to them in the high -- est be giv -- en
forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing and we'll shout with the ar -- mies of heav -- en Ho --
san -- na, Ho -- san -- na to God and __ the God and the lamb! Let
glo -- ry them in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
- f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
+ f,2 bes4 bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to Ho -- san -- na, to __ the __ Lord Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry to them in the high -- est be giv -- en hence -- forth __
and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
Ho -- san -- na to the Lord! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
\mark \default \break % A
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
\mark \default \break % B
f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. a4 |
a1 | b | b2 b | a4( g) a g |
a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
b1 | b2 b | a2. a4 | a a g a |
a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na the Lord, the Lord, Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en __ hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry high -- est giv -- en hence -- forth __
and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
Ho -- san -- na to the Lord! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
\mark \default \break % D
e1 | d | f | g |
c, | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
d1 | d | b'2 b | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e a |
b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na the Lord, Ho -- san -- na Ho -- san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
The knowl -- edge and pow -- er God are ex -- pand -- ing;
The veil __ o'er the earth -- is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry __ high -- est be giv -- en
forth and for -- e -- ver, a -- men and a -- men!
We'll call __ in our sol -- emn as -- sem -- blies in spir -- it,
to spread forth the king -- dom heav -- en a -- broad,
How bless -- ed the day when the lamb and the li -- on shall
lie __ down to -- ge -- ther with -- out __ an -- y ire,
We'll sing shout ah ah Ho -- san -- na, ho -- san -- na to God __
and the lamb! Let glo -- ry high -- est giv -- en hence -- forth
and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
Ho -- san -- na to the Lord! A -- men! __
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
\mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
\mark \default \break % B
bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
\mark \default \break \key c \major % C
e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
r1 | r | r | r2. f4 |
e2 d4 d | a2 g | f d4 a' | g2 g4 g |
e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
\mark \default \break % D
g1 | g | a | b |
c | c | c2 d4 c | b2 e |
f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
\mark \default \break % E
c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
\mark \default \break % F
\key d \major
a1 | a | b | cis2 cis |
d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
a1 | a | d2 e | a4( g) fis e |
d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
g1 | g2 e | d2. a'4 | g fis e d |
g,2. r4 | f1 | d1 ~ | d2. \bar "|."
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
\context {
\Lyrics
% This helps layout. Don't change.
\override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
% Change the number to change the font size.
\override LyricText #'font-size = #-1.0
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 8a5cd597b300330f73890fe19b6788f596405069 | Finished English version | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 0512fac..ed60c51 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,410 +1,481 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
- copyright = "© 2003 Michael Bearden"
+% copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
- #(set-paper-size "a4")
- top-margin = 0.7\cm
+ indent = 0.0\pt
+ page-limit-inter-system-space = ##t
+ page-limit-inter-system-space-factor = 1.1
+ top-margin = 1\cm
+ bottom-margin = 1\cm
+ left-margin = 1\cm
+ right-margin = 1\cm
+ first-page-number = #1
+ between-system-space = 3.0\cm
+ between-system-padding = #1
+ ragged-bottom=##t
+ ragged-last-bottom=##t
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
- Let glo -- ry to them in the high -- est be giv -- en, __
+ Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry in the high -- est be giv -- en
Forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
san -- na, Ho -- san -- na to God and __ the lamb __ let
glo -- ry in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4( d8) e8 | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
- Let glo -- ry to them in the high -- est be giv -- en, __
+ Let glo -- ry to them in the high -- est be giv -- en,
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry to them in the high -- est be giv -- en
forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing and we'll shout with the ar -- mies of heav -- en Ho --
- san -- na, Ho -- san -- na to God and __ the God and the lamb let
+ san -- na, Ho -- san -- na to God and __ the God and the lamb! Let
glo -- ry them in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
- c1 | c | c2 d4 c |
- b( a) gis8( a) b( gis) | a4.( g8) a( b) c( d) | e4( c) a d |
- c2 b4 b | c2. g4 \bar "||"
+ c1 | c | c2 d4 c | b( a) gis8( a) b( gis) |
+ a4.( g8) a( b) c( d) | e4( c) a d | c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
- Let glo -- ry to them in the high -- est be giv -- en, __
- Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Let glo -- ry to them in the high -- est be giv -- en,
+ Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to Ho -- san -- na, to __ the __ Lord Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
- let glo -- ry __ high -- est be giv -- en __ hence -- forth __
+ let glo -- ry __ high -- est be giv -- en hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
- We'll call in our sol -- emn as -- sem -- blies in spir -- it
+ We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
- Ho -- san -- na, Ho -- san -- na God and lamb let
+ Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry to them in the high -- est be giv -- en hence -- forth __
and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
Ho -- san -- na to the Lord! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
\mark \default \break % A
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
\mark \default \break % B
f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
- g,1 | a | a2 c4 c |
- a2 gis8( a) b( gis) | f4.( g8) g( b) g( d') | e4( c) a a |
- g2 g4 g | g2. g4 \bar "||"
+ g,1 | a | a2 c4 c | a2 gis8( a) b( gis) |
+ f4.( g8) g( b) g( d') | e4( c) a a | g2 g4 g | g2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. a4 |
a1 | b | b2 b | a4( g) a g |
a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
b1 | b2 b | a2. a4 | a a g a |
a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
- Let glo -- ry to them in the high -- est be giv -- en, __
- Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Let glo -- ry to them in the high -- est be giv -- en,
+ Hence -- forth and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na the Lord, the Lord, Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en __ hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
- We'll call in our sol -- emn as -- sem -- blies in spir -- it
+ We'll call __ in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
- Ho -- san -- na, Ho -- san -- na God and lamb let
+ Ho -- san -- na, Ho -- san -- na God and lamb! Let
glo -- ry high -- est giv -- en hence -- forth __
- and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
+ and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
Ho -- san -- na to the Lord! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
+ \mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
- bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
+ \mark \default \break % B
+ bes, bes2 bes4 | ees2. ees4 | aes,4. aes8 aes2 | g1 | g2. f'4 \bar "||"
+ \mark \default \break \key c \major % C
+ e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
+ r1 | r | r | r2. f4 |
+ e2 d4 d | a2 g | f d4 a' | g'2 g4 f |
+ e( d) c c | b( g) f f | g2 g4 g | c2 f \bar "||"
+ \mark \default \break % D
+ e1 | d | f | g |
+ c, | c | c2 d4 c | b2 e |
+ f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
+ a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
+ des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
+ f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major
+ a1 | a | b | cis2 cis |
+ d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
+ d1 | d | b'2 b | a4( g) fis e |
+ d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
+ g1 | g2 e | d2. a'4 | g fis e a |
+ b2. r4 | a2( c) | d,1 ~ | d2. \bar "|."
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
- Let glo -- ry to them in the high -- est be giv -- en, __
- Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Let glo -- ry to them in the high -- est be giv -- en,
+ Hence -- forth and for -- ev -- er, A -- men and a -- men!
+ Ho -- san -- na the Lord, Ho -- san -- na Ho -- san -- na!
+ The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
+ The knowl -- edge and pow -- er God are ex -- pand -- ing;
+ The veil __ o'er the earth -- is be -- gin -- ning to burst.
+ We'll sing shout ah ah glo -- ry __ high -- est be giv -- en
+ forth and for -- e -- ver, a -- men and a -- men!
+ We'll call __ in our sol -- emn as -- sem -- blies in spir -- it,
+ to spread forth the king -- dom heav -- en a -- broad,
+ How bless -- ed the day when the lamb and the li -- on shall
+ lie __ down to -- ge -- ther with -- out __ an -- y ire,
+ We'll sing shout ah ah Ho -- san -- na, ho -- san -- na to God __
+ and the lamb! Let glo -- ry high -- est giv -- en hence -- forth
+ and for -- e -- ver, a -- men and a -- men! A -- men and a -- men!
+ Ho -- san -- na to the Lord! A -- men! __
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
+ \mark \default \break % A
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
- bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f'4 |
+ \mark \default \break % B
+ bes, bes2 bes4 | ees,2. ees4 | aes4. aes8 aes2 | g1 | g2. f'4 \bar "||"
+ \mark \default \break \key c \major % C
+ e2 g4 g | c2 g4 a | f2 f4 f | c2 d |
+ r1 | r | r | r2. f4 |
+ e2 d4 d | a2 g | f d4 a' | g2 g4 g |
+ e'( d) c c | b( g) f f | g2 g4 g | c2 a \bar "||"
+ \mark \default \break % D
+ g1 | g | a | b |
+ c | c | c2 d4 c | b2 e |
+ f e4 d | c2 f,4 f | g2 g4 g | c2. g'4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | a( g) f e | d( e8 f) g4 g | c,2 c4 b |
+ a2 g4 g | f2 f | g g4 g \bar "||" \key des \major aes2 r4 aes |
+ des2 ees4 ees | f2 ees4 des | des2 c4 bes | aes4.( bes8) aes4 ges |
+ f( aes) des f | ees( aes,) bes ges' | f( ees) des c | des2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major
+ a1 | a | b | cis2 cis |
+ d2 d4 d | g,2 g4 fis | e( fis) g b | a2. a4 |
+ a1 | a | d2 e | a4( g) fis e |
+ d2 d4 d | g( e) fis g | a( a,) a a | d2. d4 |
+ g1 | g2 e | d2. a'4 | g fis e d |
+ g,2. r4 | f1 | d1 ~ | d2. \bar "|."
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
+ \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-4.3 . 4.3)
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
- % The lines below help layout the page in a nice way. Don't delete or alter.
- indent = 0.0\pt
- first-page-number = #1
- between-system-padding = #0.2
- between-system-space = #0.2
- ragged-last-bottom = ##f
- ragged-bottom = ##f
\context {
\Lyrics
% This helps layout. Don't change.
- \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0)
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(1.0 . 1.0)
% Change the number to change the font size.
- \override LyricText #'font-size = #-.575
+ \override LyricText #'font-size = #-1.0
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | ad6d9d2af861e1c3cebeaa8492cfa46fc1554ff3 | Finished bari two | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 746b4fc..0512fac 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,369 +1,410 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
#(set-paper-size "a4")
top-margin = 0.7\cm
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
\mark \default \break % D
c1 | b | c | d |
e | f2 f4 f | d4.( e8) f4 c | e2 e |
c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
\mark \default \break % F
\key d \major d1 | cis | d | e |
d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d e fis a |
a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry in the high -- est be giv -- en
Forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
san -- na, Ho -- san -- na to God and __ the lamb __ let
glo -- ry in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
\mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
\mark \default \break % B
bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
c1 | d2. g,4 \bar "||"
\mark \default \break \key c \major % C
c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
\mark \default \break % D
g1 | g | a | b |
e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
\mark \default \break % E
c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
\mark \default \break % F
\key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
d2 cis4 d | b2 cis4 b | d2 e4( d8) e8 | d4 cis8 b cis4 e |
e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
fis1 | e2 g | fis2. a,4 | d cis d fis |
fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
re -- stor -- ing their judg -- es and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing shout ah ah glo -- ry to them in the high -- est be giv -- en
forth __ and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it,
Ah __ of heav -- en a -- broad, How bless -- ed the day
when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing and we'll shout with the ar -- mies of heav -- en Ho --
san -- na, Ho -- san -- na to God and __ the God and the lamb let
glo -- ry them in the high -- est be giv -- en hence forth for -- ev -- er,
a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
\mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
\mark \default \break % B
bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
\mark \default \break \key c \major % C
r | r | r2 f,8( g) a( b) |
c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
\mark \default \break % D
g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
c1 | c | c2 d4 c |
b( a) gis8( a) b( gis) | a4.( g8) a( b) c( d) | e4( c) a d |
c2 b4 b | c2. g4 \bar "||"
\mark \default \break % E
c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
\mark \default \break % F
\key d \major fis1 | e | g | a2 a |
fis2 a4 a | a( g) g2 | b b | a2. e'4 |
fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
d1 | cis2 e | e4( d2) a4 | b a b cis |
d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
Ho -- san -- na to Ho -- san -- na, to __ the __ Lord Ho -- san -- na!
un -- der -- stand -- ing, re -- stor -- ing their judg -- es
and all __ as at first.
The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
The veil __ o'er the earth __ is be -- gin -- ning to burst.
We'll sing and we'll shout with the ar -- mies of heav -- en
let glo -- ry __ high -- est be giv -- en __ hence -- forth __
and __ for -- e -- ver, a -- men and a -- men!
We'll call in our sol -- emn as -- sem -- blies in spir -- it
to spread forth the king -- dom of heav -- en a -- broad.
How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
out __ an -- y ire, We'll sing shout ah ah
Ho -- san -- na, Ho -- san -- na God and lamb let
glo -- ry to them in the high -- est be giv -- en hence -- forth __
and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
Ho -- san -- na to the Lord! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
+ \mark \default \break % A
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
+ \mark \default \break % B
+ f f2 f4 | g2. g4 | aes2 aes | a!1 | b \bar "||"
+ \mark \default \break \key c \major % C
+ r | r | r2 f8( g) a( b) |
+ c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
+ g2. f,4 | g2 g4 g | e( a) g g | f( a) f8( g) a( b) |
+ c2 b4 f | e( d) g g | g( e) c d | e( d) c d | e2 f \bar "||"
+ \mark \default \break % D
+ g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
+ g,1 | a | a2 c4 c |
+ a2 gis8( a) b( gis) | f4.( g8) g( b) g( d') | e4( c) a a |
+ g2 g4 g | g2. g4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
+ e( g) g g | a( g) f f | g2 g4 b \bar "||" \key des \major aes2 r4 aes |
+ aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
+ aes2 aes | aes ges | ees4( ges) ges ges | aes2. f4 \bar "||"
+ \mark \default \break % F
+ \key d \major fis1 | e | g | a2 a |
+ fis2 a4 a | a( g) g2 | b b | a2. a4 |
+ a1 | b | b2 b | a4( g) a g |
+ a2 a4 a | b2 a4 b | a2 a4 a | a2. a4 |
+ b1 | b2 b | a2. a4 | a a g a |
+ a1 ~ | a ~ | a ~ | a2. \bar "|."
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Ho -- san -- na the Lord, the Lord, Ho -- san -- na!
+ un -- der -- stand -- ing, re -- stor -- ing their judg -- es
+ and all __ as at first.
+ The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
+ The veil __ o'er the earth __ is be -- gin -- ning to burst.
+ We'll sing and we'll shout with the ar -- mies of heav -- en
+ let glo -- ry __ high -- est be giv -- en __ hence -- forth __
+ and __ for -- e -- ver, a -- men and a -- men!
+ We'll call in our sol -- emn as -- sem -- blies in spir -- it
+ to spread forth the king -- dom of heav -- en a -- broad.
+ How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
+ out __ an -- y ire, We'll sing shout ah ah
+ Ho -- san -- na, Ho -- san -- na God and lamb let
+ glo -- ry high -- est giv -- en hence -- forth __
+ and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
+ Ho -- san -- na to the Lord! __
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
% The lines below help layout the page in a nice way. Don't delete or alter.
indent = 0.0\pt
first-page-number = #1
between-system-padding = #0.2
between-system-space = #0.2
ragged-last-bottom = ##f
ragged-bottom = ##f
\context {
\Lyrics
% This helps layout. Don't change.
\override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0)
% Change the number to change the font size.
\override LyricText #'font-size = #-.575
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 7f047bfc82f0a76d90e9efed530382cf65f42c8a | Finished bari one | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 6dd150f..746b4fc 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,247 +1,369 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
#(set-paper-size "a4")
top-margin = 0.7\cm
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
- \mark \default \break
+ \mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
+ \mark \default \break % B
+ bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
+ c1 | d2. g,4 \bar "||"
+ \mark \default \break \key c \major % C
+ c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 g |
+ e( g) c e | d( g,) a d | e( f) f f | e2. g,4 |
+ c2 b4 b | c2 d4 e | a,( c) f d | c4.( d16 e16) d2 |
+ e,4( g) c e | d( g,) a f' | e( d) c b | c2 c \bar "||"
+ \mark \default \break % D
+ c1 | b | c | d |
+ e | f2 f4 f | d4.( e8) f4 c | e2 e |
+ c4.( b8) c( d) e( f) | g4( e) f f | e2 d4 f | e2. g,4 \bar "||"
+ \mark \default \break % E
+ c2 d4 d | e2 f4 e | f2 f4 f | e4.( f8 ) e4 r |
+ r2 e( | d c4) f | e( d) d d \bar "||" \key des \major ees2 r4 ees |
+ f2 aes4 aes | aes2 ges4 f | des2 ges | ees ees4 ees |
+ f2 f | ees des | aes4( des) bes c | des2. des4 \bar "||"
+ \mark \default \break % F
+ \key d \major d1 | cis | d | e |
+ d2 e4 fis | b,2 cis4 d | g2 fis4. e8 | e2. e4 |
+ fis1 | g2 g4 g | e4.( fis8) g4 d | e( d) d e |
+ fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
+ fis1 | e2 g | fis2. a,4 | d e fis a |
+ a1 ~ | a1 ~ | a1 ~ | a2. \bar "|."
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
+ The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
+ re -- stor -- ing their judg -- es and all __ as at first.
+ The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
+ veil __ o'er the earth __ is be -- gin -- ning to burst.
+ We'll sing shout ah ah glo -- ry in the high -- est be giv -- en
+ Forth __ and __ for -- e -- ver, a -- men and a -- men!
+ We'll call in our sol -- emn as -- sem -- blies in spir -- it,
+ Ah __ of heav -- en a -- broad, How bless -- ed the day
+ when the lamb and li -- on shall lie down ge -- ther
+ out __ an -- y ire, We'll sing shout ah ah
+ san -- na, Ho -- san -- na to God and __ the lamb __ let
+ glo -- ry in the high -- est be giv -- en hence forth for -- ev -- er,
+ a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! __
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
+ \mark \default \break % A
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
+ \mark \default \break % B
+ bes4. c8 d( c) bes( a) | g2. bes4 | c4. d8 ees( d c bes) |
+ c1 | d2. g,4 \bar "||"
+ \mark \default \break \key c \major % C
+ c2 d4 d | e2 d4 c | c2 b4 a | g4.( a8) g4 f |
+ e( g) c e | d( g,) a d | e( d) c b | c2. g4 |
+ c2 b4 b | c2 d4 d | a( c) c d | c4.( d16 e16) d2 |
+ e,4( g) c e | d( g,) a c | c( g) g g | g2 c \bar "||"
+ \mark \default \break % D
+ g1 | g | a | b |
+ e4( c) d e | d2 f4 e | d4.( e8) f4 c | e2 d |
+ c4.( b8) c( d) e( f) | g4( e) c d | c2 d4 f | e2. g,4 \bar "||"
+ \mark \default \break % E
+ c2 d4 d | e2 d4 c | c2 f4 f | e4.( f8 ) e4 r |
+ r2 c( | c a4) f' | c( d) c b \bar "||" \key des \major c2 r4 c |
+ des2 ees4 ees | ees4( des) c des | bes2 ees | des c4 ees |
+ des2 des | ees des | aes2 aes4 aes | f2. aes4 \bar "||"
+ \mark \default \break % F
+ \key d \major a2 fis4 a | a2 fis4 a | d( fis) e d | cis( b) a8( b) cis( a) |
+ d2 cis4 d | b2 cis4 b | d2 e4( d8) e8 | d4 cis8 b cis4 e |
+ e( d) d2 | e2 g4 fis | d2 d4 d | e( d) d e |
+ fis2. fis4 | d( g) fis e | fis2 e4 g | fis2. fis4 |
+ fis1 | e2 g | fis2. a,4 | d cis d fis |
+ fis2. r4 | e2( g) | fis1 ~ | fis2. \bar "|."
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Ho -- san -- na to __ the __ Lord Ho -- san -- na, Ho __ san -- na!
+ The Lord is ex -- tend -- ing the saints' un -- der -- stand -- ing,
+ re -- stor -- ing their judg -- es and all __ as at first.
+ The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
+ veil __ o'er the earth __ is be -- gin -- ning to burst.
+ We'll sing shout ah ah glo -- ry to them in the high -- est be giv -- en
+ forth __ and __ for -- e -- ver, a -- men and a -- men!
+ We'll call in our sol -- emn as -- sem -- blies in spir -- it,
+ Ah __ of heav -- en a -- broad, How bless -- ed the day
+ when the lamb and li -- on shall lie down ge -- ther
+ out __ an -- y ire, We'll sing and we'll shout with the ar -- mies of heav -- en Ho --
+ san -- na, Ho -- san -- na to God and __ the God and the lamb let
+ glo -- ry them in the high -- est be giv -- en hence forth for -- ev -- er,
+ a -- men and a -- men! A -- men and a -- men Ho -- san -- na to the Lord! A -- men! __
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
+ \mark \default \break % A
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
- bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 |
+ bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 \bar "||"
+ \mark \default \break % B
+ bes a g bes | ees4. f8 g( f) ees( d) | ees2 aes, | f'1 | g \bar "||"
+ \mark \default \break \key c \major % C
+ r | r | r2 f,8( g) a( b) |
+ c2 b4 b | c( d) e g | g( e) f f | g( a) g g |
+ g2. g,4 | g2 g4 g | b2 b4 c | f,( a) f8( g) a( b) |
+ c2 b4 f | e( g) g g | g( e) f a | g( f) e d | e2 r4 g \bar "||"
+ \mark \default \break % D
+ g2 e4 g | g2 e4 g | c4( e) d c | b2 d4 d |
+ c1 | c | c2 d4 c |
+ b( a) gis8( a) b( gis) | a4.( g8) a( b) c( d) | e4( c) a d |
+ c2 b4 b | c2. g4 \bar "||"
+ \mark \default \break % E
+ c( b) b b | c2 a4 a | a2 b4 a | g4.( a8) g4 f |
+ e( g) c e | d( g,) a f' | e( d) c b \bar "||" \key des \major c2 r4 aes |
+ aes2 c4 c | des2 aes4 aes | aes( ges2) ges4 | aes2 aes4 aes |
+ aes2 aes | des4( c8 bes) bes2 | aes4( bes) aes ges | aes2. f4 \bar "||"
+ \mark \default \break % F
+ \key d \major fis1 | e | g | a2 a |
+ fis2 a4 a | a( g) g2 | b b | a2. e'4 |
+ fis( d) e fis | b,2 g'4 fis | e4.( fis8) e4 d | cis( b) a8( b) cis( a) |
+ d4.( e8) fis( e) d( cis) | b4( e) d e | d2 cis4 cis | d2. d4 |
+ d1 | cis2 e | e4( d2) a4 | b a b cis |
+ d2. r4 | c2( e) | d1 ~ | d2. \bar "|."
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
+ Ho -- san -- na to Ho -- san -- na, to __ the __ Lord Ho -- san -- na!
+ un -- der -- stand -- ing, re -- stor -- ing their judg -- es
+ and all __ as at first.
+ The knowl -- edge and pow -- er of God __ are ex -- pand -- ing;
+ The veil __ o'er the earth __ is be -- gin -- ning to burst.
+ We'll sing and we'll shout with the ar -- mies of heav -- en
+ let glo -- ry __ high -- est be giv -- en __ hence -- forth __
+ and __ for -- e -- ver, a -- men and a -- men!
+ We'll call in our sol -- emn as -- sem -- blies in spir -- it
+ to spread forth the king -- dom of heav -- en a -- broad.
+ How bless -- ed the day when the lamb and li -- on shall lie down ge -- ther
+ out __ an -- y ire, We'll sing shout ah ah
+ Ho -- san -- na, Ho -- san -- na God and lamb let
+ glo -- ry to them in the high -- est be giv -- en hence -- forth __
+ and for -- ev -- er, a -- men and a -- men! A -- men and a -- men
+ Ho -- san -- na to the Lord! A -- men! __
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
% The lines below help layout the page in a nice way. Don't delete or alter.
indent = 0.0\pt
first-page-number = #1
between-system-padding = #0.2
between-system-space = #0.2
ragged-last-bottom = ##f
ragged-bottom = ##f
\context {
\Lyrics
- \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0) % This helps layout. Don't change.
- \override LyricText #'font-size = #-.575 % Change the number to change the font size.
+
+ % This helps layout. Don't change.
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0)
+
+ % Change the number to change the font size.
+ \override LyricText #'font-size = #-.575
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 3192e4e6ba3b55b11be6c4ee760c4f7536d2722f | Added double bar | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 0b46b29..6dd150f 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,247 +1,247 @@
\version "2.12.3"
\header {
filename = "the_spirit_of_god.ly"
title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
arranger = "Music: Anonymous"
meter = "Words: William Wines Phelps (1792-1872)"
copyright = "© 2003 Michael Bearden"
enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
\line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
} % This sets the statement at the bottom of last page.
}
\paper {
#(set-paper-size "a4")
top-margin = 0.7\cm
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
- g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 |
+ g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 \bar "||"
\mark \default \break
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
}
tenoronewords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
tenortwonotes = \relative c {
\clef "G_8"
\partial 4
r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
- g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 |
+ g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 \bar "||"
bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
}
tenortwowords = \lyricmode {
Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
- f ees4 d | ees2 ees4 ees | f1 | f2. f,4 |
+ f ees4 d | ees2 ees4 ees | f1 | f2. f,4 \bar "||"
ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 |
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
baritwonotes = \relative c {
\clef "G_8"
f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
- bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 |
+ bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 \bar "||"
f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
bassonenotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
- ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
The Spir -- it of God like a fire __ is burn -- ing!
The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
The vi -- sions and bless -- ings of old are re -- turn -- ing,
and an -- gels are com -- ing to vis -- it the earth.
We'll sing and we'll shout with the ar -- mies of heav -- en,
Ho -- san -- na, Ho -- san -- na to God and the Lamb!
Let glo -- ry to them in the high -- est be giv -- en, __
Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
basstwonotes = \relative c {
\clef bass
\partial 4
r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
- ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 \bar "||"
d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
\layout {
% The lines below help layout the page in a nice way. Don't delete or alter.
indent = 0.0\pt
first-page-number = #1
between-system-padding = #0.2
between-system-space = #0.2
ragged-last-bottom = ##f
ragged-bottom = ##f
\context {
\Lyrics
\override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0) % This helps layout. Don't change.
\override LyricText #'font-size = #-.575 % Change the number to change the font size.
}
}
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
cayblood/lilypond-files | 7f1b30136dfccf22aae83decc047f3d7c4989645 | First 2.5 pages | diff --git a/the_spirit_of_god/the_spirit_of_god.ly b/the_spirit_of_god/the_spirit_of_god.ly
index 607eef8..0b46b29 100644
--- a/the_spirit_of_god/the_spirit_of_god.ly
+++ b/the_spirit_of_god/the_spirit_of_god.ly
@@ -1,180 +1,247 @@
\version "2.12.3"
-\header {
- filename = "the_spirit_of_god.ly"
- title = "The Spirit of God"
+\header {
+ filename = "the_spirit_of_god.ly"
+ title = "The Spirit of God"
subtitle = \markup { \teeny "(Men's Choir)" }
- arranger = "Music: Anonymous"
- meter = "Words: William Wines Phelps (1792-1872)"
+ arranger = "Music: Anonymous"
+ meter = "Words: William Wines Phelps (1792-1872)"
copyright = "© 2003 Michael Bearden"
- enteredby = "Carl Youngblood"
+ enteredby = "Carl Youngblood"
lastupdated = "25 March 2010"
- style = "Hymn"
+ style = "Hymn"
tagline = \markup {
\override #'(box-padding . 1.0)
\override #'(baseline-skip . 2.7)
\center-align {
- \line { \teeny
+ \line { \teeny
\line { Music engraving by LilyPond 2.12.3âwww.lilypond.org }
}
}
- } % This sets the statement at the bottom of last page.
-}
+ } % This sets the statement at the bottom of last page.
+}
\paper {
#(set-paper-size "a4")
top-margin = 0.7\cm
}
global = {
\key bes \major
\time 4/4
}
tenoronenotes = \relative c {
\clef "G_8"
\partial 4
- r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) | % 1-4
- g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 | % 5-8
- bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g | % 9-12
- bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4 % 13-16
+ r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
+ g2 g4 bes | c4. d8 ees( d c bes) | c1 c2. f,4 |
+ \mark \default \break
+ bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 g |
+ bes( d) d f | f2 ees4 ees | f( g) f f | f2. d4
+ d2 f4 f | f2 f4 d | g2 f4 ees | d4.( ees8) d4 c |
+ bes( c) d f | f( d) ees ees | d( c) bes a | bes2. d4 |
+ d2 bes4 d | d2 bes4 d | d( f) f e | f2 f4 ees? |
+ d( f) f f | ees2 f4 f | g( f) f f | f2. f4 |
+ f2 f4 f | ees2 ees4 d | c4.( d8) c4 c | c( a) bes ees |
+ d4.( c8) d( c) bes( a) | bes4( ees) d ees | d2 c4 ees | d2. f,4 |
}
tenoronewords = \lyricmode {
- Ah __ san -- na, Ho -- san -- na, Ho __ san -- na! % 1-8
- The Spir -- it of God like a fire __ is burn -- ing! % 9-12
- The Lat -- ter -- day glo -- ry be -- gins __ to come forth; % 12-16
+ Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
+ The Spir -- it of God like a fire __ is burn -- ing!
+ The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
+ The vi -- sions and bless -- ings of old are re -- turn -- ing,
+ and an -- gels are com -- ing to vis -- it the earth.
+ We'll sing and we'll shout with the ar -- mies of heav -- en,
+ Ho -- san -- na, Ho -- san -- na to God and the Lamb!
+ Let glo -- ry to them in the high -- est be giv -- en, __
+ Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
tenortwonotes = \relative c {
\clef "G_8"
- \partial 4
- r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) | % 1-4
- g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 | % 5-8
- bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees | % 9-12
- d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4 % 13-16
+ \partial 4
+ r4 | r1 | r | r2 r4 f4( | bes4. c8 d c bes a) |
+ g2 g4 bes | c4. d8 ees( d c bes) | bes1 | a2. f4 |
+ bes2 c4 c | d2 c4 bes | bes2( a4) g | f4.( g8) f4 ees |
+ d( f) bes d | c( f,) g ees' | d( c) bes a | bes2. f4
+ bes2 c4 c | d2 c4 bes | bes2 a4 g | f4.( g8) f4 ees |
+ d( f) bes d | c( bes) bes ees | d( c) bes a | bes2. f4 |
+ f2 d4 f | f2 d4 f | bes( d) c bes | a( g) f8( g) a( f) |
+ bes2 c4 d | g,2 a4 bes | ees2 d4. c8 | c2. c4 |
+ d( bes) c d | g,2 ees'4 bes | a4.( bes8) a4 bes | a( g) f8( g) a( f) |
+ bes4.( c8) bes4 bes | g4( c) bes c | bes2 a4 a | bes2. f4 |
}
tenortwowords = \lyricmode {
- Ah __ san -- na, Ho -- san -- na, Ho __ san -- na! % 1-8
- The Spir -- it of God like a fire __ is burn -- ing! % 9-12
- The Lat -- ter -- day glo -- ry be -- gins __ to come forth; % 12-16
+ Ah __ san -- na, Ho -- san -- na, Ho __ san -- na!
+ The Spir -- it of God like a fire __ is burn -- ing!
+ The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
+ The vi -- sions and bless -- ings of old are re -- turn -- ing,
+ and an -- gels are com -- ing to vis -- it the earth.
+ We'll sing and we'll shout with the ar -- mies of heav -- en,
+ Ho -- san -- na, Ho -- san -- na to God and the Lamb!
+ Let glo -- ry to them in the high -- est be giv -- en, __
+ Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
barionenotes = \relative c' {
\clef "G_8"
\partial 4
- r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' | % 1-4
- f ees4 d | ees2 ees4 ees | f1 | f2. f,4 | % 5-8
- ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) | % 9-12
- f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 | % 13-16
+ r4 | r2 r4 a | c bes2. ~ | bes1 | bes2 f' |
+ f ees4 d | ees2 ees4 ees | f1 | f2. f,4 |
+ ees2 a4 a | bes2 a4 bes | bes2( f4) bes | bes2 bes4 bes8( c) |
+ f,4( f) bes bes | a( bes) bes c | bes( ees) d c | d2. bes4 |
+ bes2 c4 a | bes2 a4 bes | bes2 bes4 bes | bes2 bes4 bes8( c) |
+ f,2 bes4 bes | bes2 bes4 c | bes( ees) d c | d2. bes4 |
+ bes2 f4 bes | bes2 f4 bes | bes( d) c c | c( a) bes a |
+ bes2 a4 bes | bes2 c4 bes | bes( c) bes c | a2. a4 |
+ bes2 a4 bes | bes2 a4 bes | c2 c4 bes | f2 g4 a |
+ bes2 f4 d | ees2 f4 g | f2 f4 f | f2. f4 |
}
barionewords = \lyricmode {
Ho -- san -- na, __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
- The Spir -- it of God like a fire __ is burn -- ing! % 9-12
- The Lat -- ter -- day glo -- ry be -- gins __ to come forth; % 12-16
+ The Spir -- it of God like a fire __ is burn -- ing!
+ The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
+ The vi -- sions and bless -- ings of old are re -- turn -- ing,
+ and an -- gels are com -- ing to vis -- it the earth.
+ We'll sing and we'll shout with the ar -- mies of heav -- en,
+ Ho -- san -- na, Ho -- san -- na to God and the Lamb!
+ Let glo -- ry to them in the high -- est be giv -- en, __
+ Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
baritwonotes = \relative c {
\clef "G_8"
- f4 | bes f2. ~ | f1 ~ | f1 | f2 bes | % 1-4
- bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 | % 5-8
- f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) | % 9-12
- d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 | % 13-16
+ f4 | bes f2. ~ | f1 ~ | f1 | f2 bes |
+ bes bes4 bes | aes2 aes4 aes | f1 | f2. f4 |
+ f2 f4 f | f2 a4 bes | g2( f4) ees | f4.( ees8) d4 f8( ees) |
+ d4( f) f bes | a( f) g c | bes( c) bes a | bes2. f4 |
+ f2 a4 a | bes2 a4 bes | bes2 bes4 bes | bes2 f4 f8( ees) |
+ d4( f) f bes | bes( a) g g | f( g) f f | f2. f4 |
+ f2 d4 f | f2 d4 f | bes2 a4 bes | a( g) f8( g) f4 |
+ f( bes) a bes | g2 a4 bes | bes( a) bes c | a2. a4 |
+ bes2 a4 g | g2 a4 bes | f2 f4 e | f2 f4 ees? |
+ f2 f4 d | ees2 f4 ees | f2 f4 f | f2. f4 |
}
baritwowords = \lyricmode {
Ho -- san -- na __ Ah Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
- The Spir -- it of God like a fire __ is burn -- ing! % 9-12
- The Lat -- ter -- day glo -- ry be -- gins __ to come forth; % 12-16
+ The Spir -- it of God like a fire __ is burn -- ing!
+ The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
+ The vi -- sions and bless -- ings of old are re -- turn -- ing,
+ and an -- gels are com -- ing to vis -- it the earth.
+ We'll sing and we'll shout with the ar -- mies of heav -- en,
+ Ho -- san -- na, Ho -- san -- na to God and the Lamb!
+ Let glo -- ry to them in the high -- est be giv -- en, __
+ Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
bassonenotes = \relative c {
\clef bass
\partial 4
- r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 | % 1-4
- ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 % 5-8
- d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f | % 9-12
- d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 | % 13-16
+ r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4
+ d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
+ d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
+ bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
+ d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
+ bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
+ bes( d) c bes | ees2 c4 bes | g( a) bes4. f'8 | f2. f4 |
+ bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
basswords = \lyricmode {
Ho -- san -- na to the Lord Ho -- san -- na, Ho -- san -- na, Ho -- san -- na!
- The Spir -- it of God like a fire __ is burn -- ing! % 9-12
- The Lat -- ter -- day glo -- ry be -- gins __ to come forth; % 12-16
+ The Spir -- it of God like a fire __ is burn -- ing!
+ The Lat -- ter -- day glo -- ry be -- gins __ to come forth;
+ The vi -- sions and bless -- ings of old are re -- turn -- ing,
+ and an -- gels are com -- ing to vis -- it the earth.
+ We'll sing and we'll shout with the ar -- mies of heav -- en,
+ Ho -- san -- na, Ho -- san -- na to God and the Lamb!
+ Let glo -- ry to them in the high -- est be giv -- en, __
+ Hence -- forth __ and for -- ev -- er, A -- men and a -- men!
}
basstwonotes = \relative c {
\clef bass
\partial 4
- r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 | % 1-4
- ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4 % 5-8
- d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f | % 9-12
- d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 | % 13-16
+ r4 | r1 | r2. d4 | c bes f' f, | bes2. bes4 |
+ ees,2 ees4 ees | aes2 aes4 aes | f1 | f2. f'4
+ d2 f4 f | bes2 f4 g | ees2. ees4 | bes2 bes4 f |
+ d'( c) bes bes | f'( d) ees c | d( ees) f f, | bes2. bes4 |
+ bes2 f'4 f | bes2 f4 g | ees2 ees4 ees | bes2 bes4 ees |
+ d( c) bes a | g( f) ees g | f2 f4 f | bes2. bes4 |
+ bes2 bes4 bes | bes2 bes4 bes | bes2 c4 c | f( ees) d c |
+ bes( d) c bes | ees,2 c'4 bes | g( a) bes4. f'8 | f2. f4 |
+ bes,4( d) f bes | ees,2 c4 bes | f'2 f4 c | f( ees) d c |
+ bes2 bes4 bes | ees( c) d ees | f( f,) f f | bes2. f4 |
}
\score{
\context ChoirStaff
<<
\context Staff = tenorone <<
\context Voice = tenone {
\set midiInstrument = #"Choir Aahs"
<< \global \tenoronenotes >>
}
\lyricsto "tenone" \new Lyrics \tenoronewords
>>
\context Staff = tenortwo <<
\context Voice = tentwo {
\set midiInstrument = #"Choir Aahs"
<< \global \tenortwonotes >>
}
\lyricsto "tentwo" \new Lyrics \tenortwowords
>>
\context Staff = barione <<
\context Voice = barone {
\set midiInstrument = #"Choir Aahs"
<< \global \barionenotes >>
}
\lyricsto "barone" \new Lyrics \barionewords
>>
\context Staff = baritwo <<
\context Voice = bartwo {
\set midiInstrument = #"Choir Aahs"
<< \global \baritwonotes >>
}
\lyricsto "bartwo" \new Lyrics \baritwowords
>>
\context Staff = bassone <<
\context Voice = basone {
\set midiInstrument = #"Choir Aahs"
<< \global \bassonenotes >>
}
\lyricsto "basone" \new Lyrics \basswords
>>
\context Staff = basstwo <<
\context Voice = bastwo {
\set midiInstrument = #"Choir Aahs"
<< \global \basstwonotes >>
}
\lyricsto "bastwo" \new Lyrics \basswords
>>
>>
- \layout {
- % The lines below help layout the page in a nice way. Don't delete or alter.
- indent = 0.0\pt
+ \layout {
+ % The lines below help layout the page in a nice way. Don't delete or alter.
+ indent = 0.0\pt
first-page-number = #1
- between-system-padding = #0.1
- between-system-space = #0.1
- ragged-last-bottom = ##f
- ragged-bottom = ##f
- \context {
- \Lyrics
- \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0) % This helps layout. Don't change.
- \override LyricText #'font-size = #-.575 % Change the number to change the font size.
- }
- }
-
+ between-system-padding = #0.2
+ between-system-space = #0.2
+ ragged-last-bottom = ##f
+ ragged-bottom = ##f
+ \context {
+ \Lyrics
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.0 . 1.0) % This helps layout. Don't change.
+ \override LyricText #'font-size = #-.575 % Change the number to change the font size.
+ }
+ }
+
\midi {
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
- \consists "Staff_performer"
+ \consists "Staff_performer"
}
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 72 2)
}
}
}
\ No newline at end of file
|
joshwalsh/Morse-Code | c9c73587738ff12d85558ddf1f003f32ec49c832 | Cucumber Features | diff --git a/features/morse_translator.feature b/features/morse_translator.feature
new file mode 100644
index 0000000..146e278
--- /dev/null
+++ b/features/morse_translator.feature
@@ -0,0 +1,16 @@
+Feature: Translate english into it's morse code .- equivalent.
+
+ As a secret operative
+ I want to translate orders into morse code
+ So that I can transmit them secretly over a wire
+
+Scenario Outline: translating
+
+ Given I want to translate a word to morse code
+ When I translate <english>
+ Then the result should be translated to <morse>
+
+ Examples:
+ | english | morse |
+ | "letter" | ".-.. . - - . .-." |
+ | "The quick brown fox jumps over the lazy dog" | "- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --." |
diff --git a/features/step_definitions/translation_steps.rb b/features/step_definitions/translation_steps.rb
new file mode 100644
index 0000000..b471c75
--- /dev/null
+++ b/features/step_definitions/translation_steps.rb
@@ -0,0 +1,11 @@
+Given /I want to translate a word to morse code/ do
+ @morse = MorseTranslator.new
+end
+
+When /^I translate "([^\"]*)"$/ do |arg1|
+ @translation = @morse.translate(arg1)
+end
+
+Then /^the result should be translated to "([^\"]*)"$/ do |arg1|
+ @translation.should == arg1
+end
diff --git a/features/support/env.rb b/features/support/env.rb
new file mode 100644
index 0000000..6ad39c7
--- /dev/null
+++ b/features/support/env.rb
@@ -0,0 +1,3 @@
+$: << File.dirname(__FILE__) + "/../../lib"
+
+require 'morse_translator'
diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
index 4c9cea7..7a0060e 100644
--- a/spec/morse_translator_spec.rb
+++ b/spec/morse_translator_spec.rb
@@ -1,34 +1,26 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'morse_translator'
describe MorseTranslator do
before :each do
@morse = MorseTranslator.new
end
it "translates a single lowercase letter" do
@morse.translate('a').should == '.-'
end
it "translates a single uppercase letter" do
@morse.translate('A').should == '.-'
end
- it "translates a word" do
- @morse.translate('letter').should == '.-.. . - - . .-.'
- end
-
- it "translates a sentance" do
- @morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
- end
-
it "eats duplicate spaces" do
- @morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
+ @morse.translate(' a').should == '/ .-'
end
it "ignores punctuation" do
- @morse.translate('The &* quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
+ @morse.translate('&^*a').should == '.-'
end
end
|
joshwalsh/Morse-Code | 4024ae398e4244372485e63a21133f5f7733f809 | Sanitize Phrase | diff --git a/lib/morse_translator.rb b/lib/morse_translator.rb
index 09c12a2..99dfed9 100644
--- a/lib/morse_translator.rb
+++ b/lib/morse_translator.rb
@@ -1,21 +1,32 @@
require 'loads_morse_translations'
class MorseTranslator
include LoadsMorseTranslations
def translate(phrase)
phrase = phrase.downcase
- phrase.gsub!(/ +/, ' ')
+ phrase = sanitize_phrase(phrase).squeeze(' ')
phrase.chars.inject('') do |phrase, letter|
translation = lookup_translation_for_letter(letter)
- phrase << "#{translation} " unless translation.nil?
+
+ phrase << unless translation.nil?
+ "#{translation} "
+ end.to_s
end
phrase.strip
end
def lookup_translation_for_letter(letter)
load_morse_translations[letter]
end
+
+ def sanitize_phrase(phrase)
+ phrase.gsub(/./) do |letter|
+ if load_morse_translations[letter]
+ letter
+ end.to_s
+ end
+ end
end
diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
index 739bd04..4c9cea7 100644
--- a/spec/morse_translator_spec.rb
+++ b/spec/morse_translator_spec.rb
@@ -1,34 +1,34 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'morse_translator'
describe MorseTranslator do
before :each do
@morse = MorseTranslator.new
end
it "translates a single lowercase letter" do
@morse.translate('a').should == '.-'
end
it "translates a single uppercase letter" do
@morse.translate('A').should == '.-'
end
it "translates a word" do
@morse.translate('letter').should == '.-.. . - - . .-.'
end
it "translates a sentance" do
@morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
it "eats duplicate spaces" do
- @morse.translate('The quick brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
+ @morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
it "ignores punctuation" do
- @morse.translate('The & quick -(*^*@#%)& brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
+ @morse.translate('The &* quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
end
|
joshwalsh/Morse-Code | 75be4e786f16555cb42e49a39f1d436ef7213966 | Punctuation Fail | diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
index e536561..739bd04 100644
--- a/spec/morse_translator_spec.rb
+++ b/spec/morse_translator_spec.rb
@@ -1,35 +1,34 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'morse_translator'
describe MorseTranslator do
before :each do
@morse = MorseTranslator.new
end
it "translates a single lowercase letter" do
@morse.translate('a').should == '.-'
end
it "translates a single uppercase letter" do
@morse.translate('A').should == '.-'
end
it "translates a word" do
@morse.translate('letter').should == '.-.. . - - . .-.'
end
it "translates a sentance" do
@morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
it "eats duplicate spaces" do
@morse.translate('The quick brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
it "ignores punctuation" do
- pending
@morse.translate('The & quick -(*^*@#%)& brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
end
|
joshwalsh/Morse-Code | 05ee50cab909b2d02340e16fd54f8606b6023621 | Translation working, except for killer punctuation | diff --git a/lib/loads_morse_translations.rb b/lib/loads_morse_translations.rb
index dc2522d..b7946b8 100644
--- a/lib/loads_morse_translations.rb
+++ b/lib/loads_morse_translations.rb
@@ -1,32 +1,33 @@
module LoadsMorseTranslations
def load_morse_translations
{
+ ' ' => '/',
'a' => '.-',
'b' => '-...',
'c' => '-.-.',
'd' => '-..',
'e' => '.',
'f' => '..-.',
'g' => '--.',
'h' => '....',
'i' => '..',
'j' => '.---',
'k' => '-.-',
'l' => '.-..',
'm' => '--',
'n' => '-.',
'o' => '---',
'p' => '.--.',
'q' => '--.-',
'r' => '.-.',
's' => '...',
't' => '-',
'u' => '..-',
'v' => '...-',
'w' => '.--',
'x' => '-..-',
'y' => '-.--',
'z' => '--..'
}
end
end
diff --git a/lib/morse_translator.rb b/lib/morse_translator.rb
index 5c7c639..09c12a2 100644
--- a/lib/morse_translator.rb
+++ b/lib/morse_translator.rb
@@ -1,17 +1,21 @@
require 'loads_morse_translations'
class MorseTranslator
include LoadsMorseTranslations
def translate(phrase)
- phrase = phrase.downcase.gsub(/\s/, '')
+ phrase = phrase.downcase
+ phrase.gsub!(/ +/, ' ')
phrase.chars.inject('') do |phrase, letter|
- phrase << lookup_translation_for_letter(letter)
+ translation = lookup_translation_for_letter(letter)
+ phrase << "#{translation} " unless translation.nil?
end
+
+ phrase.strip
end
def lookup_translation_for_letter(letter)
load_morse_translations[letter]
end
end
diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
index 51298b4..e536561 100644
--- a/spec/morse_translator_spec.rb
+++ b/spec/morse_translator_spec.rb
@@ -1,33 +1,35 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'morse_translator'
describe MorseTranslator do
before :each do
@morse = MorseTranslator.new
end
- it "translates 'a'" do
+ it "translates a single lowercase letter" do
@morse.translate('a').should == '.-'
end
- it "translates 'A'" do
+ it "translates a single uppercase letter" do
@morse.translate('A').should == '.-'
end
- it "translates 'b' do" do
- @morse.translate('b').should == '-...'
+ it "translates a word" do
+ @morse.translate('letter').should == '.-.. . - - . .-.'
end
- it "translates 'c' do" do
- @morse.translate('b').should == '-...'
+ it "translates a sentance" do
+ @morse.translate('The quick brown fox jumps over the lazy dog').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
- it "translates 'ab'" do
- @morse.translate('ab').should == '.--...'
+ it "eats duplicate spaces" do
+ @morse.translate('The quick brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
- it "translates 'a b'" do
- @morse.translate('a b').should == '.--...'
+ it "ignores punctuation" do
+ pending
+ @morse.translate('The & quick -(*^*@#%)& brown fox jumps over the lazy dog.').should == '- .... . / --.- ..- .. -.-. -.- / -... .-. --- .-- -. / ..-. --- -..- / .--- ..- -- .--. ... / --- ...- . .-. / - .... . / .-.. .- --.. -.-- / -.. --- --.'
end
+
end
|
joshwalsh/Morse-Code | 025601a57cbfcbcf52bc5ebc1f323b5cf6409b6d | Simple AB testing | diff --git a/lib/loads_morse_translations.rb b/lib/loads_morse_translations.rb
index 20f5db2..dc2522d 100644
--- a/lib/loads_morse_translations.rb
+++ b/lib/loads_morse_translations.rb
@@ -1,9 +1,32 @@
module LoadsMorseTranslations
def load_morse_translations
{
'a' => '.-',
'b' => '-...',
- 'c' => '-.-.'
+ 'c' => '-.-.',
+ 'd' => '-..',
+ 'e' => '.',
+ 'f' => '..-.',
+ 'g' => '--.',
+ 'h' => '....',
+ 'i' => '..',
+ 'j' => '.---',
+ 'k' => '-.-',
+ 'l' => '.-..',
+ 'm' => '--',
+ 'n' => '-.',
+ 'o' => '---',
+ 'p' => '.--.',
+ 'q' => '--.-',
+ 'r' => '.-.',
+ 's' => '...',
+ 't' => '-',
+ 'u' => '..-',
+ 'v' => '...-',
+ 'w' => '.--',
+ 'x' => '-..-',
+ 'y' => '-.--',
+ 'z' => '--..'
}
end
end
diff --git a/lib/morse_translator.rb b/lib/morse_translator.rb
index 5fd1847..5c7c639 100644
--- a/lib/morse_translator.rb
+++ b/lib/morse_translator.rb
@@ -1,15 +1,17 @@
require 'loads_morse_translations'
class MorseTranslator
include LoadsMorseTranslations
def translate(phrase)
- phrase.downcase.chars.inject('') do |phrase, letter|
+ phrase = phrase.downcase.gsub(/\s/, '')
+
+ phrase.chars.inject('') do |phrase, letter|
phrase << lookup_translation_for_letter(letter)
end
end
def lookup_translation_for_letter(letter)
load_morse_translations[letter]
end
end
diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
index 7df8ced..51298b4 100644
--- a/spec/morse_translator_spec.rb
+++ b/spec/morse_translator_spec.rb
@@ -1,29 +1,33 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'morse_translator'
describe MorseTranslator do
before :each do
@morse = MorseTranslator.new
end
it "translates 'a'" do
@morse.translate('a').should == '.-'
end
it "translates 'A'" do
@morse.translate('A').should == '.-'
end
it "translates 'b' do" do
@morse.translate('b').should == '-...'
end
it "translates 'c' do" do
@morse.translate('b').should == '-...'
end
it "translates 'ab'" do
@morse.translate('ab').should == '.--...'
end
+
+ it "translates 'a b'" do
+ @morse.translate('a b').should == '.--...'
+ end
end
|
joshwalsh/Morse-Code | e446bea6f5ca0d0f568f69d962ecdfb5a20bfcbd | A few test specs | diff --git a/lib/loads_morse_translations.rb b/lib/loads_morse_translations.rb
new file mode 100644
index 0000000..20f5db2
--- /dev/null
+++ b/lib/loads_morse_translations.rb
@@ -0,0 +1,9 @@
+module LoadsMorseTranslations
+ def load_morse_translations
+ {
+ 'a' => '.-',
+ 'b' => '-...',
+ 'c' => '-.-.'
+ }
+ end
+end
diff --git a/lib/morse_translator.rb b/lib/morse_translator.rb
new file mode 100644
index 0000000..5fd1847
--- /dev/null
+++ b/lib/morse_translator.rb
@@ -0,0 +1,15 @@
+require 'loads_morse_translations'
+
+class MorseTranslator
+ include LoadsMorseTranslations
+
+ def translate(phrase)
+ phrase.downcase.chars.inject('') do |phrase, letter|
+ phrase << lookup_translation_for_letter(letter)
+ end
+ end
+
+ def lookup_translation_for_letter(letter)
+ load_morse_translations[letter]
+ end
+end
diff --git a/spec/morse_translator_spec.rb b/spec/morse_translator_spec.rb
new file mode 100644
index 0000000..7df8ced
--- /dev/null
+++ b/spec/morse_translator_spec.rb
@@ -0,0 +1,29 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require 'morse_translator'
+
+describe MorseTranslator do
+ before :each do
+ @morse = MorseTranslator.new
+ end
+
+ it "translates 'a'" do
+ @morse.translate('a').should == '.-'
+ end
+
+ it "translates 'A'" do
+ @morse.translate('A').should == '.-'
+ end
+
+ it "translates 'b' do" do
+ @morse.translate('b').should == '-...'
+ end
+
+ it "translates 'c' do" do
+ @morse.translate('b').should == '-...'
+ end
+
+ it "translates 'ab'" do
+ @morse.translate('ab').should == '.--...'
+ end
+end
+
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..f1eb4e0
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,2 @@
+require 'spec'
+$: << File.dirname(__FILE__) + "/../lib"
|
bougyman/cgi_fast_escape | a01924f618c8f5631f7d5749eddfd302744e3212 | Version 2009.06.24 | diff --git a/AUTHORS b/AUTHORS
index e3dfb32..5ab89f8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
Following persons have contributed to cgi_fast_escape.
(Sorted by number of submitted patches, then alphabetically)
- 3 TJ Vanderpoel <[email protected]>
+ 4 TJ Vanderpoel <[email protected]>
diff --git a/CHANGELOG b/CHANGELOG
index 45ba418..fdb5557 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,12 +1,16 @@
+[0373cb3 | 2009-06-25 00:19:27 UTC] TJ Vanderpoel <TJ Vanderpoel [email protected]>
+
+ * added copyright and fixed publishing tasks
+
[5707c73 | 2009-06-23 00:56:29 UTC] bougyman <[email protected]>
* added url_escape dependency
[7de79ee | 2009-06-22 22:41:28 UTC] TJ Vanderpoel <Jayson Vaughn [email protected]>
* updated README
[6211693 | 2009-06-22 22:40:13 UTC] TJ Vanderpoel <Jayson Vaughn [email protected]>
* initial port from rack_fast_escape
diff --git a/MANIFEST b/MANIFEST
index 4d24c85..bc88d8e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,19 +1,22 @@
+AUTHORS
+CHANGELOG
LICENSE
+MANIFEST
README
Rakefile
doc/LEGAL
lib/cgi_fast_escape.rb
lib/cgi_fast_escape/version.rb
spec/helper.rb
spec/lib/cgi_fast_escape.rb
tasks/authors.rake
tasks/bacon.rake
tasks/changelog.rake
tasks/copyright.rake
tasks/gem.rake
tasks/gem_installer.rake
tasks/manifest.rake
tasks/release.rake
tasks/reversion.rake
tasks/setup.rake
tasks/yard.rake
|
bougyman/cgi_fast_escape | 0373cb36cd17b6613b3a099fe041b858ae97c31a | added copyright and fixed publishing tasks | diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..da65d1b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.[a-zA-Z]*
+*.gemspec
+pkg/
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..e3dfb32
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Following persons have contributed to cgi_fast_escape.
+(Sorted by number of submitted patches, then alphabetically)
+
+ 3 TJ Vanderpoel <[email protected]>
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..45ba418
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,12 @@
+[5707c73 | 2009-06-23 00:56:29 UTC] bougyman <[email protected]>
+
+ * added url_escape dependency
+
+[7de79ee | 2009-06-22 22:41:28 UTC] TJ Vanderpoel <Jayson Vaughn [email protected]>
+
+ * updated README
+
+[6211693 | 2009-06-22 22:40:13 UTC] TJ Vanderpoel <Jayson Vaughn [email protected]>
+
+ * initial port from rack_fast_escape
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f4c50bd
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file which accompanies this software for the full text
+#
+# 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.
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..4d24c85
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,19 @@
+LICENSE
+README
+Rakefile
+doc/LEGAL
+lib/cgi_fast_escape.rb
+lib/cgi_fast_escape/version.rb
+spec/helper.rb
+spec/lib/cgi_fast_escape.rb
+tasks/authors.rake
+tasks/bacon.rake
+tasks/changelog.rake
+tasks/copyright.rake
+tasks/gem.rake
+tasks/gem_installer.rake
+tasks/manifest.rake
+tasks/release.rake
+tasks/reversion.rake
+tasks/setup.rake
+tasks/yard.rake
diff --git a/Rakefile b/Rakefile
index de9f44a..3656281 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,97 +1,102 @@
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file which accompanies this software for the full text
+#
begin; require 'rubygems'; rescue LoadError; end
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'time'
require 'date'
-require "lib/cgi_fast_escape"
PROJECT_SPECS = FileList[
'spec/*/**/*.rb'
]
PROJECT_MODULE = 'CgiFastEscape'
PROJECT_README = 'README'
#PROJECT_RUBYFORGE_GROUP_ID = 3034
PROJECT_COPYRIGHT_SUMMARY = [
"# Copyright (c) 2008-#{Time.now.year} The Rubyists, LLC (effortless systems) <[email protected]>",
"# Distributed under the terms of the MIT license.",
"# See the LICENSE file which accompanies this software for the full text",
"#"
]
PROJECT_COPYRIGHT = PROJECT_COPYRIGHT_SUMMARY + [
"# 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."
]
PROJECT_VERSION =
if version = ENV['PROJECT_VERSION'] || ENV['VERSION']
version
else
begin
require "lib/cgi_fast_escape/version"
RackFastEscape::VERSION
rescue
Date.today.strftime("%Y.%m.%d")
end
end
# To release the monthly version do:
# $ PROJECT_VERSION=2009.03 rake release
PROJECT_FILES = FileList[`git ls-files`.split("\n")].exclude('.gitignore').exclude("cgi_fast_escape.gemspec")
GEMSPEC = Gem::Specification.new{|s|
s.name = "cgi_fast_escape"
s.author = "The Rubyists, LLC"
s.summary = "The Rack Fast Escape library, by The Rubyists, LLC"
s.description = "The Rack Fast Escape library, by The Rubyists, LLC"
s.email = "The Rubyists, LLC <[email protected]>"
s.homepage = "http://github.com/bougyman/cgi_fast_escape"
s.platform = Gem::Platform::RUBY
s.version = PROJECT_VERSION
s.files = PROJECT_FILES
s.require_path = "lib"
+ s.add_dependency "url_escape"
+ s.rubyforge_project = "url-escape"
s.post_install_message = <<MESSAGE
============================================================
Thank you for installing CgiFastEscape!
============================================================
MESSAGE
}
Dir.glob('tasks/*.rake'){|f| import(f) }
task :default => [:bacon]
CLEAN.include %w[
**/.*.sw?
*.gem
.config
**/*~
**/{data.db,cache.yaml}
*.yaml
pkg
rdoc
ydoc
*coverage*
]
diff --git a/doc/LEGAL b/doc/LEGAL
new file mode 100644
index 0000000..86592de
--- /dev/null
+++ b/doc/LEGAL
@@ -0,0 +1,2 @@
+LICENSE
+lib/cgi_fast_escape/version.rb
diff --git a/lib/cgi_fast_escape.rb b/lib/cgi_fast_escape.rb
index c6a3dfb..51c5d90 100644
--- a/lib/cgi_fast_escape.rb
+++ b/lib/cgi_fast_escape.rb
@@ -1,27 +1,31 @@
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file which accompanies this software for the full text
+#
%w{cgi url_escape}.each { |lib|
begin
require lib
rescue LoadError
require "rubygems"
require lib
end
}
class CGI
class << self
# Move the old versions
alias :old_escape :escape
alias :old_unescape :unescape
# Pull in the new versions
extend URLEscape
# Make new versions explictly available
alias :fast_escape :escape
alias :fast_unescape :unescape
# Allow for detection
def fast_escape?; true; end
def fast_unescape?; true; end
end
end
diff --git a/lib/cgi_fast_escape/version.rb b/lib/cgi_fast_escape/version.rb
index ed479bc..1d86161 100644
--- a/lib/cgi_fast_escape/version.rb
+++ b/lib/cgi_fast_escape/version.rb
@@ -1,3 +1,3 @@
module CgiFastEscape
- VERSION = "0.0.2"
+ VERSION = "2009.06.24"
end
diff --git a/spec/helper.rb b/spec/helper.rb
index e58ec42..9397dde 100644
--- a/spec/helper.rb
+++ b/spec/helper.rb
@@ -1,22 +1,25 @@
-require "pathname"
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file which accompanies this software for the full text
+#
%w{bacon rack}.each { |lib|
begin
require lib
rescue LoadError
require "rubygems"
require lib
end
}
begin
- if (local_path = Pathname.new(__FILE__).dirname.join("..", "lib", "cgi_fast_escape.rb")).file?
- require local_path
+ if File.file?(local_path = File.expand_path("../../lib/cgi_fast_escape.rb", __FILE__))
+ require File.join(File.dirname(local_path),File.basename(local_path, ".rb"))
else
require "cgi_fast_escape"
end
rescue LoadError
require "rubygems"
require "cgi_fast_escape"
end
Bacon.summary_on_exit
diff --git a/spec/lib/cgi_fast_escape.rb b/spec/lib/cgi_fast_escape.rb
index 9e495da..0371388 100644
--- a/spec/lib/cgi_fast_escape.rb
+++ b/spec/lib/cgi_fast_escape.rb
@@ -1,51 +1,55 @@
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file which accompanies this software for the full text
+#
require File.expand_path("../../helper", __FILE__)
describe "CgiFastEscape" do
describe "module embedding" do
describe "escape methods" do
it "defines fast_escape on CGI" do
CGI.respond_to?(:fast_escape).should.be.true
end
it "aliases original escape on CGI to old_escape" do
CGI.respond_to?(:old_escape).should.be.true
end
it "sets CGI.fast_escape?" do
CGI.fast_escape?.should.be.true
end
end
describe "unescape methods" do
it "defines fast_unescape on CGI" do
CGI.respond_to?(:fast_unescape).should.be.true
end
it "aliases original unescape on CGI to old_unescape" do
CGI.respond_to?(:old_unescape).should.be.true
end
it "sets CGI.fast_unescape?" do
CGI.fast_unescape?.should.be.true
end
end
end
end
describe "CGI" do
describe "#escape" do
it "unescapes spaces in an encoded url" do
CGI.unescape("foo%20bar").should == "foo bar"
CGI.unescape("foo+bar").should == "foo bar"
end
end
describe "#escape" do
it "escapes spaces in an encoded url" do
CGI.escape("foo bar").should == "foo+bar"
end
end
end
diff --git a/tasks/copyright.rake b/tasks/copyright.rake
index 1c25a35..66a635a 100644
--- a/tasks/copyright.rake
+++ b/tasks/copyright.rake
@@ -1,38 +1,41 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
# Distributed under the terms of the MIT license.
# See the LICENSE file that accompanied this software for the full MIT License text
#
require "pathname"
task :legal do
license = Pathname("LICENSE")
license.open("w+") do |f|
f.puts PROJECT_COPYRIGHT
end unless license.file? and license.read == PROJECT_COPYRIGHT
doc = Pathname("doc/LEGAL")
doc.open("w+") do |f|
f.puts "LICENSE"
end unless doc.file?
end
desc "add copyright summary to all .rb files in the distribution"
task :copyright => [:legal] do
doc = Pathname("doc/LEGAL")
ignore = doc.readlines.
select { |line| line.strip!; Pathname(line).file? }.
map { |file| Pathname(file).expand_path }
puts "adding copyright summary to files that don't have it currently"
puts PROJECT_COPYRIGHT_SUMMARY
puts
(Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') +
- Pathname.glob("tasks/*.rake") +
Pathname.glob("Rakefile")).each do |file|
next if ignore.include? file.expand_path
lines = file.readlines.map{ |l| l.chomp }
+ if lines.first.match(/^# \* \w.*/)
+ @f = lines.shift
+ end
unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY
oldlines = file.readlines
- file.open("w+") { |f| f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
+ oldlines.shift if @f
+ file.open("w+") { |f| f.puts @f if @f;f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
end
end
end
diff --git a/tasks/release.rake b/tasks/release.rake
index d781a4f..0c2c4f3 100644
--- a/tasks/release.rake
+++ b/tasks/release.rake
@@ -1,52 +1,52 @@
namespace :release do
task :all => [:release_github, :release_rubyforge]
desc 'Display instructions to release on github'
task :github => [:reversion, :gemspec] do
name, version = GEMSPEC.name, GEMSPEC.version
puts <<INSTRUCTIONS
First add the relevant files:
git add AUTHORS MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
Then commit them, tag the commit, and push:
git commit -m 'Version #{version}'
git tag -a -m '#{version}' '#{version}'
git push
INSTRUCTIONS
end
# TODO: Not tested
desc 'Display instructions to release on rubyforge'
task :rubyforge => [:reversion, :gemspec, :package] do
- name, version = GEMSPEC.name, GEMSPEC.version.to_s
+ rf_project, name, version = GEMSPEC.rubyforge_project, GEMSPEC.name, GEMSPEC.version.to_s
puts <<INSTRUCTIONS
To publish to rubyforge do following:
rubyforge login
-rubyforge add_release #{name} #{name} #{version.dump} pkg/#{name}-#{version}.gem
+rubyforge add_release #{rf_project} #{name} #{version.dump} -n README pkg/#{name}-#{version}.gem
After you have done these steps, see:
VERSION=#{version.dump} rake release:rubyforge_archives
INSTRUCTIONS
end
desc 'Display instructions to add archives after release:rubyforge'
task :rubyforge_archives do
- name, version = GEMSPEC.name, GEMSPEC.version.to_s
+ rf_project, name, version = GEMSPEC.rubyforge_project, GEMSPEC.name, GEMSPEC.version.to_s
puts "Adding archives for distro packagers is:", ""
Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
- puts "rubyforge add_file %s %s %p %p" % [name, name, version, file]
+ puts "rubyforge add_file %s %s %p %p" % [rf_project, name, version, file]
end
puts
end
end
|
bougyman/cgi_fast_escape | 5707c73c430d2cf732c5fe2cfc2ab4433a814290 | added url_escape dependency | diff --git a/tasks/setup.rake b/tasks/setup.rake
index 13a218e..c19a8e9 100644
--- a/tasks/setup.rake
+++ b/tasks/setup.rake
@@ -1,15 +1,15 @@
desc 'install all possible dependencies'
task :setup => :gem_installer do
GemInstaller.new do
# core
- gem 'rack'
+ gem 'url_escape'
# spec
gem 'bacon'
# doc
gem 'yard'
setup
end
end
|
bougyman/cgi_fast_escape | 6211693f33713f79922f3fa6a182e2b8c9f62990 | initial port from rack_fast_escape | diff --git a/README b/README
new file mode 100644
index 0000000..bf7265a
--- /dev/null
+++ b/README
@@ -0,0 +1,46 @@
+== Rack Fast Escape/Unescape
+----------
+
+ The Rack Fast Escape library, by The Rubyists, LLC
+
+This library replaces the Rack::Utils.escape and #unescape methods
+with the versions from URLEscape, a C extension which increases the
+efficiency of these methods at least 20x.
+
+== Download
+
+ Standard gem locations, source on github
+
+== Usage
+-------
+
+ require "rack"
+ require "rack_fast_escape"
+ Rack::Utils.escape("%03a" * 10000000)
+
+Note: The above with Rack::Utils.escape may eat a lot of cycles.
+
+== Tests
+
+If you have the full source, run the specs with 'rake' in the
+root of the library tree (lib/..).
+
+== Benchmarks
+
+|user|system|total|real
+URLEscape::unescape|0.090000|0.000000|0.090000|( 0.090418)
+CGI::unescape|2.920000|0.000000|2.920000|( 2.924822)
+
+|user|system|total|real
+URLEscape::unescape|0.090000|0.000000|0.090000|( 0.089071)
+Rack::Utils::unescape|3.120000|0.010000|3.130000|( 3.125334)
+
+|user|system|total|real
+URLEscape::escape|0.200000|0.000000|0.200000|( 0.194290)
+Rack::Utils::escape|3.960000|0.000000|3.960000|( 3.995122)|
+
+== Support
+
+See #rubyists on freenode or [email protected]
+
+Copyright(c) 2009 by The Rubyists, LLC
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..de9f44a
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,97 @@
+begin; require 'rubygems'; rescue LoadError; end
+
+require 'rake'
+require 'rake/clean'
+require 'rake/gempackagetask'
+require 'time'
+require 'date'
+require "lib/cgi_fast_escape"
+
+PROJECT_SPECS = FileList[
+ 'spec/*/**/*.rb'
+]
+
+PROJECT_MODULE = 'CgiFastEscape'
+PROJECT_README = 'README'
+#PROJECT_RUBYFORGE_GROUP_ID = 3034
+PROJECT_COPYRIGHT_SUMMARY = [
+ "# Copyright (c) 2008-#{Time.now.year} The Rubyists, LLC (effortless systems) <[email protected]>",
+ "# Distributed under the terms of the MIT license.",
+ "# See the LICENSE file which accompanies this software for the full text",
+ "#"
+]
+PROJECT_COPYRIGHT = PROJECT_COPYRIGHT_SUMMARY + [
+ "# 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."
+]
+
+PROJECT_VERSION =
+ if version = ENV['PROJECT_VERSION'] || ENV['VERSION']
+ version
+ else
+ begin
+ require "lib/cgi_fast_escape/version"
+ RackFastEscape::VERSION
+ rescue
+ Date.today.strftime("%Y.%m.%d")
+ end
+ end
+
+# To release the monthly version do:
+# $ PROJECT_VERSION=2009.03 rake release
+
+PROJECT_FILES = FileList[`git ls-files`.split("\n")].exclude('.gitignore').exclude("cgi_fast_escape.gemspec")
+
+GEMSPEC = Gem::Specification.new{|s|
+ s.name = "cgi_fast_escape"
+ s.author = "The Rubyists, LLC"
+ s.summary = "The Rack Fast Escape library, by The Rubyists, LLC"
+ s.description = "The Rack Fast Escape library, by The Rubyists, LLC"
+ s.email = "The Rubyists, LLC <[email protected]>"
+ s.homepage = "http://github.com/bougyman/cgi_fast_escape"
+ s.platform = Gem::Platform::RUBY
+ s.version = PROJECT_VERSION
+ s.files = PROJECT_FILES
+ s.require_path = "lib"
+
+
+ s.post_install_message = <<MESSAGE
+============================================================
+
+Thank you for installing CgiFastEscape!
+
+============================================================
+MESSAGE
+}
+
+Dir.glob('tasks/*.rake'){|f| import(f) }
+
+task :default => [:bacon]
+
+CLEAN.include %w[
+ **/.*.sw?
+ *.gem
+ .config
+ **/*~
+ **/{data.db,cache.yaml}
+ *.yaml
+ pkg
+ rdoc
+ ydoc
+ *coverage*
+]
diff --git a/lib/cgi_fast_escape.rb b/lib/cgi_fast_escape.rb
new file mode 100644
index 0000000..c6a3dfb
--- /dev/null
+++ b/lib/cgi_fast_escape.rb
@@ -0,0 +1,27 @@
+%w{cgi url_escape}.each { |lib|
+ begin
+ require lib
+ rescue LoadError
+ require "rubygems"
+ require lib
+ end
+}
+
+class CGI
+ class << self
+ # Move the old versions
+ alias :old_escape :escape
+ alias :old_unescape :unescape
+
+ # Pull in the new versions
+ extend URLEscape
+
+ # Make new versions explictly available
+ alias :fast_escape :escape
+ alias :fast_unescape :unescape
+
+ # Allow for detection
+ def fast_escape?; true; end
+ def fast_unescape?; true; end
+ end
+end
diff --git a/lib/cgi_fast_escape/version.rb b/lib/cgi_fast_escape/version.rb
new file mode 100644
index 0000000..ed479bc
--- /dev/null
+++ b/lib/cgi_fast_escape/version.rb
@@ -0,0 +1,3 @@
+module CgiFastEscape
+ VERSION = "0.0.2"
+end
diff --git a/spec/helper.rb b/spec/helper.rb
new file mode 100644
index 0000000..e58ec42
--- /dev/null
+++ b/spec/helper.rb
@@ -0,0 +1,22 @@
+require "pathname"
+%w{bacon rack}.each { |lib|
+ begin
+ require lib
+ rescue LoadError
+ require "rubygems"
+ require lib
+ end
+}
+
+begin
+ if (local_path = Pathname.new(__FILE__).dirname.join("..", "lib", "cgi_fast_escape.rb")).file?
+ require local_path
+ else
+ require "cgi_fast_escape"
+ end
+rescue LoadError
+ require "rubygems"
+ require "cgi_fast_escape"
+end
+
+Bacon.summary_on_exit
diff --git a/spec/lib/cgi_fast_escape.rb b/spec/lib/cgi_fast_escape.rb
new file mode 100644
index 0000000..9e495da
--- /dev/null
+++ b/spec/lib/cgi_fast_escape.rb
@@ -0,0 +1,51 @@
+require File.expand_path("../../helper", __FILE__)
+describe "CgiFastEscape" do
+ describe "module embedding" do
+
+ describe "escape methods" do
+ it "defines fast_escape on CGI" do
+ CGI.respond_to?(:fast_escape).should.be.true
+ end
+
+ it "aliases original escape on CGI to old_escape" do
+ CGI.respond_to?(:old_escape).should.be.true
+ end
+
+ it "sets CGI.fast_escape?" do
+ CGI.fast_escape?.should.be.true
+ end
+ end
+
+ describe "unescape methods" do
+ it "defines fast_unescape on CGI" do
+ CGI.respond_to?(:fast_unescape).should.be.true
+ end
+
+ it "aliases original unescape on CGI to old_unescape" do
+ CGI.respond_to?(:old_unescape).should.be.true
+ end
+
+ it "sets CGI.fast_unescape?" do
+ CGI.fast_unescape?.should.be.true
+ end
+ end
+
+ end
+
+end
+
+describe "CGI" do
+ describe "#escape" do
+ it "unescapes spaces in an encoded url" do
+ CGI.unescape("foo%20bar").should == "foo bar"
+ CGI.unescape("foo+bar").should == "foo bar"
+ end
+ end
+
+ describe "#escape" do
+ it "escapes spaces in an encoded url" do
+ CGI.escape("foo bar").should == "foo+bar"
+ end
+ end
+end
+
diff --git a/tasks/authors.rake b/tasks/authors.rake
new file mode 100644
index 0000000..ade2d40
--- /dev/null
+++ b/tasks/authors.rake
@@ -0,0 +1,33 @@
+# Once git has a fix for the glibc in handling .mailmap and another fix for
+# allowing empty mail address to be mapped in .mailmap we won't have to handle
+# them manually.
+
+desc 'Update AUTHORS'
+task :authors do
+ authors = Hash.new(0)
+
+ `git shortlog -nse`.scan(/(\d+)\s(.+)\s<(.*)>$/) do |count, name, email|
+ # Examples of mappping, replace with your own or comment this out/delete it
+ case name
+ when /^(?:bougyman$|TJ Vanderpoel)/
+ name, email = "TJ Vanderpoel", "[email protected]"
+ when /^(?:manveru$|Michael Fellinger)/
+ name, email = "Michael Fellinger", "[email protected]"
+ when /^(?:deathsyn$|Kevin Berry)/
+ name, email = "Kevin Berry", "[email protected]"
+ when /^(?:(?:jayson|thedonvaughn|jvaughn)$|Jayson Vaughn)/
+ name, email = "Jayson Vaughn", "[email protected]"
+ end
+
+ authors[[name, email]] += count.to_i
+ end
+
+ File.open('AUTHORS', 'w+') do |io|
+ io.puts "Following persons have contributed to #{GEMSPEC.name}."
+ io.puts '(Sorted by number of submitted patches, then alphabetically)'
+ io.puts ''
+ authors.sort_by{|(n,e),c| [-c, n.downcase] }.each do |(name, email), count|
+ io.puts("%6d %s <%s>" % [count, name, email])
+ end
+ end
+end
diff --git a/tasks/bacon.rake b/tasks/bacon.rake
new file mode 100644
index 0000000..1fb04d9
--- /dev/null
+++ b/tasks/bacon.rake
@@ -0,0 +1,70 @@
+desc 'Run all bacon specs with pretty output'
+task :bacon => :setup do
+ require 'open3'
+ require 'scanf'
+ require 'matrix'
+
+ specs = PROJECT_SPECS
+
+ some_failed = false
+ specs_size = specs.size
+ if specs.size == 0
+ $stderr.puts "You have no specs! Put a spec in spec/ before running this task"
+ exit 1
+ end
+ len = specs.map{|s| s.size }.sort.last
+ total_tests = total_assertions = total_failures = total_errors = 0
+ totals = Vector[0, 0, 0, 0]
+
+ red, yellow, green = "\e[31m%s\e[0m", "\e[33m%s\e[0m", "\e[32m%s\e[0m"
+ left_format = "%4d/%d: %-#{len + 11}s"
+ spec_format = "%d specifications (%d requirements), %d failures, %d errors"
+
+ specs.each_with_index do |spec, idx|
+ print(left_format % [idx + 1, specs_size, spec])
+
+ Open3.popen3(RUBY, spec) do |sin, sout, serr|
+ out = sout.read.strip
+ err = serr.read.strip
+
+ # this is conventional, see spec/innate/state/fiber.rb for usage
+ if out =~ /^Bacon::Error: (needed .*)/
+ puts(yellow % ("%6s %s" % ['', $1]))
+ else
+ total = nil
+
+ out.each_line do |line|
+ scanned = line.scanf(spec_format)
+
+ next unless scanned.size == 4
+
+ total = Vector[*scanned]
+ break
+ end
+
+ if total
+ totals += total
+ tests, assertions, failures, errors = total_array = total.to_a
+
+ if tests > 0 && failures + errors == 0
+ puts((green % "%6d passed") % tests)
+ else
+ some_failed = true
+ puts(red % " failed")
+ puts out unless out.empty?
+ puts err unless err.empty?
+ end
+ else
+ some_failed = true
+ puts(red % " failed")
+ puts out unless out.empty?
+ puts err unless err.empty?
+ end
+ end
+ end
+ end
+
+ total_color = some_failed ? red : green
+ puts(total_color % (spec_format % totals.to_a))
+ exit 1 if some_failed
+end
diff --git a/tasks/changelog.rake b/tasks/changelog.rake
new file mode 100644
index 0000000..3cc15b0
--- /dev/null
+++ b/tasks/changelog.rake
@@ -0,0 +1,18 @@
+desc 'update changelog'
+task :changelog do
+ File.open('CHANGELOG', 'w+') do |changelog|
+ `git log -z --abbrev-commit`.split("\0").each do |commit|
+ next if commit =~ /^Merge: \d*/
+ ref, author, time, _, title, _, message = commit.split("\n", 7)
+ ref = ref[/commit ([0-9a-f]+)/, 1]
+ author = author[/Author: (.*)/, 1].strip
+ time = Time.parse(time[/Date: (.*)/, 1]).utc
+ title.strip!
+
+ changelog.puts "[#{ref} | #{time}] #{author}"
+ changelog.puts '', " * #{title}"
+ changelog.puts '', message.rstrip if message
+ changelog.puts
+ end
+ end
+end
diff --git a/tasks/copyright.rake b/tasks/copyright.rake
new file mode 100644
index 0000000..1c25a35
--- /dev/null
+++ b/tasks/copyright.rake
@@ -0,0 +1,38 @@
+# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <[email protected]>
+# Distributed under the terms of the MIT license.
+# See the LICENSE file that accompanied this software for the full MIT License text
+#
+require "pathname"
+task :legal do
+ license = Pathname("LICENSE")
+ license.open("w+") do |f|
+ f.puts PROJECT_COPYRIGHT
+ end unless license.file? and license.read == PROJECT_COPYRIGHT
+ doc = Pathname("doc/LEGAL")
+ doc.open("w+") do |f|
+ f.puts "LICENSE"
+ end unless doc.file?
+end
+
+desc "add copyright summary to all .rb files in the distribution"
+task :copyright => [:legal] do
+ doc = Pathname("doc/LEGAL")
+ ignore = doc.readlines.
+ select { |line| line.strip!; Pathname(line).file? }.
+ map { |file| Pathname(file).expand_path }
+
+ puts "adding copyright summary to files that don't have it currently"
+ puts PROJECT_COPYRIGHT_SUMMARY
+ puts
+
+ (Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') +
+ Pathname.glob("tasks/*.rake") +
+ Pathname.glob("Rakefile")).each do |file|
+ next if ignore.include? file.expand_path
+ lines = file.readlines.map{ |l| l.chomp }
+ unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY
+ oldlines = file.readlines
+ file.open("w+") { |f| f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
+ end
+ end
+end
diff --git a/tasks/gem.rake b/tasks/gem.rake
new file mode 100644
index 0000000..cfed8d8
--- /dev/null
+++ b/tasks/gem.rake
@@ -0,0 +1,23 @@
+require 'rake/gempackagetask'
+
+desc "make a gemspec"
+task :gemspec => [:manifest, :changelog, :authors] do
+ gemspec_file = "#{GEMSPEC.name}.gemspec"
+ File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
+end
+
+desc "package and install from gemspec"
+task :install => [:gemspec] do
+ sh "gem build #{GEMSPEC.name}.gemspec"
+ sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
+end
+
+desc "uninstall the gem"
+task :uninstall => [:clean] do
+ sh %{gem uninstall -x #{GEMSPEC.name}}
+end
+
+Rake::GemPackageTask.new(GEMSPEC) do |p|
+ p.need_tar = true
+ p.need_zip = true
+end
diff --git a/tasks/gem_installer.rake b/tasks/gem_installer.rake
new file mode 100644
index 0000000..dab250b
--- /dev/null
+++ b/tasks/gem_installer.rake
@@ -0,0 +1,76 @@
+task :gem_installer do
+ class GemInstaller
+ def initialize(options = {}, &block)
+ @gems = []
+ @options = options
+
+ run(&block)
+ end
+
+ def run(&block)
+ instance_eval(&block) if block_given?
+ end
+
+ def gem(name, version = nil, options = {})
+ if version.respond_to?(:merge!)
+ options = version
+ else
+ options[:version] = version
+ end
+
+ @gems << [name, options]
+ end
+
+ def setup_gemspec(gemspec)
+ gemspec.dependencies.each do |dependency|
+ dependency.version_requirements.as_list.each do |version|
+ gem(dependency.name, version)
+ end
+ end
+
+ setup
+ end
+
+ def setup
+ require 'rubygems'
+ require 'rubygems/dependency_installer'
+
+ @gems.each do |name, options|
+ setup_gem(name, options)
+ end
+ end
+
+ def setup_gem(name, options, try_install = true)
+ print "activating #{name} ... "
+ Gem.activate(name, *[options[:version]].compact)
+ require(options[:lib] || name)
+ puts "success."
+ rescue LoadError => error
+ puts error
+ install_gem(name, options) if try_install
+ setup_gem(name, options, try_install = false)
+ end
+
+ def install_gem(name, options)
+ installer = Gem::DependencyInstaller.new(options)
+
+ temp_argv(options[:extconf]) do
+ print "Installing #{name} ... "
+ installer.install(name, options[:version])
+ puts "done."
+ end
+ end
+
+ def temp_argv(extconf)
+ if extconf ||= @options[:extconf]
+ old_argv = ARGV.clone
+ ARGV.replace(extconf.split(' '))
+ end
+
+ yield
+
+ ensure
+ ARGV.replace(old_argv) if extconf
+ end
+ end
+end
diff --git a/tasks/manifest.rake b/tasks/manifest.rake
new file mode 100644
index 0000000..657b053
--- /dev/null
+++ b/tasks/manifest.rake
@@ -0,0 +1,4 @@
+desc 'update manifest'
+task :manifest do
+ File.open('MANIFEST', 'w+'){|io| io.puts(*GEMSPEC.files) }
+end
diff --git a/tasks/release.rake b/tasks/release.rake
new file mode 100644
index 0000000..d781a4f
--- /dev/null
+++ b/tasks/release.rake
@@ -0,0 +1,52 @@
+namespace :release do
+ task :all => [:release_github, :release_rubyforge]
+
+ desc 'Display instructions to release on github'
+ task :github => [:reversion, :gemspec] do
+ name, version = GEMSPEC.name, GEMSPEC.version
+
+ puts <<INSTRUCTIONS
+First add the relevant files:
+
+git add AUTHORS MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
+
+Then commit them, tag the commit, and push:
+
+git commit -m 'Version #{version}'
+git tag -a -m '#{version}' '#{version}'
+git push
+
+INSTRUCTIONS
+
+ end
+
+ # TODO: Not tested
+ desc 'Display instructions to release on rubyforge'
+ task :rubyforge => [:reversion, :gemspec, :package] do
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
+
+ puts <<INSTRUCTIONS
+To publish to rubyforge do following:
+
+rubyforge login
+rubyforge add_release #{name} #{name} #{version.dump} pkg/#{name}-#{version}.gem
+
+After you have done these steps, see:
+
+VERSION=#{version.dump} rake release:rubyforge_archives
+
+INSTRUCTIONS
+ end
+
+ desc 'Display instructions to add archives after release:rubyforge'
+ task :rubyforge_archives do
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
+ puts "Adding archives for distro packagers is:", ""
+
+ Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
+ puts "rubyforge add_file %s %s %p %p" % [name, name, version, file]
+ end
+
+ puts
+ end
+end
diff --git a/tasks/reversion.rake b/tasks/reversion.rake
new file mode 100644
index 0000000..f13b615
--- /dev/null
+++ b/tasks/reversion.rake
@@ -0,0 +1,8 @@
+desc "update version.rb"
+task :reversion do
+ File.open("lib/#{GEMSPEC.name}/version.rb", 'w+') do |file|
+ file.puts("module #{PROJECT_MODULE}")
+ file.puts(' VERSION = %p' % GEMSPEC.version.to_s)
+ file.puts('end')
+ end
+end
diff --git a/tasks/setup.rake b/tasks/setup.rake
new file mode 100644
index 0000000..13a218e
--- /dev/null
+++ b/tasks/setup.rake
@@ -0,0 +1,15 @@
+desc 'install all possible dependencies'
+task :setup => :gem_installer do
+ GemInstaller.new do
+ # core
+ gem 'rack'
+
+ # spec
+ gem 'bacon'
+
+ # doc
+ gem 'yard'
+
+ setup
+ end
+end
diff --git a/tasks/yard.rake b/tasks/yard.rake
new file mode 100644
index 0000000..ddb034e
--- /dev/null
+++ b/tasks/yard.rake
@@ -0,0 +1,4 @@
+desc 'Generate YARD documentation'
+task :yard => :clean do
+ sh("yardoc -o ydoc --protected -r #{PROJECT_README} lib/**/*.rb tasks/*.rake")
+end
|
hakobera/Simple-WebSocket-Client | 6df829683674cde421e7e0b95fd032a5d2050258 | Add LICENSE.txt | diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..de39ef3
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2010-2016 Kazuyuki Honda
+
+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.
diff --git a/README.md b/README.md
index b9369ff..b2affe4 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
-Simple-WebSocket-Client
-=======================
+# Simple-WebSocket-Client
Simple WebSocket Client is an extension for Google Chrome
to help construct custom Web Socket requests
and handle responses to directly test your Web Socket services.
-Extension URL
--------------
-https://chrome.google.com/extensions/detail/pfdhoblngboilpfeibdedpjgfnlcodoo
\ No newline at end of file
+## Extension URL
+
+https://chrome.google.com/extensions/detail/pfdhoblngboilpfeibdedpjgfnlcodoo
+
+## License
+
+This software is released under the MIT License, see LICENSE.txt.
|
hakobera/Simple-WebSocket-Client | b5e321f6587bd232f2635f056d5ab9a18d6f69ff | Support manifest version 2 | diff --git a/background.html b/background.js
similarity index 88%
rename from background.html
rename to background.js
index ab81ca6..6b6692b 100644
--- a/background.html
+++ b/background.js
@@ -1,26 +1,23 @@
-<html><head><script>
var extension_url = 'chrome-extension://'+location.host+'/index.html';
function isOptionsUrl(url) {
if(url == extension_url) {
return true;
}
return false;
}
// Find options page in all opened tabs
function goToOptions() {
chrome.tabs.getAllInWindow(undefined, function(tabs) {
for (var i = 0, tab; tab = tabs[i]; i++) {
if (tab.url && isOptionsUrl(tab.url)) {
chrome.tabs.update(tab.id, {selected: true});
return;
}
}
chrome.tabs.create({url: extension_url});
});
}
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
goToOptions();
});
-</script>
-</head><body></body></html>
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 24a3846..382f999 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,20 +1,24 @@
{
"name": "Simple WebSocket Client",
- "version": "0.1.2",
+ "manifest_version": 2,
+ "version": "0.1.3",
"description": "Construct custom Web Socket requests and handle responses to directly test your Web Socket services.",
"icons": {
"16": "resources/icon_032.png",
"32": "resources/icon_032.png",
"48": "resources/icon_048.png",
"128": "resources/icon_128.png"
},
-
+
"browser_action": {
"default_icon": "resources/icon_032.png"
},
-
+
"options_page": "index.html",
- "background_page": "background.html",
+
+ "background":{
+ "scripts": [ "background.js" ]
+ },
"permissions": [ "tabs" ]
}
|
hakobera/Simple-WebSocket-Client | 73ec3d5db1ce7e43c463edf27740bd9d9ec55987 | Improve UX. Add send message shortcut Show sent message log. | diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2ad6589
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.crx
+*.zip
+*.pem
+.DS_Store
+*.tmproj
+*~
+/deletefile.list
+/.project
diff --git a/.project b/.project
deleted file mode 100644
index d67ba61..0000000
--- a/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>Simple-WebSocket-Client</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- </buildSpec>
- <natures>
- </natures>
-</projectDescription>
diff --git a/README b/README.md
similarity index 100%
rename from README
rename to README.md
diff --git a/RELEASE b/RELEASE
new file mode 100644
index 0000000..f2d5d8d
--- /dev/null
+++ b/RELEASE
@@ -0,0 +1,8 @@
+ver 0.1.2 (2010-10-25)
+======================
+Improve UX.
+
+ver 0.1.1 (2010-10-18)
+======================
+First release.
+
\ No newline at end of file
diff --git a/css/style.css b/css/style.css
index f5d6e01..1f530cb 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,63 +1,69 @@
body {
width: 100%;
font-family: font-family:'qMmpS Pro W3','Hiragino Kaku Gothic Pro','CI',Meiryo,'lr oSVbN',sans-serif;
+ color: #000;
background-color: #eee;
+ font-size: 10pt;
}
fieldset {
margin-bottom: 10px;
- padding: 10px;
+ padding: 5px 10px;
border: 1px solid #777;
- border-radius: 5px;
}
legend {
- padding: 5px;
- border-radius: 5px;
- font-size: 12pt;
+ padding: 0 5px;
+ color: #777;
+ font-size: 11pt;
font-weight: bold;
}
-fieldset div {
- margin-bottom: 5px;
+label {
+ color: #777;
+ font-weight: bold;
}
-textarea {
- width: 95%;
- height: 100px;
- padding: 5px;
+#connectionStatus {
+ font-weight: bold;
}
#content {
padding: 10px;
}
-#settingArea {
- font-size: 12pt;
-}
-
-#settingArea label {
- display: inline-block;
- width: 60px;
- font-weight: bold;
-}
-
#serverUrl {
- width: 300px;
- padding: 3px;
+ width: 225px;
+ padding: 1px 3px;
border: 1px solid #999;
}
-#connectButton {
-}
-
#disconnectButton {
display: none;
}
+#requestArea textarea {
+ min-width: 300px;
+ height: 2em;
+ padding: 0 3px;
+ line-height: 150%;
+}
+
#messages {
- width: 100%;
- max-height: 400px;
+ height: 300px;
+ margin: 5px 0;
+ padding: 0 5px;
overflow: auto;
+ border: 1px dotted #777;
+ background-color: #fff;
+ line-height: 150%;
+}
+
+#messages pre {
+ width: 100%;
+ color: #000;
}
+#messages pre.sent {
+ color: #f63;
+}
\ No newline at end of file
diff --git a/index.html b/index.html
index 1cc0f25..63094a4 100644
--- a/index.html
+++ b/index.html
@@ -1,115 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Simple Web Socket Client</title>
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
- <script type="text/javascript" src="lib/jquery-1.4.3.min.js"></script>
</head>
<body>
<div id="content">
- <div id="settingArea">
- <fieldset>
- <legend>Server Settings</legend>
- <div>
- <label>URL:</label>
- <input type="text" id="serverUrl" value=""/>
- <button id="connectButton">Open</button>
- <button id="disconnectButton">Close</button>
- </div>
- <div>
- <label>Status:</label>
- <span id="connectionStatus">closed</span>
- </div>
- </fieldset>
- </div>
- <div id="requestArea">
- <fieldset>
- <legend>Request</legend>
- <div>
- <textarea id="sendMessage"></textarea>
- </div>
- <div>
- <button id="sendButton" disabled="disabled">Send</button>
- </div>
- </fieldset>
- </div>
- <div id="messageArea">
- <fieldset>
- <legend>Messages [ <a href="#" id="clearMessage">clear</a> ]</legend>
- <ul id="messages">
- </ul>
- </fieldset>
- </div>
+ <fieldset>
+ <legend>Server Location</legend>
+ <div>
+ <label>URL:</label>
+ <input type="text" id="serverUrl" value="ws://"/>
+ <button id="connectButton">Open</button>
+ <button id="disconnectButton">Close</button>
+ </div>
+ <div>
+ <label>Status:</label>
+ <span id="connectionStatus">CLOSED</span>
+ </div>
+ </fieldset>
+ <fieldset id="requestArea">
+ <legend>Request</legend>
+ <div>
+ <textarea id="sendMessage" disabled="disabled"></textarea>
+ </div>
+ <div>
+ <button id="sendButton" disabled="disabled">Send</button>
+ [Shortcut] Ctr + Enter
+ </div>
+ </fieldset>
+ <fieldset id="messageArea">
+ <legend>Message Log <button id="clearMessage">Clear</button></legend>
+ <div id="messages"></div>
+ </fieldset>
</div>
-<script>
-var ws = null;
-var connected = false;
-
-var connectionStatus = $('#connectionStatus');
-var connectButton = $('#connectButton');
-var disconnectButton = $('#disconnectButton');
-var sendButton = $('#sendButton');
-
-var close = function() {
- if (ws) {
- console.log('closing ...');
- ws.close();
- }
- connected = false;
- connectionStatus.text('closed');
- sendButton.attr('disabled', 'disabled');
-}
-
-var onOpen = function() {
- console.log('connected');
- connected = true;
- connectionStatus.text('opened');
- sendButton.removeAttr('disabled');
-};
-
-var onClose = function() {
- console.log('closed');
-};
-
-var onMessage = function(event) {
- console.log(event.data);
- var data = event.data;
- var msg = $('<li>').text(data);
- $('#messages').append(msg);
-};
-
-$(function() {
- connectButton.click(function(e) {
- close();
-
- var url = $('#serverUrl').val();
- ws = new WebSocket(url);
- ws.onopen = onOpen;
- ws.onclose = onClose;
- ws.onmessage = onMessage;
-
- connectionStatus.text('opening ...');
- connectButton.hide();
- disconnectButton.show();
- });
-
- disconnectButton.click(function(e) {
- close();
- connectButton.show();
- disconnectButton.hide();
- });
-
- sendButton.click(function(e) {
- var msg = $('#sendMessage').val();
- ws.send(msg);
- });
-
- $('#clearMessage').click(function(e) {
- $('#messages').html('');
- });
-});
-</script>
+<script type="text/javascript" src="lib/jquery-1.4.3.min.js"></script>
+<script type="text/javascript" src="index.js"></script>
</body>
</html>
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..71dbc21
--- /dev/null
+++ b/index.js
@@ -0,0 +1,128 @@
+new function() {
+ var ws = null;
+ var connected = false;
+
+ var serverUrl;
+ var connectionStatus;
+ var sendMessage;
+
+ var connectButton;
+ var disconnectButton;
+ var sendButton;
+
+ var open = function() {
+ var url = serverUrl.val();
+ ws = new WebSocket(url);
+ ws.onopen = onOpen;
+ ws.onclose = onClose;
+ ws.onmessage = onMessage;
+ ws.onerror = onError;
+
+ connectionStatus.text('OPENING ...');
+ serverUrl.attr('disabled', 'disabled');
+ connectButton.hide();
+ disconnectButton.show();
+ }
+
+ var close = function() {
+ if (ws) {
+ console.log('CLOSING ...');
+ ws.close();
+ }
+ connected = false;
+ connectionStatus.text('CLOSED');
+
+ serverUrl.removeAttr('disabled');
+ connectButton.show();
+ disconnectButton.hide();
+ sendMessage.attr('disabled', 'disabled');
+ sendButton.attr('disabled', 'disabled');
+ }
+
+ var clearLog = function() {
+ $('#messages').html('');
+ }
+
+ var onOpen = function() {
+ console.log('OPENED: ' + serverUrl.val());
+ connected = true;
+ connectionStatus.text('OPENED');
+ sendMessage.removeAttr('disabled');
+ sendButton.removeAttr('disabled');
+ };
+
+ var onClose = function() {
+ console.log('CLOSED: ' + serverUrl.val());
+ ws = null;
+ };
+
+ var onMessage = function(event) {
+ var data = event.data;
+ addMessage(data);
+ };
+
+ var onError = function(event) {
+ alert(event.data);
+ }
+
+ var addMessage = function(data, type) {
+ var msg = $('<pre>').text(data);
+ if (type === 'SENT') {
+ msg.addClass('sent');
+ }
+ var messages = $('#messages');
+ messages.append(msg);
+
+ var msgBox = messages.get(0);
+ while (msgBox.childNodes.length > 1000) {
+ msgBox.removeChild(msgBox.firstChild);
+ }
+ msgBox.scrollTop = msgBox.scrollHeight;
+ }
+
+ WebSocketClient = {
+ init: function() {
+ serverUrl = $('#serverUrl');
+ connectionStatus = $('#connectionStatus');
+ sendMessage = $('#sendMessage');
+
+ connectButton = $('#connectButton');
+ disconnectButton = $('#disconnectButton');
+ sendButton = $('#sendButton');
+
+ connectButton.click(function(e) {
+ close();
+ open();
+ });
+
+ disconnectButton.click(function(e) {
+ close();
+ });
+
+ sendButton.click(function(e) {
+ var msg = $('#sendMessage').val();
+ addMessage(msg, 'SENT');
+ ws.send(msg);
+ });
+
+ $('#clearMessage').click(function(e) {
+ clearLog();
+ });
+
+ var isCtrl;
+ sendMessage.keyup(function (e) {
+ if(e.which == 17) isCtrl=false;
+ }).keydown(function (e) {
+ if(e.which == 17) isCtrl=true;
+ if(e.which == 13 && isCtrl == true) {
+ sendButton.click();
+ return false;
+ }
+ });
+ }
+ };
+}
+
+$(function() {
+ WebSocketClient.init();
+});
\ No newline at end of file
|
hakobera/Simple-WebSocket-Client | 4cffc1bbaa8881d6dc2ce7280937db4f8a99058b | Add README. | diff --git a/README b/README
new file mode 100644
index 0000000..b9369ff
--- /dev/null
+++ b/README
@@ -0,0 +1,10 @@
+Simple-WebSocket-Client
+=======================
+
+Simple WebSocket Client is an extension for Google Chrome
+to help construct custom Web Socket requests
+and handle responses to directly test your Web Socket services.
+
+Extension URL
+-------------
+https://chrome.google.com/extensions/detail/pfdhoblngboilpfeibdedpjgfnlcodoo
\ No newline at end of file
|
hakobera/Simple-WebSocket-Client | 5cfd8f4d71fd6d116f502f56d423e9622b43dbb1 | Initial import. | diff --git a/.project b/.project
new file mode 100644
index 0000000..d67ba61
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Simple-WebSocket-Client</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/background.html b/background.html
new file mode 100644
index 0000000..ab81ca6
--- /dev/null
+++ b/background.html
@@ -0,0 +1,26 @@
+<html><head><script>
+var extension_url = 'chrome-extension://'+location.host+'/index.html';
+function isOptionsUrl(url) {
+ if(url == extension_url) {
+ return true;
+ }
+ return false;
+}
+// Find options page in all opened tabs
+function goToOptions() {
+ chrome.tabs.getAllInWindow(undefined, function(tabs) {
+ for (var i = 0, tab; tab = tabs[i]; i++) {
+ if (tab.url && isOptionsUrl(tab.url)) {
+ chrome.tabs.update(tab.id, {selected: true});
+ return;
+ }
+ }
+ chrome.tabs.create({url: extension_url});
+ });
+}
+// Called when the user clicks on the browser action.
+chrome.browserAction.onClicked.addListener(function(tab) {
+ goToOptions();
+});
+</script>
+</head><body></body></html>
\ No newline at end of file
diff --git a/css/reset.css b/css/reset.css
new file mode 100644
index 0000000..03f644e
--- /dev/null
+++ b/css/reset.css
@@ -0,0 +1,103 @@
+/*
+html5doctor.com Reset Stylesheet
+v1.4.1
+2010-03-01
+Author: Richard Clark - http://richclarkdesign.com
+*/
+
+html, body, div, span, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+abbr, address, cite, code,
+del, dfn, em, img, ins, kbd, q, samp,
+small, strong, sub, sup, var,
+b, i,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section, summary,
+time, mark, audio, video {
+ margin:0;
+ padding:0;
+ border:0;
+ outline:0;
+ font-size:100%;
+ vertical-align:baseline;
+ background:transparent;
+}
+
+body {
+ line-height:1;
+}
+
+:focus {
+ outline: 1;
+}
+
+article,aside,canvas,details,figcaption,figure,
+footer,header,hgroup,menu,nav,section,summary {
+ display:block;
+}
+
+nav ul {
+ list-style:none;
+}
+
+blockquote, q {
+ quotes:none;
+}
+
+blockquote:before, blockquote:after,
+q:before, q:after {
+ content:'';
+ content:none;
+}
+
+a {
+ margin:0;
+ padding:0;
+ border:0;
+ font-size:100%;
+ vertical-align:baseline;
+ background:transparent;
+}
+
+ins {
+ background-color:#ff9;
+ color:#000;
+ text-decoration:none;
+}
+
+mark {
+ background-color:#ff9;
+ color:#000;
+ font-style:italic;
+ font-weight:bold;
+}
+
+del {
+ text-decoration: line-through;
+}
+
+abbr[title], dfn[title] {
+ border-bottom:1px dotted #000;
+ cursor:help;
+}
+
+table {
+ border-collapse:collapse;
+ border-spacing:0;
+}
+
+hr {
+ display:block;
+ height:1px;
+ border:0;
+ border-top:1px solid #cccccc;
+ margin:1em 0;
+ padding:0;
+}
+
+input, select {
+ vertical-align:middle;
+}
\ No newline at end of file
diff --git a/css/style.css b/css/style.css
new file mode 100644
index 0000000..f5d6e01
--- /dev/null
+++ b/css/style.css
@@ -0,0 +1,63 @@
+body {
+ width: 100%;
+ font-family: font-family:'qMmpS Pro W3','Hiragino Kaku Gothic Pro','CI',Meiryo,'lr oSVbN',sans-serif;
+ background-color: #eee;
+}
+
+fieldset {
+ margin-bottom: 10px;
+ padding: 10px;
+ border: 1px solid #777;
+ border-radius: 5px;
+}
+
+legend {
+ padding: 5px;
+ border-radius: 5px;
+ font-size: 12pt;
+ font-weight: bold;
+}
+
+fieldset div {
+ margin-bottom: 5px;
+}
+
+textarea {
+ width: 95%;
+ height: 100px;
+ padding: 5px;
+}
+
+#content {
+ padding: 10px;
+}
+
+#settingArea {
+ font-size: 12pt;
+}
+
+#settingArea label {
+ display: inline-block;
+ width: 60px;
+ font-weight: bold;
+}
+
+#serverUrl {
+ width: 300px;
+ padding: 3px;
+ border: 1px solid #999;
+}
+
+#connectButton {
+}
+
+#disconnectButton {
+ display: none;
+}
+
+#messages {
+ width: 100%;
+ max-height: 400px;
+ overflow: auto;
+}
+
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..1cc0f25
--- /dev/null
+++ b/index.html
@@ -0,0 +1,115 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8"/>
+ <title>Simple Web Socket Client</title>
+ <link rel="stylesheet" type="text/css" href="css/reset.css"/>
+ <link rel="stylesheet" type="text/css" href="css/style.css"/>
+ <script type="text/javascript" src="lib/jquery-1.4.3.min.js"></script>
+</head>
+<body>
+<div id="content">
+ <div id="settingArea">
+ <fieldset>
+ <legend>Server Settings</legend>
+ <div>
+ <label>URL:</label>
+ <input type="text" id="serverUrl" value=""/>
+ <button id="connectButton">Open</button>
+ <button id="disconnectButton">Close</button>
+ </div>
+ <div>
+ <label>Status:</label>
+ <span id="connectionStatus">closed</span>
+ </div>
+ </fieldset>
+ </div>
+ <div id="requestArea">
+ <fieldset>
+ <legend>Request</legend>
+ <div>
+ <textarea id="sendMessage"></textarea>
+ </div>
+ <div>
+ <button id="sendButton" disabled="disabled">Send</button>
+ </div>
+ </fieldset>
+ </div>
+ <div id="messageArea">
+ <fieldset>
+ <legend>Messages [ <a href="#" id="clearMessage">clear</a> ]</legend>
+ <ul id="messages">
+ </ul>
+ </fieldset>
+ </div>
+</div>
+<script>
+var ws = null;
+var connected = false;
+
+var connectionStatus = $('#connectionStatus');
+var connectButton = $('#connectButton');
+var disconnectButton = $('#disconnectButton');
+var sendButton = $('#sendButton');
+
+var close = function() {
+ if (ws) {
+ console.log('closing ...');
+ ws.close();
+ }
+ connected = false;
+ connectionStatus.text('closed');
+ sendButton.attr('disabled', 'disabled');
+}
+
+var onOpen = function() {
+ console.log('connected');
+ connected = true;
+ connectionStatus.text('opened');
+ sendButton.removeAttr('disabled');
+};
+
+var onClose = function() {
+ console.log('closed');
+};
+
+var onMessage = function(event) {
+ console.log(event.data);
+ var data = event.data;
+ var msg = $('<li>').text(data);
+ $('#messages').append(msg);
+};
+
+$(function() {
+ connectButton.click(function(e) {
+ close();
+
+ var url = $('#serverUrl').val();
+ ws = new WebSocket(url);
+ ws.onopen = onOpen;
+ ws.onclose = onClose;
+ ws.onmessage = onMessage;
+
+ connectionStatus.text('opening ...');
+ connectButton.hide();
+ disconnectButton.show();
+ });
+
+ disconnectButton.click(function(e) {
+ close();
+ connectButton.show();
+ disconnectButton.hide();
+ });
+
+ sendButton.click(function(e) {
+ var msg = $('#sendMessage').val();
+ ws.send(msg);
+ });
+
+ $('#clearMessage').click(function(e) {
+ $('#messages').html('');
+ });
+});
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/lib/jquery-1.4.3.min.js b/lib/jquery-1.4.3.min.js
new file mode 100644
index 0000000..e274ff9
--- /dev/null
+++ b/lib/jquery-1.4.3.min.js
@@ -0,0 +1,166 @@
+/*!
+ * jQuery JavaScript Library v1.4.3
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Oct 14 23:10:06 2010 -0400
+ */
+(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;n<H.length;n++){k=H[n];k.origType.replace(X,
+"")===a.type?f.push(k.selector):H.splice(n--,1)}f=c(a.target).closest(f,a.currentTarget);s=0;for(v=f.length;s<v;s++){B=f[s];for(n=0;n<H.length;n++){k=H[n];if(B.selector===k.selector&&(!D||D.test(k.namespace))){l=B.elem;h=null;if(k.preType==="mouseenter"||k.preType==="mouseleave"){a.type=k.preType;h=c(a.relatedTarget).closest(k.selector)[0]}if(!h||h!==l)e.push({elem:l,handleObj:k,level:B.level})}}}s=0;for(v=e.length;s<v;s++){f=e[s];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;
+a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b,
+e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}
+function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?
+e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a,
+1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,
+q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i=
+[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i);
+else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ":
+"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r,
+y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r<y;r++)if((F=arguments[r])!=null)for(I in F){K=i[I];J=F[I];if(i!==J)if(z&&J&&(b.isPlainObject(J)||(fa=b.isArray(J)))){if(fa){fa=false;clone=K&&b.isArray(K)?K:[]}else clone=
+K&&b.isPlainObject(K)?K:{};i[I]=b.extend(z,clone,J)}else if(J!==A)i[I]=J}return i};b.extend({noConflict:function(i){E.$=e;if(i)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(i){i===true&&b.readyWait--;if(!b.readyWait||i!==true&&!b.isReady){if(!u.body)return setTimeout(b.ready,1);b.isReady=true;if(!(i!==true&&--b.readyWait>0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready,
+1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i==
+null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);
+if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
+r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;F<I;){if(r.apply(i[F++],y)===false)break}else if(K)for(z in i){if(r.call(i[z],z,i[z])===false)break}else for(y=i[0];F<I&&r.call(y,F,y)!==false;y=i[++F]);return i},trim:R?function(i){return i==null?"":R.call(i)}:function(i){return i==null?"":i.toString().replace(l,"").replace(n,"")},makeArray:function(i,r){var y=r||[];if(i!=null){var z=b.type(i);i.length==
+null||z==="string"||z==="function"||z==="regexp"||b.isWindow(i)?P.call(y,i):b.merge(y,i)}return y},inArray:function(i,r){if(r.indexOf)return r.indexOf(i);for(var y=0,z=r.length;y<z;y++)if(r[y]===i)return y;return-1},merge:function(i,r){var y=i.length,z=0;if(typeof r.length==="number")for(var F=r.length;z<F;z++)i[y++]=r[z];else for(;r[z]!==A;)i[y++]=r[z++];i.length=y;return i},grep:function(i,r,y){var z=[],F;y=!!y;for(var I=0,K=i.length;I<K;I++){F=!!r(i[I],I);y!==F&&z.push(i[I])}return z},map:function(i,
+r,y){for(var z=[],F,I=0,K=i.length;I<K;I++){F=r(i[I],I,y);if(F!=null)z[z.length]=F}return z.concat.apply([],z)},guid:1,proxy:function(i,r,y){if(arguments.length===2)if(typeof r==="string"){y=i;i=y[r];r=A}else if(r&&!b.isFunction(r)){y=r;r=A}if(!r&&i)r=function(){return i.apply(y||this,arguments)};if(i)r.guid=i.guid=i.guid||r.guid||b.guid++;return r},access:function(i,r,y,z,F,I){var K=i.length;if(typeof r==="object"){for(var J in r)b.access(i,J,r[J],z,F,y);return i}if(y!==A){z=!I&&z&&b.isFunction(y);
+for(J=0;J<K;J++)F(i[J],r,z?y.call(i[J],J,F(i[J],r)):y,I);return i}return K?F(i[0],r):A},now:function(){return(new Date).getTime()},uaMatch:function(i){i=i.toLowerCase();i=M.exec(i)||g.exec(i)||j.exec(i)||i.indexOf("compatible")<0&&o.exec(i)||[];return{browser:i[1]||"",version:i[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,r){L["[object "+r+"]"]=r.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=
+m.version}if(b.browser.webkit)b.browser.safari=true;if(Q)b.inArray=function(i,r){return Q.call(r,i)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;n=/[\s\xA0]+$/}f=b(u);if(u.addEventListener)t=function(){u.removeEventListener("DOMContentLoaded",t,false);b.ready()};else if(u.attachEvent)t=function(){if(u.readyState==="complete"){u.detachEvent("onreadystatechange",t);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=u.documentElement,b=u.createElement("script"),d=u.createElement("div"),
+e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],k=u.createElement("select"),l=k.appendChild(u.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),
+hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};k.disabled=true;c.support.optDisabled=!l.disabled;b.type="text/javascript";try{b.appendChild(u.createTextNode("window."+e+"=1;"))}catch(n){}a.insertBefore(b,
+a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function s(){c.support.noCloneEvent=false;d.detachEvent("onclick",s)});d.cloneNode(true).fireEvent("onclick")}d=u.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div");
+s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight===
+0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",
+cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=
+c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b=
+c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e===
+"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||
+[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
+a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,
+a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1)if(f.className){for(var h=" "+f.className+" ",k=f.className,l=0,n=b.length;l<n;l++)if(h.indexOf(" "+b[l]+" ")<0)k+=" "+b[l];f.className=c.trim(k)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(n){var s=
+c(this);s.removeClass(a.call(this,n,s.attr("class")))});if(a&&typeof a==="string"||a===A)for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(qa," "),k=0,l=b.length;k<l;k++)h=h.replace(" "+b[k]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,
+f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,k=c(this),l=b,n=a.split(ga);f=n[h++];){l=e?l:!k.hasClass(f);k[l?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(qa," ").indexOf(a)>-1)return true;return false},
+val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var k=f[h];if(k.selected&&(c.support.optDisabled?!k.disabled:k.getAttribute("disabled")===null)&&(!k.parentNode.disabled||!c.nodeName(k.parentNode,"optgroup"))){a=c(k).val();if(b)return a;d.push(a)}}return d}if(ra.test(b.type)&&
+!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Pa,"")}return A}var l=c.isFunction(a);return this.each(function(n){var s=c(this),v=a;if(this.nodeType===1){if(l)v=a.call(this,n,s.val());if(v==null)v="";else if(typeof v==="number")v+="";else if(c.isArray(v))v=c.map(v,function(D){return D==null?"":D+""});if(c.isArray(v)&&ra.test(this.type))this.checked=c.inArray(s.val(),v)>=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&&
+h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l===
+"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[];
+if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||
+typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h<B.length;h++){D=B[h];if(d.guid===D.guid){if(l||s.test(D.namespace)){e==null&&B.splice(h--,1);v.remove&&v.remove.call(a,D)}if(e!=null)break}}if(B.length===0||e!=null&&B.length===1){if(!v.teardown||
+v.teardown.call(a,n)===false)c.removeEvent(a,f,w.handle);delete G[f]}}else for(h=0;h<B.length;h++){D=B[h];if(l||s.test(D.namespace)){c.event.remove(a,v,D.handler,h);B.splice(h--,1)}}}if(c.isEmptyObject(G)){if(b=w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,H);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=
+f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===
+false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e;
+d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f<k;f++){var l=d[f];if(b||e.test(l.namespace)){a.handler=l.handler;a.data=
+l.data;a.handleObj=l;l=l.handler.apply(this,h);if(l!==A){a.result=l;if(l===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||u;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=u.documentElement;d=u.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==A)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ga,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
+Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=u.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
+c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ba;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ba;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
+var ta=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},ua=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?ua:ta,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?ua:ta)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
+"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=A;return ja("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=A;return ja("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
+va=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired=
+A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]===
+0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h<l;h++)c.event.add(this[h],d,k,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
+a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
+1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var wa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var k,l=0,n,s,v=h||this.selector;h=h?this:c(this.context);if(typeof d===
+"object"&&!d.preventDefault){for(k in d)h[b](k,e,d[k],v);return this}if(c.isFunction(e)){f=e;e=A}for(d=(d||"").split(" ");(k=d[l++])!=null;){n=X.exec(k);s="";if(n){s=n[0];k=k.replace(X,"")}if(k==="hover")d.push("mouseenter"+s,"mouseleave"+s);else{n=k;if(k==="focus"||k==="blur"){d.push(wa[k]+s);k+=s}else k=(wa[k]||k)+s;if(b==="live"){s=0;for(var B=h.length;s<B;s++)c.event.add(h[s],"live."+Y(k,v),{data:e,selector:v,handler:f,origType:k,origHandler:f,preType:n})}else h.unbind("live."+Y(k,v),f)}}return this}});
+c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1&&!q){x.sizcache=o;x.sizset=p}if(x.nodeName.toLowerCase()===j){C=x;break}x=x[g]}m[p]=C}}}function b(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1){if(!q){x.sizcache=o;x.sizset=p}if(typeof j!=="string"){if(x===j){C=true;break}}else if(l.filter(j,
+[x]).length>0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3];
+break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr,
+t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h=
+k;g.sort(w);if(h)for(var j=1;j<g.length;j++)g[j]===g[j-1]&&g.splice(j--,1)}return g};l.matches=function(g,j){return l(g,null,null,j)};l.matchesSelector=function(g,j){return l(j,null,null,[g]).length>0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p<q;p++){var t=n.order[p],x;if(x=n.leftMatch[t].exec(g)){var C=x[1];x.splice(1,1);if(C.substr(C.length-1)!=="\\"){x[1]=(x[1]||"").replace(/\\/g,"");m=n.find[t](x,j,o);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=j.getElementsByTagName("*"));
+return{set:m,expr:g}};l.filter=function(g,j,o,m){for(var p=g,q=[],t=j,x,C,P=j&&j[0]&&l.isXML(j[0]);g&&j.length;){for(var N in n.filter)if((x=n.leftMatch[N].exec(g))!=null&&x[2]){var R=n.filter[N],Q,L;L=x[1];C=false;x.splice(1,1);if(L.substr(L.length-1)!=="\\"){if(t===q)q=[];if(n.preFilter[N])if(x=n.preFilter[N](x,t,o,q,m,P)){if(x===true)continue}else C=Q=true;if(x)for(var i=0;(L=t[i])!=null;i++)if(L){Q=R(L,x,i,t);var r=m^!!Q;if(o&&Q!=null)if(r)C=true;else t[i]=false;else if(r){q.push(L);C=true}}if(Q!==
+A){o||(t=q);g=g.replace(n.match[N],"");if(!C)return[];break}}}if(g===p)if(C==null)l.error(g);else break;p=g}return t};l.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
+POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,j){var o=typeof j==="string",m=o&&!/\W/.test(j);o=o&&!m;if(m)j=j.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=o||q&&q.nodeName.toLowerCase()===
+j?q||false:q===j}o&&l.filter(j,g,true)},">":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p<q;p++){if(m=g[p]){o=m.parentNode;g[p]=o.nodeName.toLowerCase()===j?o:false}}else{for(;p<q;p++)if(m=g[p])g[p]=o?m.parentNode:m.parentNode===j;o&&l.filter(j,g,true)}},"":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=j=j.toLowerCase();p=a}p("parentNode",j,m,g,q,o)},"~":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=
+j=j.toLowerCase();p=a}p("previousSibling",j,m,g,q,o)}},find:{ID:function(g,j,o){if(typeof j.getElementById!=="undefined"&&!o)return(g=j.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,j){if(typeof j.getElementsByName!=="undefined"){for(var o=[],m=j.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&o.push(m[p]);return o.length===0?null:o}},TAG:function(g,j){return j.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,j,o,m,p,q){g=" "+g[1].replace(/\\/g,
+"")+" ";if(q)return g;q=0;for(var t;(t=j[q])!=null;q++)if(t)if(p^(t.className&&(" "+t.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o,
+m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
+true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
+g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return j<o[3]-0},gt:function(g,j,o){return j>o[3]-0},nth:function(g,j,o){return o[3]-
+0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o<m;o++)if(j[o]===g)return false;return true}else l.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,j){var o=j[1],m=g;switch(o){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(o===
+"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":o=j[2];var p=j[3];if(o===1&&p===0)return true;var q=j[0],t=g.parentNode;if(t&&(t.sizcache!==q||!g.nodeIndex)){var x=0;for(m=t.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++x;t.sizcache=q}m=g.nodeIndex-p;return o===0?m===0:m%o===0&&m/o>=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
+j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]];
+if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o,
+g);else if(typeof g.length==="number")for(var p=g.length;m<p;m++)o.push(g[m]);else for(;g[m];m++)o.push(g[m]);return o}}var w,G;if(u.documentElement.compareDocumentPosition)w=function(g,j){if(g===j){h=true;return 0}if(!g.compareDocumentPosition||!j.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(j)&4?-1:1};else{w=function(g,j){var o=[],m=[],p=g.parentNode,q=j.parentNode,t=p;if(g===j){h=true;return 0}else if(p===q)return G(g,j);else if(p){if(!q)return 1}else return-1;
+for(;t;){o.unshift(t);t=t.parentNode}for(t=q;t;){m.unshift(t);t=t.parentNode}p=o.length;q=m.length;for(t=0;t<p&&t<q;t++)if(o[t]!==m[t])return G(o[t],m[t]);return t===p?G(g,m[t],-1):G(o[t],j,1)};G=function(g,j,o){if(g===j)return o;for(g=g.nextSibling;g;){if(g===j)return-1;g=g.nextSibling}return 1}}l.getText=function(g){for(var j="",o,m=0;g[m];m++){o=g[m];if(o.nodeType===3||o.nodeType===4)j+=o.nodeValue;else if(o.nodeType!==8)j+=l.getText(o.childNodes)}return j};(function(){var g=u.createElement("div"),
+j="script"+(new Date).getTime();g.innerHTML="<a name='"+j+"'/>";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g);
+o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&&
+function(){var g=l,j=u.createElement("div");j.innerHTML="<p class='TEST'></p>";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o];
+j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
+0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g,
+j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p<t;p++)l(g,q[p],o);return l.filter(m,o)};c.find=l;c.expr=l.selectors;c.expr[":"]=c.expr.filters;c.unique=l.uniqueSort;c.text=l.getText;c.isXMLDoc=l.isXML;c.contains=l.contains})();var Wa=/Until$/,Xa=/^(?:parents|prevUntil|prevAll)/,Ya=/,/,Ja=/^.[^:#\[\.,]*$/,Za=Array.prototype.slice,$a=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("",
+"find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var k=0;k<d;k++)if(b[k]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(ka(this,a,false),"not",a)},filter:function(a){return this.pushStack(ka(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,
+b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(k?k.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||
+!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});
+c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",
+d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}});
+c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g,
+$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/<tbody/i,bb=/<|&#?\w+;/,Aa=/<(?:script|object|embed|option|style)/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,cb=/\=([^="'>\s]+\/)>/g,O={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],
+area:[1,"<map>","</map>"],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,
+d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},
+unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=
+c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));
+c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($,
+"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?
+this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,
+true)},domManip:function(a,b,d){var e,f,h=a[0],k=[],l;if(!c.support.checkClone&&arguments.length===3&&typeof h==="string"&&Ba.test(h))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(h))return this.each(function(s){var v=c(this);a[0]=h.call(this,s,b?v.html():A);v.domManip(a,b,d)});if(this[0]){e=h&&h.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);l=e.fragment;if(f=l.childNodes.length===1?l=l.firstChild:
+l.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var n=this.length;f<n;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],f>0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone||
+!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=
+d.length;f<h;f++){var k=(f>0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1></$2>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default,
+s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]==="<table>"&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&&
+c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]?
+c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this;
+return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]||
+h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=
+e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":
+b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],
+h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+mb=/^(?:select|textarea)/i,nb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ob=/^(?:GET|HEAD|DELETE)$/,Na=/\[\]$/,T=/\=\?(&|$)/,ia=/\?/,pb=/([?&])_=[^&]*/,qb=/^(\w+:)?\/\/([^\/?#]+)/,rb=/%20/g,sb=/#.*$/,Ea=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ea)return Ea.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=
+b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l==="success"||l==="notmodified")h.html(f?c("<div>").append(k.responseText.replace(lb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
+!this.disabled&&(this.checked||mb.test(this.nodeName)||nb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
+getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
+script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=ob.test(h);b.url=b.url.replace(sb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ia.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
+!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+kb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(m){f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);if(c.isFunction(l))l(m);else{E[d]=A;try{delete E[d]}catch(p){}}v&&v.removeChild(B)}}if(b.dataType==="script"&&b.cache===null)b.cache=
+false;if(b.cache===false&&h==="GET"){var n=c.now(),s=b.url.replace(pb,"$1_="+n);b.url=s+(s===b.url?(ia.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&&h==="GET")b.url+=(ia.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=qb.exec(b.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var v=u.getElementsByTagName("head")[0]||u.documentElement,B=u.createElement("script");if(b.scriptCharset)B.charset=b.scriptCharset;B.src=
+b.url;if(!d){var D=false;B.onload=B.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);B.onload=B.onreadystatechange=null;v&&B.parentNode&&v.removeChild(B)}}}v.insertBefore(B,v.firstChild);return A}var H=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type",
+b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(G){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
+c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){H||c.handleComplete(b,w,e,f);H=true;if(w)w.onreadystatechange=c.noop}else if(!H&&w&&(w.readyState===4||m==="timeout")){H=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
+c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&g.call&&g.call(w);M("abort")}}catch(j){}b.async&&b.timeout>0&&setTimeout(function(){w&&!H&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(o){c.handleError(b,w,null,o);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+
+"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ca(f,a[f],b,e);return d.join("&").replace(rb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,
+b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");
+if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr=
+function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var da={},tb=/^(?:toggle|show|hide)$/,ub=/^([+\-]=)?([\d+.\-]+)(.*)$/,aa,na=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{a=
+0;for(b=this.length;a<b;a++){if(!c.data(this[a],"olddisplay")&&this[a].style.display==="none")this[a].style.display="";this[a].style.display===""&&c.css(this[a],"display")==="none"&&c.data(this[a],"olddisplay",oa(this[a].nodeName))}for(a=0;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",d)}for(a=
+0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,d,e);if(c.isEmptyObject(a))return this.each(f.complete);
+return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),k,l=this.nodeType===1,n=l&&c(this).is(":hidden"),s=this;for(k in a){var v=c.camelCase(k);if(k!==v){a[v]=a[k];delete a[k];k=v}if(a[k]==="hide"&&n||a[k]==="show"&&!n)return h.complete.call(this);if(l&&(k==="height"||k==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(oa(this.nodeName)===
+"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[k])){(h.specialEasing=h.specialEasing||{})[k]=a[k][1];a[k]=a[k][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(B,D){var H=new c.fx(s,h,B);if(tb.test(D))H[D==="toggle"?n?"show":"hide":D](a);else{var w=ub.exec(D),G=H.cur(true)||0;if(w){var M=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(s,B,(M||1)+g);
+G=(M||1)/H.cur(true)*G;c.style(s,B,G+g)}if(w[1])M=(w[1]==="-="?-1:1)*M+G;H.custom(G,M,g)}else H.custom(G,D,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
+d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
+Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(h){return f.step(h)}
+this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var f=this;a=c.fx;e.elem=this.elem;if(e()&&c.timers.push(e)&&!aa)aa=setInterval(a.tick,a.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
+this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
+this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
+c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(aa);aa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
+b.elem}).length};var vb=/^t(?:able|d|h)$/i,Fa=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in u.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(k){c.offset.setOffset(this,a,k)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=ea(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
+h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,e=b.ownerDocument,f,h=e.documentElement,k=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;
+for(var l=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==k&&b!==h;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;f=e?e.getComputedStyle(b,null):b.currentStyle;l-=b.scrollTop;n-=b.scrollLeft;if(b===d){l+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&vb.test(b.nodeName))){l+=parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&f.overflow!=="visible"){l+=
+parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}f=f}if(f.position==="relative"||f.position==="static"){l+=k.offsetTop;n+=k.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){l+=Math.max(h.scrollTop,k.scrollTop);n+=Math.max(h.scrollLeft,k.scrollLeft)}return{top:l,left:n}};c.offset={initialize:function(){var a=u.body,b=u.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
+height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
+f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
+"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),k=c.css(a,"top"),l=c.css(a,"left"),n=e==="absolute"&&c.inArray("auto",[k,l])>-1;e={};var s={};if(n)s=f.position();k=n?s.top:parseInt(k,10)||0;l=n?s.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a,
+e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Fa.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.body;a&&!Fa.test(a.nodeName)&&
+c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=ea(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=ea(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
+c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var k=c(this);k[d](e.call(this,h,k[d]()))});return c.isWindow(f)?f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b]:f.nodeType===9?Math.max(f.documentElement["client"+
+b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):e===A?parseFloat(c.css(f,d)):this.css(d,typeof e==="string"?e:e+"px")}})})(window);
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..0d53fba
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,20 @@
+{
+ "name": "Simple WebSocket Client",
+ "version": "0.1.1",
+ "description": "Construct custom Web Socket requests and handle responses to directly test your Web Socket services.",
+ "icons": {
+ "16": "resources/icon_032.png",
+ "32": "resources/icon_032.png",
+ "48": "resources/icon_048.png",
+ "128": "resources/icon_128.png"
+ },
+
+ "browser_action": {
+ "default_icon": "resources/icon_032.png"
+ },
+
+ "options_page": "index.html",
+ "background_page": "background.html",
+
+ "permissions": [ "tabs" ]
+}
diff --git a/resources/icon_016.png b/resources/icon_016.png
new file mode 100644
index 0000000..7085b1b
Binary files /dev/null and b/resources/icon_016.png differ
diff --git a/resources/icon_032.png b/resources/icon_032.png
new file mode 100644
index 0000000..ad3e0da
Binary files /dev/null and b/resources/icon_032.png differ
diff --git a/resources/icon_048.png b/resources/icon_048.png
new file mode 100644
index 0000000..1eb4117
Binary files /dev/null and b/resources/icon_048.png differ
diff --git a/resources/icon_128.png b/resources/icon_128.png
new file mode 100644
index 0000000..e40a5df
Binary files /dev/null and b/resources/icon_128.png differ
|
Gordin/devkitPro-Templates | 5754666c0026306c05f6518367445d90cf84763e | Addod note for README files... | diff --git a/README b/README
index e69de29..a5b2fef 100644
--- a/README
+++ b/README
@@ -0,0 +1 @@
+There is a README for each IDE for the parts of devkitPro in their respective folders.
|
Gordin/devkitPro-Templates | 0b695b6fd6c3a9a2d91066aae74420c6c848e07d | moved devkitARM README | diff --git a/codelite/README b/codelite/README
deleted file mode 100644
index 5051aa6..0000000
--- a/codelite/README
+++ /dev/null
@@ -1,91 +0,0 @@
-Make sure DEVKITPRO and DEVKITARM are set in your environment
-Know where your codelite-home folder is. In linux it's usually ~/.codelite
-
-++++++++++++++++ Setup Part (You'll do this only once) ++++++++++++++++++++++
-
----------------------------- WORKSPACE: -------------------------------------
-Using the workspace will make code-completion available for all devkitARM
-projects in it.
-
-1. Copy the workspace folder and name it devkitARM
-
-2. Rename devkitARM.workspace.USER to devkitARM.workspace.YOUR_USERNAME
-
-
-
--------------------- EXTERNAL TOOLS: (project independent) -------------------
-The tools start your project in desmume in normal or debug mode with one click
-and can fix the directory structure of your project if you use the Codelite
-method to create a devkitARM project
-
-1. Find your codelite.xml (it's in CODELITE-HOME/config/codelite.xml)
-
-2. Make sure Codelite is closed!
-
-3. In codelite.xml search delete the block
- <ArchiveObject Name="ExternalTools">
- ...
- </ArchiveObject>
-This will delete all your settings for external tools. If you have defined
-your own tools and want to keep them you will have to merge the next part with
-your tools manually.
-
-The external-tools folder has a folder callod tools.xml and a codelite-home
-folder.
-
-4. Replace the block you deleted in codelite.xml with the content of tools.xml
-
-5. Copy the contents of codelite-home into YOUR CODELITE-HOME
-
-
-
-+++++++++++++++++++ Project creation (choose one method) ++++++++++++++++++++++
-
-
------------------------- PROJECT: (In Codelite) --------------------------------
-
-THIS DOES NOT WORK IN WINDOWS (YET) BECAUSE A SCRIPT THAT IS NEEDED FOR THIS
-DOES NOT RUN UNDER WINDOWS
-
-1. Make sure you did at least the External Tools step
-
-2. Copy the project-template-codelite folder to CODELITE-HOME/templates/projects
-
-3. Go into Codelite, switch to the devkit workspace and Create a new project.
-There should be a new Category 'devkitPro'. Select this and then the devkitARM
-template. Also make sure 'Create the project under a seperate directory' is
-checked.
-
-4. Before you can use the project you have to click once on the 'Fix Project'
-external tool. This will setup the directory structure so that it works with
-the Makefile (Codelite uses only virtual folders and throws the real folders
-away...)
-
-5. Now alt+tab around until codelite notices that the project has been changed
-by the Fix Project script and allow it to reload.
-
-6. DONE
-
-
------------------- PROJECT: (Manual way and Windows for now) -------------------
-
-1. Copy the project-template folder and rename it to YOUR_PROJECTNAME
-YOUR_PROJECTNAME has to be the same in all steps
-
-2. Rename template.project to YOUR_PROJECTNAME.project
-
-3. Edit YOUR_PROJECTNAME.project and change
- 1. <CodeLite_Project Name="template" InternalType="devkitARM">
- to
- <CodeLite_Project Name="YOUR_PROJECTNAME" InternalType="devkitARM">
-
- 2. DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb"
- to
- DebuggerPath="YOUR_ACTUAL_DEVKITARM_PATH/bin/arm-eabi-gdb"
-
- --- You have to replace this TWICE! ---
-
- (the variable should work but codelite has a bug that does not start
- the debugger when you use the variable in the path)
-
-Now you can open the workspace in codelite and add the project to it.
diff --git a/codelite/devkitARM/README b/codelite/devkitARM/README
index 9f4582e..5051aa6 100644
--- a/codelite/devkitARM/README
+++ b/codelite/devkitARM/README
@@ -1,46 +1,91 @@
Make sure DEVKITPRO and DEVKITARM are set in your environment
+Know where your codelite-home folder is. In linux it's usually ~/.codelite
-WORKSPACE:
-Using the workspace will make code-completion available
+++++++++++++++++ Setup Part (You'll do this only once) ++++++++++++++++++++++
+
+---------------------------- WORKSPACE: -------------------------------------
+Using the workspace will make code-completion available for all devkitARM
+projects in it.
1. Copy the workspace folder and name it devkitARM
2. Rename devkitARM.workspace.USER to devkitARM.workspace.YOUR_USERNAME
-EXTERNAL TOOLS: (project independent)
+
+
+-------------------- EXTERNAL TOOLS: (project independent) -------------------
The tools start your project in desmume in normal or debug mode with one click
+and can fix the directory structure of your project if you use the Codelite
+method to create a devkitARM project
-1. Find your codelite.xml (under linux it's ~/.codelite/config/codelite.xml)
+1. Find your codelite.xml (it's in CODELITE-HOME/config/codelite.xml)
-2. In codelite.xml search delete the block
+2. Make sure Codelite is closed!
+
+3. In codelite.xml search delete the block
<ArchiveObject Name="ExternalTools">
...
</ArchiveObject>
This will delete all your settings for external tools. If you have defined
-own tools and want to keep them you will have to merge the next part with
-your Tools manually.
+your own tools and want to keep them you will have to merge the next part with
+your tools manually.
+
+The external-tools folder has a folder callod tools.xml and a codelite-home
+folder.
+
+4. Replace the block you deleted in codelite.xml with the content of tools.xml
+
+5. Copy the contents of codelite-home into YOUR CODELITE-HOME
+
+
+
++++++++++++++++++++ Project creation (choose one method) ++++++++++++++++++++++
+
+
+------------------------ PROJECT: (In Codelite) --------------------------------
+
+THIS DOES NOT WORK IN WINDOWS (YET) BECAUSE A SCRIPT THAT IS NEEDED FOR THIS
+DOES NOT RUN UNDER WINDOWS
+
+1. Make sure you did at least the External Tools step
+
+2. Copy the project-template-codelite folder to CODELITE-HOME/templates/projects
+
+3. Go into Codelite, switch to the devkit workspace and Create a new project.
+There should be a new Category 'devkitPro'. Select this and then the devkitARM
+template. Also make sure 'Create the project under a seperate directory' is
+checked.
+
+4. Before you can use the project you have to click once on the 'Fix Project'
+external tool. This will setup the directory structure so that it works with
+the Makefile (Codelite uses only virtual folders and throws the real folders
+away...)
+
+5. Now alt+tab around until codelite notices that the project has been changed
+by the Fix Project script and allow it to reload.
+
+6. DONE
-3. Replace the block you deleted with the content of tools.xml
-PROJECT:
+------------------ PROJECT: (Manual way and Windows for now) -------------------
1. Copy the project-template folder and rename it to YOUR_PROJECTNAME
YOUR_PROJECTNAME has to be the same in all steps
2. Rename template.project to YOUR_PROJECTNAME.project
3. Edit YOUR_PROJECTNAME.project and change
1. <CodeLite_Project Name="template" InternalType="devkitARM">
to
<CodeLite_Project Name="YOUR_PROJECTNAME" InternalType="devkitARM">
2. DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb"
to
DebuggerPath="YOUR_ACTUAL_DEVKITARM_PATH/bin/arm-eabi-gdb"
--- You have to replace this TWICE! ---
(the variable should work but codelite has a bug that does not start
the debugger when you use the variable in the path)
Now you can open the workspace in codelite and add the project to it.
|
Gordin/devkitPro-Templates | 0b3b34db9fd8b3a9a719dbe65f502a1e2da879f0 | rearranged directories | diff --git a/codelite/README b/codelite/README
new file mode 100644
index 0000000..5051aa6
--- /dev/null
+++ b/codelite/README
@@ -0,0 +1,91 @@
+Make sure DEVKITPRO and DEVKITARM are set in your environment
+Know where your codelite-home folder is. In linux it's usually ~/.codelite
+
+++++++++++++++++ Setup Part (You'll do this only once) ++++++++++++++++++++++
+
+---------------------------- WORKSPACE: -------------------------------------
+Using the workspace will make code-completion available for all devkitARM
+projects in it.
+
+1. Copy the workspace folder and name it devkitARM
+
+2. Rename devkitARM.workspace.USER to devkitARM.workspace.YOUR_USERNAME
+
+
+
+-------------------- EXTERNAL TOOLS: (project independent) -------------------
+The tools start your project in desmume in normal or debug mode with one click
+and can fix the directory structure of your project if you use the Codelite
+method to create a devkitARM project
+
+1. Find your codelite.xml (it's in CODELITE-HOME/config/codelite.xml)
+
+2. Make sure Codelite is closed!
+
+3. In codelite.xml search delete the block
+ <ArchiveObject Name="ExternalTools">
+ ...
+ </ArchiveObject>
+This will delete all your settings for external tools. If you have defined
+your own tools and want to keep them you will have to merge the next part with
+your tools manually.
+
+The external-tools folder has a folder callod tools.xml and a codelite-home
+folder.
+
+4. Replace the block you deleted in codelite.xml with the content of tools.xml
+
+5. Copy the contents of codelite-home into YOUR CODELITE-HOME
+
+
+
++++++++++++++++++++ Project creation (choose one method) ++++++++++++++++++++++
+
+
+------------------------ PROJECT: (In Codelite) --------------------------------
+
+THIS DOES NOT WORK IN WINDOWS (YET) BECAUSE A SCRIPT THAT IS NEEDED FOR THIS
+DOES NOT RUN UNDER WINDOWS
+
+1. Make sure you did at least the External Tools step
+
+2. Copy the project-template-codelite folder to CODELITE-HOME/templates/projects
+
+3. Go into Codelite, switch to the devkit workspace and Create a new project.
+There should be a new Category 'devkitPro'. Select this and then the devkitARM
+template. Also make sure 'Create the project under a seperate directory' is
+checked.
+
+4. Before you can use the project you have to click once on the 'Fix Project'
+external tool. This will setup the directory structure so that it works with
+the Makefile (Codelite uses only virtual folders and throws the real folders
+away...)
+
+5. Now alt+tab around until codelite notices that the project has been changed
+by the Fix Project script and allow it to reload.
+
+6. DONE
+
+
+------------------ PROJECT: (Manual way and Windows for now) -------------------
+
+1. Copy the project-template folder and rename it to YOUR_PROJECTNAME
+YOUR_PROJECTNAME has to be the same in all steps
+
+2. Rename template.project to YOUR_PROJECTNAME.project
+
+3. Edit YOUR_PROJECTNAME.project and change
+ 1. <CodeLite_Project Name="template" InternalType="devkitARM">
+ to
+ <CodeLite_Project Name="YOUR_PROJECTNAME" InternalType="devkitARM">
+
+ 2. DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb"
+ to
+ DebuggerPath="YOUR_ACTUAL_DEVKITARM_PATH/bin/arm-eabi-gdb"
+
+ --- You have to replace this TWICE! ---
+
+ (the variable should work but codelite has a bug that does not start
+ the debugger when you use the variable in the path)
+
+Now you can open the workspace in codelite and add the project to it.
diff --git a/devkitARM/codelite/README b/codelite/devkitARM/README
similarity index 100%
rename from devkitARM/codelite/README
rename to codelite/devkitARM/README
diff --git a/codelite/devkitARM/external-tools/codelite-home/images/desmume16.png b/codelite/devkitARM/external-tools/codelite-home/images/desmume16.png
new file mode 100644
index 0000000..0524cb1
Binary files /dev/null and b/codelite/devkitARM/external-tools/codelite-home/images/desmume16.png differ
diff --git a/codelite/devkitARM/external-tools/codelite-home/images/desmume_debug16.png b/codelite/devkitARM/external-tools/codelite-home/images/desmume_debug16.png
new file mode 100644
index 0000000..1a4cea6
Binary files /dev/null and b/codelite/devkitARM/external-tools/codelite-home/images/desmume_debug16.png differ
diff --git a/codelite/devkitARM/external-tools/codelite-home/projectfix b/codelite/devkitARM/external-tools/codelite-home/projectfix
new file mode 100755
index 0000000..d9bd84b
--- /dev/null
+++ b/codelite/devkitARM/external-tools/codelite-home/projectfix
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Tests if first argument is a folder and exists
+[ -d "$1" ] || exit 1
+# Tests if second argument is a writable file
+[ -w "$2.project" ] || exit 1
+
+cd $1
+
+#Creates source directory and puts source files in it
+mkdir -p source
+for i in `ls | grep '\.\(c\|cpp\|asm\)\b'`
+do
+ mv $i source
+done
+
+#Creates include directory and puts header files in it
+mkdir -p include
+for i in `ls | grep '\.\(h\)\b'`
+do
+ mv $i include
+done
+
+#Creates gfx directory and puts grafic files in it
+mkdir -p gfx
+for i in `ls | grep '\.\(gif\|png\|jpg\|jpeg\)\b'`
+do
+ mv $i gfx
+done
+
+#replaces the debugger with the full path because codelite doesn't starts debugging if there's a variable in it
+sed -i "s|\(DebuggerPath=\"\)\([A-Za-z$\{\}\/-]\+\)\(\">\)|\1${DEVKITARM}/bin/arm-eabi-gdb\3|" $2.project
+
+#Updates the filenames in the codelite project
+sed -i 's/\(File Name="\)\(\w\+\)\.\(h\)/\1include\/\2.\3/' $2.project
+sed -i 's/\(File Name="\)\(\w\+\)\.\(c\|cpp\|asm\)/\1source\/\2.\3/' $2.project
+sed -i 's/\(File Name="\)\(\w\+\)\.\(gif\|png\|jpg\|jpeg\)/\1gfx\/\2.\3/' $2.project
diff --git a/devkitARM/codelite/external-tools/tools.xml b/codelite/devkitARM/external-tools/tools.xml
similarity index 100%
rename from devkitARM/codelite/external-tools/tools.xml
rename to codelite/devkitARM/external-tools/tools.xml
diff --git a/devkitARM/codelite/project-create-template/Makefile b/codelite/devkitARM/project-template-codelite/Makefile
similarity index 100%
rename from devkitARM/codelite/project-create-template/Makefile
rename to codelite/devkitARM/project-template-codelite/Makefile
diff --git a/devkitARM/codelite/project-create-template/main.cpp b/codelite/devkitARM/project-template-codelite/main.cpp
similarity index 100%
rename from devkitARM/codelite/project-create-template/main.cpp
rename to codelite/devkitARM/project-template-codelite/main.cpp
diff --git a/devkitARM/codelite/project-template/template.project b/codelite/devkitARM/project-template-codelite/template.project
similarity index 98%
rename from devkitARM/codelite/project-template/template.project
rename to codelite/devkitARM/project-template-codelite/template.project
index 8894ff0..d0332e2 100644
--- a/devkitARM/codelite/project-template/template.project
+++ b/codelite/devkitARM/project-template-codelite/template.project
@@ -1,82 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
-<CodeLite_Project Name="template" InternalType="devkitARM">
+<CodeLite_Project Name="devkitARM" InternalType="devkitPro">
<Description/>
<Dependencies/>
<VirtualDirectory Name="resources">
<File Name="Makefile"/>
</VirtualDirectory>
<VirtualDirectory Name="src">
<File Name="main.cpp"/>
</VirtualDirectory>
<Dependencies Name="Debug"/>
<Dependencies Name="Release"/>
<Settings Type="Dynamic Library">
<GlobalSettings>
<Compiler Options="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options="">
<IncludePath Value="${DEVKITARM}/arm-eabi/include"/>
</ResourceCompiler>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="" Required="yes" PreCompiledHeader="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
<Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand/>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(ProjectPath)</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
</Configuration>
<Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="" Required="yes" PreCompiledHeader="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="-O2" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
<Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand/>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(ProjectPath)</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
</Configuration>
</Settings>
</CodeLite_Project>
diff --git a/devkitARM/codelite/project-template/Makefile b/codelite/devkitARM/project-template-manual/Makefile
similarity index 100%
rename from devkitARM/codelite/project-template/Makefile
rename to codelite/devkitARM/project-template-manual/Makefile
diff --git a/devkitARM/codelite/project-template/source/main.cpp b/codelite/devkitARM/project-template-manual/source/main.cpp
similarity index 100%
rename from devkitARM/codelite/project-template/source/main.cpp
rename to codelite/devkitARM/project-template-manual/source/main.cpp
diff --git a/devkitARM/codelite/project-create-template/template.project b/codelite/devkitARM/project-template-manual/template.project
similarity index 100%
rename from devkitARM/codelite/project-create-template/template.project
rename to codelite/devkitARM/project-template-manual/template.project
diff --git a/devkitARM/codelite/workspace-template/devkitARM.workspace b/codelite/devkitARM/workspace-template/devkitARM.workspace
similarity index 100%
rename from devkitARM/codelite/workspace-template/devkitARM.workspace
rename to codelite/devkitARM/workspace-template/devkitARM.workspace
diff --git a/devkitARM/codelite/workspace-template/devkitARM.workspace.USER b/codelite/devkitARM/workspace-template/devkitARM.workspace.USER
similarity index 100%
rename from devkitARM/codelite/workspace-template/devkitARM.workspace.USER
rename to codelite/devkitARM/workspace-template/devkitARM.workspace.USER
|
Gordin/devkitPro-Templates | 2b02a36f9dbeaba6e16c73f1387db4e9b5d3bdd5 | Canged stuff... | diff --git a/devkitARM/codelite/README b/devkitARM/codelite/README
new file mode 100644
index 0000000..9f4582e
--- /dev/null
+++ b/devkitARM/codelite/README
@@ -0,0 +1,46 @@
+Make sure DEVKITPRO and DEVKITARM are set in your environment
+
+WORKSPACE:
+Using the workspace will make code-completion available
+
+1. Copy the workspace folder and name it devkitARM
+
+2. Rename devkitARM.workspace.USER to devkitARM.workspace.YOUR_USERNAME
+
+EXTERNAL TOOLS: (project independent)
+The tools start your project in desmume in normal or debug mode with one click
+
+1. Find your codelite.xml (under linux it's ~/.codelite/config/codelite.xml)
+
+2. In codelite.xml search delete the block
+ <ArchiveObject Name="ExternalTools">
+ ...
+ </ArchiveObject>
+This will delete all your settings for external tools. If you have defined
+own tools and want to keep them you will have to merge the next part with
+your Tools manually.
+
+3. Replace the block you deleted with the content of tools.xml
+
+PROJECT:
+
+1. Copy the project-template folder and rename it to YOUR_PROJECTNAME
+YOUR_PROJECTNAME has to be the same in all steps
+
+2. Rename template.project to YOUR_PROJECTNAME.project
+
+3. Edit YOUR_PROJECTNAME.project and change
+ 1. <CodeLite_Project Name="template" InternalType="devkitARM">
+ to
+ <CodeLite_Project Name="YOUR_PROJECTNAME" InternalType="devkitARM">
+
+ 2. DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb"
+ to
+ DebuggerPath="YOUR_ACTUAL_DEVKITARM_PATH/bin/arm-eabi-gdb"
+
+ --- You have to replace this TWICE! ---
+
+ (the variable should work but codelite has a bug that does not start
+ the debugger when you use the variable in the path)
+
+Now you can open the workspace in codelite and add the project to it.
diff --git a/devkitARM/codelite/external-tools/tools.xml b/devkitARM/codelite/external-tools/tools.xml
new file mode 100644
index 0000000..ce5cffe
--- /dev/null
+++ b/devkitARM/codelite/external-tools/tools.xml
@@ -0,0 +1,36 @@
+ <ArchiveObject Name="ExternalTools">
+ <long Value="3" Name="toolsCount"/>
+ <SerializedObject Name="Tool_0">
+ <wxString Value="external_tool_0" Name="m_id"/>
+ <wxString Value="desmume-glade" Name="m_path"/>
+ <wxString Value="$(ProjectName).nds" Name="m_arguments"/>
+ <wxString Value="$(ProjectPath)" Name="m_wd"/>
+ <wxString Value="Desmume Run" Name="m_name"/>
+ <wxString Value="${HOME}/.codelite/images/desmume16.png" Name="m_icon16"/>
+ <wxString Value="${HOME}/.codelite/images/desmume16.png" Name="m_icon24"/>
+ <bool Value="0" Name="m_captureOutput"/>
+ <bool Value="0" Name="m_saveAllFiles"/>
+ </SerializedObject>
+ <SerializedObject Name="Tool_1">
+ <wxString Value="external_tool_1" Name="m_id"/>
+ <wxString Value="desmume-glade" Name="m_path"/>
+ <wxString Value="--arm9gdb=2159 $(ProjectName).nds" Name="m_arguments"/>
+ <wxString Value="$(ProjectPath)" Name="m_wd"/>
+ <wxString Value="Desmume Debug" Name="m_name"/>
+ <wxString Value="${HOME}/.codelite/images/desmume_debug16.png" Name="m_icon16"/>
+ <wxString Value="${HOME}/.codelite/images/desmume_debug16.png" Name="m_icon24"/>
+ <bool Value="0" Name="m_captureOutput"/>
+ <bool Value="0" Name="m_saveAllFiles"/>
+ </SerializedObject>
+ <SerializedObject Name="Tool_2">
+ <wxString Value="external_tool_2" Name="m_id"/>
+ <wxString Value="$(CodeLitePath)/projectfix" Name="m_path"/>
+ <wxString Value="$(ProjectPath) $(ProjectName)" Name="m_arguments"/>
+ <wxString Value="$(ProjectPath)" Name="m_wd"/>
+ <wxString Value="Fix Project" Name="m_name"/>
+ <wxString Value="" Name="m_icon16"/>
+ <wxString Value="" Name="m_icon24"/>
+ <bool Value="0" Name="m_captureOutput"/>
+ <bool Value="1" Name="m_saveAllFiles"/>
+ </SerializedObject>
+ </ArchiveObject>
diff --git a/devkitARM/codelite/project-create-template/Makefile b/devkitARM/codelite/project-create-template/Makefile
new file mode 100644
index 0000000..77e23f4
--- /dev/null
+++ b/devkitARM/codelite/project-create-template/Makefile
@@ -0,0 +1,173 @@
+#---------------------------------------------------------------------------------
+.SUFFIXES:
+#---------------------------------------------------------------------------------
+
+ifeq ($(strip $(DEVKITARM)),)
+$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
+endif
+
+include $(DEVKITARM)/ds_rules
+
+#---------------------------------------------------------------------------------
+# TARGET is the name of the output
+# BUILD is the directory where object files & intermediate files will be placed
+# SOURCES is a list of directories containing source code
+# INCLUDES is a list of directories containing extra header files
+# DATA is a list of directories containing binary data
+# GRAPHICS is a list of directories containing files to be processed by grit
+#
+# All directories are specified relative to the project directory where
+# the makefile is found
+#
+#---------------------------------------------------------------------------------
+TARGET := $(notdir $(CURDIR))
+BUILD := build
+SOURCES := source
+DATA := data
+INCLUDES := include
+GRAPHICS := gfx
+
+#---------------------------------------------------------------------------------
+# options for code generation
+#---------------------------------------------------------------------------------
+ARCH := -mthumb -mthumb-interwork
+
+CFLAGS := -g -Wall -O2\
+ -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
+ -ffast-math \
+ $(ARCH)
+
+CFLAGS += $(INCLUDE) -DARM9
+CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
+
+ASFLAGS := -g $(ARCH)
+LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
+
+#---------------------------------------------------------------------------------
+# any extra libraries we wish to link with the project
+#---------------------------------------------------------------------------------
+LIBS := -lnds9
+
+
+#---------------------------------------------------------------------------------
+# list of directories containing libraries, this must be the top level containing
+# include and lib
+#---------------------------------------------------------------------------------
+LIBDIRS := $(LIBNDS)
+
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
+
+
+ifneq ($(BUILDDIR), $(CURDIR))
+#---------------------------------------------------------------------------------
+
+export OUTPUT := $(CURDIR)/$(TARGET)
+
+export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
+
+export DEPSDIR := $(CURDIR)/$(BUILD)
+
+CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
+CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
+BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
+BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
+PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
+
+#---------------------------------------------------------------------------------
+# use CXX for linking C++ projects, CC for standard C
+#---------------------------------------------------------------------------------
+ifeq ($(strip $(CPPFILES)),)
+#---------------------------------------------------------------------------------
+ export LD := $(CC)
+#---------------------------------------------------------------------------------
+else
+#---------------------------------------------------------------------------------
+ export LD := $(CXX)
+#---------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------
+
+export OFILES := $(addsuffix .o,$(BINFILES)) \
+ $(BMPFILES:.bmp=.o) \
+ $(PNGFILES:.png=.o) \
+ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+
+export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
+ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+ -I$(CURDIR)/$(BUILD)
+
+export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
+
+.PHONY: $(BUILD) clean
+
+#---------------------------------------------------------------------------------
+$(BUILD):
+ @[ -d $@ ] || mkdir -p $@
+ @make BUILDDIR=`cd $(BUILD) && pwd` --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+#---------------------------------------------------------------------------------
+clean:
+ @echo clean ...
+ @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba
+
+
+#---------------------------------------------------------------------------------
+else
+
+DEPENDS := $(OFILES:.o=.d)
+
+#---------------------------------------------------------------------------------
+# main targets
+#---------------------------------------------------------------------------------
+$(OUTPUT).nds : $(OUTPUT).arm9
+$(OUTPUT).arm9 : $(OUTPUT).elf
+$(OUTPUT).elf : $(OFILES)
+
+
+#---------------------------------------------------------------------------------
+# The bin2o rule should be copied and modified
+# for each extension used in the data directories
+#---------------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------------
+# This rule links in binary data with the .bin extension
+#---------------------------------------------------------------------------------
+%.bin.o : %.bin
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+# This rule links in binary data with the .raw extension
+#---------------------------------------------------------------------------------
+%.raw.o : %.raw
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+# This rule creates assembly source files using grit
+# grit takes an image file and a .grit describing how the file is to be processed
+# add additional rules like this for each image extension
+# you use in the graphics folders
+#---------------------------------------------------------------------------------
+%.s %.h : %.bmp %.grit
+#---------------------------------------------------------------------------------
+ grit $< -fts -o$*
+
+#---------------------------------------------------------------------------------
+%.s %.h : %.png %.grit
+#---------------------------------------------------------------------------------
+ grit $< -fts -o$*
+
+-include $(DEPENDS)
+
+#---------------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------------
\ No newline at end of file
diff --git a/devkitARM/codelite/project-create-template/main.cpp b/devkitARM/codelite/project-create-template/main.cpp
new file mode 100644
index 0000000..fb66ec7
--- /dev/null
+++ b/devkitARM/codelite/project-create-template/main.cpp
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------------
+
+ $Id: main.cpp,v 1.13 2008-12-02 20:21:20 dovoto Exp $
+
+ Simple console print demo
+ -- dovoto
+
+
+---------------------------------------------------------------------------------*/
+#include <nds.h>
+
+#include <stdio.h>
+
+volatile int frame = 0;
+
+//---------------------------------------------------------------------------------
+void Vblank() {
+//---------------------------------------------------------------------------------
+ frame++;
+}
+
+//---------------------------------------------------------------------------------
+int main(void) {
+//---------------------------------------------------------------------------------
+ touchPosition touchXY;
+
+ irqSet(IRQ_VBLANK, Vblank);
+
+ consoleDemoInit();
+
+ iprintf(" Hello DS dev'rs\n");
+ iprintf(" \x1b[32mwww.devkitpro.org\n");
+ iprintf(" \x1b[32;1mwww.drunkencoders.com\x1b[39m");
+
+ while(1) {
+
+ swiWaitForVBlank();
+ touchRead(&touchXY);
+
+ // print at using ansi escape sequence \x1b[line;columnH
+ iprintf("\x1b[10;0HFrame = %d",frame);
+ iprintf("\x1b[16;0HTouch x = %04X, %04X\n", touchXY.rawx, touchXY.px);
+ iprintf("Touch y = %04X, %04X\n", touchXY.rawy, touchXY.py);
+
+ }
+
+ return 0;
+}
diff --git a/devkitARM/codelite/project-create-template/template.project b/devkitARM/codelite/project-create-template/template.project
new file mode 100644
index 0000000..8894ff0
--- /dev/null
+++ b/devkitARM/codelite/project-create-template/template.project
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<CodeLite_Project Name="template" InternalType="devkitARM">
+ <Description/>
+ <Dependencies/>
+ <VirtualDirectory Name="resources">
+ <File Name="Makefile"/>
+ </VirtualDirectory>
+ <VirtualDirectory Name="src">
+ <File Name="main.cpp"/>
+ </VirtualDirectory>
+ <Dependencies Name="Debug"/>
+ <Dependencies Name="Release"/>
+ <Settings Type="Dynamic Library">
+ <GlobalSettings>
+ <Compiler Options="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="">
+ <LibraryPath Value="."/>
+ </Linker>
+ <ResourceCompiler Options="">
+ <IncludePath Value="${DEVKITARM}/arm-eabi/include"/>
+ </ResourceCompiler>
+ </GlobalSettings>
+ <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
+ <Compiler Options="" Required="yes" PreCompiledHeader="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="" Required="yes"/>
+ <ResourceCompiler Options="" Required="no"/>
+ <General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
+ <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
+ <PostConnectCommands/>
+ <StartupCommands/>
+ </Debugger>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <RebuildCommand/>
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand/>
+ <SingleFileCommand/>
+ <MakefileGenerationCommand/>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(ProjectPath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild/>
+ <CustomPreBuild/>
+ </AdditionalRules>
+ </Configuration>
+ <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
+ <Compiler Options="" Required="yes" PreCompiledHeader="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="-O2" Required="yes"/>
+ <ResourceCompiler Options="" Required="no"/>
+ <General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
+ <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
+ <PostConnectCommands/>
+ <StartupCommands/>
+ </Debugger>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <RebuildCommand/>
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand/>
+ <SingleFileCommand/>
+ <MakefileGenerationCommand/>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(ProjectPath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild/>
+ <CustomPreBuild/>
+ </AdditionalRules>
+ </Configuration>
+ </Settings>
+</CodeLite_Project>
diff --git a/devkitARM/codelite/project-template/source/main.cpp b/devkitARM/codelite/project-template/source/main.cpp
new file mode 100644
index 0000000..fb66ec7
--- /dev/null
+++ b/devkitARM/codelite/project-template/source/main.cpp
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------------
+
+ $Id: main.cpp,v 1.13 2008-12-02 20:21:20 dovoto Exp $
+
+ Simple console print demo
+ -- dovoto
+
+
+---------------------------------------------------------------------------------*/
+#include <nds.h>
+
+#include <stdio.h>
+
+volatile int frame = 0;
+
+//---------------------------------------------------------------------------------
+void Vblank() {
+//---------------------------------------------------------------------------------
+ frame++;
+}
+
+//---------------------------------------------------------------------------------
+int main(void) {
+//---------------------------------------------------------------------------------
+ touchPosition touchXY;
+
+ irqSet(IRQ_VBLANK, Vblank);
+
+ consoleDemoInit();
+
+ iprintf(" Hello DS dev'rs\n");
+ iprintf(" \x1b[32mwww.devkitpro.org\n");
+ iprintf(" \x1b[32;1mwww.drunkencoders.com\x1b[39m");
+
+ while(1) {
+
+ swiWaitForVBlank();
+ touchRead(&touchXY);
+
+ // print at using ansi escape sequence \x1b[line;columnH
+ iprintf("\x1b[10;0HFrame = %d",frame);
+ iprintf("\x1b[16;0HTouch x = %04X, %04X\n", touchXY.rawx, touchXY.px);
+ iprintf("Touch y = %04X, %04X\n", touchXY.rawy, touchXY.py);
+
+ }
+
+ return 0;
+}
|
Gordin/devkitPro-Templates | 360e11aad544941afdd47353cfc5e021d29e1378 | Added project/workspace for devkitARM for codelite | diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..23905f6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+*.orig
+*~
+*.swp
+*.swo
+*.elf
+*.arm9
+*.nds
diff --git a/devkitARM/codelite/project-template/Makefile b/devkitARM/codelite/project-template/Makefile
new file mode 100644
index 0000000..77e23f4
--- /dev/null
+++ b/devkitARM/codelite/project-template/Makefile
@@ -0,0 +1,173 @@
+#---------------------------------------------------------------------------------
+.SUFFIXES:
+#---------------------------------------------------------------------------------
+
+ifeq ($(strip $(DEVKITARM)),)
+$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
+endif
+
+include $(DEVKITARM)/ds_rules
+
+#---------------------------------------------------------------------------------
+# TARGET is the name of the output
+# BUILD is the directory where object files & intermediate files will be placed
+# SOURCES is a list of directories containing source code
+# INCLUDES is a list of directories containing extra header files
+# DATA is a list of directories containing binary data
+# GRAPHICS is a list of directories containing files to be processed by grit
+#
+# All directories are specified relative to the project directory where
+# the makefile is found
+#
+#---------------------------------------------------------------------------------
+TARGET := $(notdir $(CURDIR))
+BUILD := build
+SOURCES := source
+DATA := data
+INCLUDES := include
+GRAPHICS := gfx
+
+#---------------------------------------------------------------------------------
+# options for code generation
+#---------------------------------------------------------------------------------
+ARCH := -mthumb -mthumb-interwork
+
+CFLAGS := -g -Wall -O2\
+ -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
+ -ffast-math \
+ $(ARCH)
+
+CFLAGS += $(INCLUDE) -DARM9
+CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
+
+ASFLAGS := -g $(ARCH)
+LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
+
+#---------------------------------------------------------------------------------
+# any extra libraries we wish to link with the project
+#---------------------------------------------------------------------------------
+LIBS := -lnds9
+
+
+#---------------------------------------------------------------------------------
+# list of directories containing libraries, this must be the top level containing
+# include and lib
+#---------------------------------------------------------------------------------
+LIBDIRS := $(LIBNDS)
+
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
+
+
+ifneq ($(BUILDDIR), $(CURDIR))
+#---------------------------------------------------------------------------------
+
+export OUTPUT := $(CURDIR)/$(TARGET)
+
+export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
+
+export DEPSDIR := $(CURDIR)/$(BUILD)
+
+CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
+CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
+BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
+BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
+PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
+
+#---------------------------------------------------------------------------------
+# use CXX for linking C++ projects, CC for standard C
+#---------------------------------------------------------------------------------
+ifeq ($(strip $(CPPFILES)),)
+#---------------------------------------------------------------------------------
+ export LD := $(CC)
+#---------------------------------------------------------------------------------
+else
+#---------------------------------------------------------------------------------
+ export LD := $(CXX)
+#---------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------
+
+export OFILES := $(addsuffix .o,$(BINFILES)) \
+ $(BMPFILES:.bmp=.o) \
+ $(PNGFILES:.png=.o) \
+ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+
+export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
+ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+ -I$(CURDIR)/$(BUILD)
+
+export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
+
+.PHONY: $(BUILD) clean
+
+#---------------------------------------------------------------------------------
+$(BUILD):
+ @[ -d $@ ] || mkdir -p $@
+ @make BUILDDIR=`cd $(BUILD) && pwd` --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+#---------------------------------------------------------------------------------
+clean:
+ @echo clean ...
+ @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba
+
+
+#---------------------------------------------------------------------------------
+else
+
+DEPENDS := $(OFILES:.o=.d)
+
+#---------------------------------------------------------------------------------
+# main targets
+#---------------------------------------------------------------------------------
+$(OUTPUT).nds : $(OUTPUT).arm9
+$(OUTPUT).arm9 : $(OUTPUT).elf
+$(OUTPUT).elf : $(OFILES)
+
+
+#---------------------------------------------------------------------------------
+# The bin2o rule should be copied and modified
+# for each extension used in the data directories
+#---------------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------------
+# This rule links in binary data with the .bin extension
+#---------------------------------------------------------------------------------
+%.bin.o : %.bin
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+# This rule links in binary data with the .raw extension
+#---------------------------------------------------------------------------------
+%.raw.o : %.raw
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
+# This rule creates assembly source files using grit
+# grit takes an image file and a .grit describing how the file is to be processed
+# add additional rules like this for each image extension
+# you use in the graphics folders
+#---------------------------------------------------------------------------------
+%.s %.h : %.bmp %.grit
+#---------------------------------------------------------------------------------
+ grit $< -fts -o$*
+
+#---------------------------------------------------------------------------------
+%.s %.h : %.png %.grit
+#---------------------------------------------------------------------------------
+ grit $< -fts -o$*
+
+-include $(DEPENDS)
+
+#---------------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------------
\ No newline at end of file
diff --git a/devkitARM/codelite/project-template/main.cpp b/devkitARM/codelite/project-template/main.cpp
new file mode 100644
index 0000000..fb66ec7
--- /dev/null
+++ b/devkitARM/codelite/project-template/main.cpp
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------------
+
+ $Id: main.cpp,v 1.13 2008-12-02 20:21:20 dovoto Exp $
+
+ Simple console print demo
+ -- dovoto
+
+
+---------------------------------------------------------------------------------*/
+#include <nds.h>
+
+#include <stdio.h>
+
+volatile int frame = 0;
+
+//---------------------------------------------------------------------------------
+void Vblank() {
+//---------------------------------------------------------------------------------
+ frame++;
+}
+
+//---------------------------------------------------------------------------------
+int main(void) {
+//---------------------------------------------------------------------------------
+ touchPosition touchXY;
+
+ irqSet(IRQ_VBLANK, Vblank);
+
+ consoleDemoInit();
+
+ iprintf(" Hello DS dev'rs\n");
+ iprintf(" \x1b[32mwww.devkitpro.org\n");
+ iprintf(" \x1b[32;1mwww.drunkencoders.com\x1b[39m");
+
+ while(1) {
+
+ swiWaitForVBlank();
+ touchRead(&touchXY);
+
+ // print at using ansi escape sequence \x1b[line;columnH
+ iprintf("\x1b[10;0HFrame = %d",frame);
+ iprintf("\x1b[16;0HTouch x = %04X, %04X\n", touchXY.rawx, touchXY.px);
+ iprintf("Touch y = %04X, %04X\n", touchXY.rawy, touchXY.py);
+
+ }
+
+ return 0;
+}
diff --git a/devkitARM/codelite/project-template/template.project b/devkitARM/codelite/project-template/template.project
new file mode 100644
index 0000000..8894ff0
--- /dev/null
+++ b/devkitARM/codelite/project-template/template.project
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<CodeLite_Project Name="template" InternalType="devkitARM">
+ <Description/>
+ <Dependencies/>
+ <VirtualDirectory Name="resources">
+ <File Name="Makefile"/>
+ </VirtualDirectory>
+ <VirtualDirectory Name="src">
+ <File Name="main.cpp"/>
+ </VirtualDirectory>
+ <Dependencies Name="Debug"/>
+ <Dependencies Name="Release"/>
+ <Settings Type="Dynamic Library">
+ <GlobalSettings>
+ <Compiler Options="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="">
+ <LibraryPath Value="."/>
+ </Linker>
+ <ResourceCompiler Options="">
+ <IncludePath Value="${DEVKITARM}/arm-eabi/include"/>
+ </ResourceCompiler>
+ </GlobalSettings>
+ <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
+ <Compiler Options="" Required="yes" PreCompiledHeader="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="" Required="yes"/>
+ <ResourceCompiler Options="" Required="no"/>
+ <General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
+ <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
+ <PostConnectCommands/>
+ <StartupCommands/>
+ </Debugger>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <RebuildCommand/>
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand/>
+ <SingleFileCommand/>
+ <MakefileGenerationCommand/>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(ProjectPath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild/>
+ <CustomPreBuild/>
+ </AdditionalRules>
+ </Configuration>
+ <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
+ <Compiler Options="" Required="yes" PreCompiledHeader="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Options="-O2" Required="yes"/>
+ <ResourceCompiler Options="" Required="no"/>
+ <General OutputFile="" IntermediateDirectory="$(ProjectPath)" Command="$(ProjectName).elf" CommandArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes"/>
+ <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="2159" DebuggerPath="${DEVKITARM}/bin/arm-eabi-gdb">
+ <PostConnectCommands/>
+ <StartupCommands/>
+ </Debugger>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <RebuildCommand/>
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand/>
+ <SingleFileCommand/>
+ <MakefileGenerationCommand/>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(ProjectPath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild/>
+ <CustomPreBuild/>
+ </AdditionalRules>
+ </Configuration>
+ </Settings>
+</CodeLite_Project>
diff --git a/devkitARM/codelite/workspace-template/devkitARM.workspace b/devkitARM/codelite/workspace-template/devkitARM.workspace
new file mode 100644
index 0000000..b026535
--- /dev/null
+++ b/devkitARM/codelite/workspace-template/devkitARM.workspace
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<CodeLite_Workspace Name="devkitARM" Database="./devkitARM.tags">
+ <BuildMatrix>
+ <WorkspaceConfiguration Name="Debug" Selected="yes">
+ <Project Name="test" ConfigName="Debug"/>
+ </WorkspaceConfiguration>
+ <WorkspaceConfiguration Name="Release" Selected="yes">
+ <Project Name="test" ConfigName="Release"/>
+ </WorkspaceConfiguration>
+ </BuildMatrix>
+</CodeLite_Workspace>
diff --git a/devkitARM/codelite/workspace-template/devkitARM.workspace.USER b/devkitARM/codelite/workspace-template/devkitARM.workspace.USER
new file mode 100644
index 0000000..06c0f94
--- /dev/null
+++ b/devkitARM/codelite/workspace-template/devkitARM.workspace.USER
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Workspace>
+ <Environment Name=""/>
+ <WorkspaceParserPaths>
+ <Include Path="${DEVKITARM}/arm-eabi/include"/>
+ <Include Path="${DEVKITARM}/include"/>
+ <Include Path="${DEVKITPRO}/libnds/include"/>
+ </WorkspaceParserPaths>
+</Workspace>
|
msiu-prog/test | 5ea27b57666b40f5afba1844fa8b9d93b7a9c2ef | last edit | diff --git a/cool_lib.o b/cool_lib.o
new file mode 100644
index 0000000..865e94b
Binary files /dev/null and b/cool_lib.o differ
diff --git a/main.c b/main.c
index 8bd2e2d..baafd5d 100644
--- a/main.c
+++ b/main.c
@@ -1,15 +1,17 @@
#include <stdlib.h>
#include <stdio.h>
+#include "cool_lib.h"
+
#define MAXLINE 11
int main(void) {
int i = 0;
for(i = 0; i < MAXLINE; ++i){
- printf("line %d", i);
+ printf("line %d some num is %d\n", i, get_some_number());
}
return 0;
}
diff --git a/main.o b/main.o
new file mode 100644
index 0000000..c37e3f4
Binary files /dev/null and b/main.o differ
diff --git a/makefile b/makefile
index 83819d6..84217aa 100644
--- a/makefile
+++ b/makefile
@@ -1,14 +1,14 @@
CC = gcc -Wall -std=c99
OBJ = main.o cool_lib.o
.c.o:
- $(CC) -c $< -o &@
+ $(CC) -c $< -o $@
default: main
main: $(OBJ)
$(CC) $(OBJ) -o $@
|
geflei/plasmoid-eventlist | 9392d1e3c488cabc78f88f286d28b9f1bf27d275 | Edited README via GitHub | diff --git a/README b/README
index dddc68e..6db741a 100644
--- a/README
+++ b/README
@@ -1,41 +1 @@
-To install:
-
-To build out of the source tree
-unpack the archive,
-mkdir build
-cd build
-cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` PATH_TO_APPLET_ROOT
-make
-sudo make install or su -c "make install"
-kbuildsycoca4
-
-where PATH_TO_APPLET_ROOT is the path to the applet source (e.g. $HOME/plasmoid-eventlist-0.3.95/).
-
-To test the applet from a shell use
-plasmoidviewer plasma_applet_events
-
-If you use kdepim 4.6 (the runtime stuff, not pimlibs) and open events/todos with rightclick does not work try
-adding -DHAS_AKONADI_PIM=1 to cmake
-
-How to setup Akonadi:
-Of course you have to install the akonadiserver (openSUSE the akonadi-runtime package),
-the resources are in the kdepim-runtime package where are also the config modules and utilities.
-From 4.4 akonadi settings aren't anymore in systemsettings, you must use the akonaditray utility.
-Create a file $HOME/.local/share/akonadi/mysql-local.conf
-with the content
-user=username
-where username is you your username.
-
-If you get errors in the server test like
-[Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
-[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
-[ERROR] Cannot open mysql.db
-[ERROR] Cannot open mysql.user
-[ERROR] Cannot open mysql.event
-
-Execute from a terminal with the running akonadiserver:
-mysql_install_db --datadir=$HOME/.local/share/akonadi/db_data/
-mysql_upgrade --socket=$HOME/.local/share/akonadi/db_misc/mysql.socket
-Then stop and restart the server.
-
-Then you can add resources.
+Development continues on projects.kde.org
\ No newline at end of file
|
geflei/plasmoid-eventlist | 81c2911687a4189cd6e5c0a8898c95cd2b203630 | a little clarification | diff --git a/README b/README
index 54dbd03..dddc68e 100644
--- a/README
+++ b/README
@@ -1,41 +1,41 @@
To install:
To build out of the source tree
unpack the archive,
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` PATH_TO_APPLET_ROOT
make
sudo make install or su -c "make install"
kbuildsycoca4
where PATH_TO_APPLET_ROOT is the path to the applet source (e.g. $HOME/plasmoid-eventlist-0.3.95/).
To test the applet from a shell use
plasmoidviewer plasma_applet_events
-If you use kdepim 4.6 and open events/todos with rightclick does not work try
+If you use kdepim 4.6 (the runtime stuff, not pimlibs) and open events/todos with rightclick does not work try
adding -DHAS_AKONADI_PIM=1 to cmake
How to setup Akonadi:
Of course you have to install the akonadiserver (openSUSE the akonadi-runtime package),
the resources are in the kdepim-runtime package where are also the config modules and utilities.
From 4.4 akonadi settings aren't anymore in systemsettings, you must use the akonaditray utility.
Create a file $HOME/.local/share/akonadi/mysql-local.conf
with the content
user=username
where username is you your username.
If you get errors in the server test like
[Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[ERROR] Cannot open mysql.db
[ERROR] Cannot open mysql.user
[ERROR] Cannot open mysql.event
Execute from a terminal with the running akonadiserver:
mysql_install_db --datadir=$HOME/.local/share/akonadi/db_data/
mysql_upgrade --socket=$HOME/.local/share/akonadi/db_misc/mysql.socket
Then stop and restart the server.
Then you can add resources.
|
geflei/plasmoid-eventlist | 0db00ea120f79774f5895465a19942cfbbaf04fd | use stringbuilder | diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e17ded..a18f70d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,33 +1,33 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules )
# search packages used by KDE
find_package(KDE4 REQUIRED)
find_package(Akonadi REQUIRED)
find_package(KdepimLibs REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
include(MacroOptionalAddSubdirectory)
include(FindKdepimLibs)
SET (CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
-ADD_DEFINITIONS (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+ADD_DEFINITIONS (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
IF (HAS_AKONADI_PIM)
ADD_DEFINITIONS (-DHAS_AKONADI_PIM)
MESSAGE ("-- Compiling for KDE PIM 4.6")
ENDIF (HAS_AKONADI_PIM)
INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${AKONADI_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/akonadi
${CMAKE_SOURCE_DIR}/libkdepim
${KDEPIMLIBS_INCLUDE_DIRS}
)
add_subdirectory(src/applet)
# add_subdirectory(src/dataengine)
add_subdirectory(po)
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 8981fde..d47afb7 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,557 +1,557 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
connect(job, SIGNAL(result(KJob *)), this, SLOT(initialCollectionFetchFinished(KJob *)));
job->start();
}
void EventModel::initialCollectionFetchFinished(KJob *job)
{
if (job->error()) {
kDebug() << "Initial collection fetch failed!";
} else {
Akonadi::CollectionFetchJob *cJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
Akonadi::Collection::List collections = cJob->collections();
foreach (const Akonadi::Collection &collection, collections) {
m_collections.insert(collection.id(), collection);
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
job->fetchScope().fetchFullPayload();
job->fetchScope().setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
connect(job, SIGNAL(result(KJob *)), this, SLOT(initialItemFetchFinished(KJob *)));
job->start();
}
}
}
void EventModel::initialItemFetchFinished(KJob *job)
{
if (job->error()) {
kDebug() << "Initial item fetch failed!";
} else {
Akonadi::ItemFetchJob *iJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
Akonadi::Item::List items = iJob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo));
}
} // if hasPayload
} // foreach
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
- data["title"] = "<b>" + title + "</b>";
+ data["title"] = QString("<b>" + title + "</b>");
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
m_collections.insert(collection.id(), collection);
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
n > 2000 ? data["yearsSince"] = "XX" : data["yearsSince"] = QString::number(n); // workaround missing facebook birthdays
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 7ac9cb924ff6db5fae60a9e76d859bf46bfd294f | try make dbus calls work | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 4f3cabd..41f81d2 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,702 +1,793 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
+#include <QDBusConnection>
+#include <QDBusInterface>
+#include <QDBusConnectionInterface>
+#include <QDBusServiceWatcher>
+
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
#include <KTabWidget>
+#include <KToolInvocation>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
+static const int WAIT_FOR_KO_MSECS = 2000;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_eventFormatConfig(),
m_todoFormatConfig(),
m_colorConfigUi(),
m_timer(0),
- m_agentManager(0)
+ m_agentManager(0),
+ m_openEventWatcher(0),
+ m_addEventWatcher(0),
+ m_addTodoWatcher(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
#endif
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
+ m_uid = QString();
#ifdef HAS_AKONADI_PIM
- QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
+ m_uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
- QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
+ m_uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
- if (!uid.isEmpty())
- KOrganizerAppletUtil::showEvent(uid);
+
+ if (!m_openEventWatcher) {
+ m_openEventWatcher = new QDBusServiceWatcher("org.kde.korganizer",
+ QDBusConnection::sessionBus(),
+ QDBusServiceWatcher::WatchForRegistration,
+ this);
+ }
+
+ if (!m_uid.isEmpty()) {
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.korganizer")) {
+ connect(m_openEventWatcher, SIGNAL(serviceRegistered(const QString &)),
+ this, SLOT(korganizerStartedOpenEvent(const QString &)));
+
+ KToolInvocation::startServiceByDesktopName("korganizer");
+ } else {
+ KOrganizerAppletUtil::showEvent(m_uid);
+ }
+ }
+}
+
+void EventApplet::korganizerStartedOpenEvent(const QString &)
+{
+ delete m_openEventWatcher;
+ m_openEventWatcher = 0;
+ QTimer::singleShot(WAIT_FOR_KO_MSECS, this, SLOT(timedOpenEvent()));
+}
+
+void EventApplet::timedOpenEvent()
+{
+ KOrganizerAppletUtil::showEvent(m_uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
- KOrganizerAppletUtil::showAddEvent();
+ if (!m_addEventWatcher) {
+ m_addEventWatcher = new QDBusServiceWatcher("org.kde.korganizer",
+ QDBusConnection::sessionBus(),
+ QDBusServiceWatcher::WatchForRegistration,
+ this);
+ }
+
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.korganizer")) {
+ connect(m_addEventWatcher, SIGNAL(serviceRegistered(const QString &)),
+ this, SLOT(korganizerStartedAddEvent(const QString &)));
+
+ KToolInvocation::startServiceByDesktopName("korganizer");
+ } else {
+ KOrganizerAppletUtil::showAddEvent();
+ }
+}
+
+void EventApplet::korganizerStartedAddEvent(const QString &)
+{
+ delete m_addEventWatcher;
+ m_addEventWatcher = 0;
+ QTimer::singleShot(WAIT_FOR_KO_MSECS, this, SLOT(timedAddEvent()));
+}
+
+void EventApplet::timedAddEvent()
+{
+ KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
- KOrganizerAppletUtil::showAddTodo();
+ if (!m_addTodoWatcher) {
+ m_addTodoWatcher = new QDBusServiceWatcher("org.kde.korganizer",
+ QDBusConnection::sessionBus(),
+ QDBusServiceWatcher::WatchForRegistration,
+ this);
+ }
+
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.korganizer")) {
+ connect(m_addTodoWatcher, SIGNAL(serviceRegistered(const QString &)),
+ this, SLOT(korganizerStartedAddTodo(const QString &)));
+
+ KToolInvocation::startServiceByDesktopName("korganizer");
+ } else {
+ KOrganizerAppletUtil::showAddTodo();
+ }
+}
+
+void EventApplet::korganizerStartedAddTodo(const QString &)
+{
+ delete m_addTodoWatcher;
+ m_addTodoWatcher = 0;
+ QTimer::singleShot(WAIT_FOR_KO_MSECS, this, SLOT(timedAddTodo()));
+}
+
+void EventApplet::timedAddTodo()
+{
+ KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::eventMimeType()) ||
agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::todoMimeType()) ||
agentMimeTypes.contains("text/calendar")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
KTabWidget *formatTabs = new KTabWidget();
QWidget *eventFormatWidget = new QWidget();
m_eventFormatConfig.setupUi(eventFormatWidget);
m_eventFormatConfig.setupConnections();
QWidget *todoFormatWidget = new QWidget();
m_todoFormatConfig.setupUi(todoFormatWidget);
formatTabs->addTab(eventFormatWidget, i18n("Event text formatting"));
formatTabs->addTab(todoFormatWidget, i18n("Todo text formatting"));
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatTabs, i18n("Text Format"), "format-text-bold");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_generalConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_generalConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_eventFormatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_eventFormatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_todoFormatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_todoFormatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
//general config
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int dateFormat = m_generalConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_generalConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
//event config
QString normalEventFormat = m_eventFormatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_eventFormatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
//todo config
QString todoFormat = m_todoFormatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_todoFormatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
m_delegate->setCategoryFormats(m_categoryFormat);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
//color config
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index 4bc9815..2d9f2a1 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,121 +1,130 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
#include "generalconfig.h"
#include "formatconfig.h"
#include "ui_todoformatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
class KDirWatch;
+class QDBusServiceWatcher;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
void plasmaThemeChanged();
void koConfigChanged();
+ void korganizerStartedOpenEvent(const QString &);
+ void korganizerStartedAddEvent(const QString &);
+ void korganizerStartedAddTodo(const QString &);
+ void timedOpenEvent();
+ void timedAddEvent();
+ void timedAddTodo();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
KDirWatch *m_categoryColorWatch;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
Plasma::Label *title;
EventItemDelegate *m_delegate;
GeneralConfig m_generalConfig;
FormatConfig m_eventFormatConfig;
Ui::TodoFormatConfig m_todoFormatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
QStringList disabledResources, m_headerItemsList;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
+ QString m_uid;
+ QDBusServiceWatcher *m_openEventWatcher, *m_addEventWatcher, *m_addTodoWatcher;
};
#endif
diff --git a/src/applet/korganizerappletutil.cpp b/src/applet/korganizerappletutil.cpp
index 6ba58a7..5097e27 100644
--- a/src/applet/korganizerappletutil.cpp
+++ b/src/applet/korganizerappletutil.cpp
@@ -1,86 +1,70 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "korganizerappletutil.h"
// autogenerated dbus interfaces
#include "calendar_interface.h"
#include "korganizer_interface.h"
// qt headers
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusReply>
// kde headers
#include <KLocale>
-#include <KToolInvocation>
#include <KWindowSystem>
-
void KOrganizerAppletUtil::showEvent(const QString &uid)
{
- checkAndLaunchKontact();
-
OrgKdeKorganizerKorganizerInterface interface("org.kde.korganizer",
"/Korganizer",
QDBusConnection::sessionBus());
interface.showIncidence(uid);
KOrganizerAppletUtil::showMainWindow();
}
void KOrganizerAppletUtil::showAddEvent()
{
- checkAndLaunchKontact();
-
OrgKdeKorganizerCalendarInterface interface("org.kde.korganizer",
"/Calendar",
QDBusConnection::sessionBus());
interface.openEventEditor(QString());
KOrganizerAppletUtil::showMainWindow();
}
void KOrganizerAppletUtil::showAddTodo()
{
- checkAndLaunchKontact();
-
OrgKdeKorganizerCalendarInterface interface("org.kde.korganizer",
"/Calendar",
QDBusConnection::sessionBus());
interface.openTodoEditor(QString());
KOrganizerAppletUtil::showMainWindow();
}
void KOrganizerAppletUtil::showMainWindow()
{
QDBusInterface kontactInterface("org.kde.korganizer",
"/kontact/MainWindow_1",
"org.kde.KMainWindow",
QDBusConnection::sessionBus());
QDBusReply<long> kontactWinId = kontactInterface.call("winId");
KWindowSystem::forceActiveWindow (kontactWinId, 1);
}
-
-void KOrganizerAppletUtil::checkAndLaunchKontact()
-{
- if(!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.korganizer"))
- {
- KToolInvocation::kdeinitExecWait("korganizer");
- }
-}
diff --git a/src/applet/korganizerappletutil.h b/src/applet/korganizerappletutil.h
index 6299c07..098704b 100644
--- a/src/applet/korganizerappletutil.h
+++ b/src/applet/korganizerappletutil.h
@@ -1,36 +1,35 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef KORGANIZERAPPLETUTIL_H
#define KORGANIZERAPPLETUTIL_H
#include <QObject>
class KOrganizerAppletUtil : public QObject
{
public:
static void showEvent(const QString &uid);
static void showAddEvent();
static void showAddTodo();
private:
- static void checkAndLaunchKontact();
static void showMainWindow();
};
#endif
|
geflei/plasmoid-eventlist | 22458acbb84c030b416b233e1101eff86e2bc571 | add spanish translation (Ernesto ManrÃquez) | diff --git a/AUTHORS b/AUTHORS
index 9f9bfec..225afa3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,12 +1,13 @@
- Gerd Fleischer <gerdfleischer @ web dot de>
- Javier Goday <jgoday @ gmail dot com>
Translators
+spanish - Ernesto ManrÃquez
russian - pfactum
ukrainian - pfactum
french - gnumdk
slovak - Karol Slanina
italian - Jacopo Ferrigno
czech - Aleš Nejdr
german - me
diff --git a/po/es.po b/po/es.po
new file mode 100644
index 0000000..4a3548d
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,593 @@
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# Ernesto ManrÃquez <[email protected]>, 2011.
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.2.4\n"
+"Report-Msgid-Bugs-To: [email protected]\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
+"PO-Revision-Date: 2011-02-25 12:23+0100\n"
+"Last-Translator: Ernesto ManrÃquez <[email protected]>\n"
+"Language-Team: Spanish <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"X-Generator: Lokalize 1.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
+#: eventmodel.cpp:277 eventmodel.cpp:455
+msgid "Birthday"
+msgstr "Cumpleaños"
+
+#: eventapplet.cpp:137
+msgid "Holiday"
+msgstr "Festivos"
+
+#: eventapplet.cpp:147
+msgid "Today"
+msgstr "Hoy"
+
+#: eventapplet.cpp:147
+msgid "Events of today"
+msgstr "Eventos para hoy"
+
+#: eventapplet.cpp:148
+msgid "Tomorrow"
+msgstr "Mañana"
+
+#: eventapplet.cpp:148
+msgid "Events for tomorrow"
+msgstr "Eventos para mañana"
+
+#: eventapplet.cpp:149
+msgid "Week"
+msgstr "Semana"
+
+#: eventapplet.cpp:149
+msgid "Events of the next week"
+msgstr "Eventos para esta semana"
+
+#: eventapplet.cpp:150
+msgid "Next 4 weeks"
+msgstr "Próximas 4 semanas"
+
+#: eventapplet.cpp:150
+msgid "Events for the next 4 weeks"
+msgstr "Eventos para las siguientes 4 semanas"
+
+#: eventapplet.cpp:151
+msgid "Later"
+msgstr "Después"
+
+#: eventapplet.cpp:151
+msgid "Events later than 4 weeks"
+msgstr "Eventos para después de 4 semanas"
+
+#: eventapplet.cpp:297 eventapplet.cpp:435
+msgid "Upcoming Events"
+msgstr "Eventos importantes:"
+
+#: eventapplet.cpp:351
+msgid "Select Resources"
+msgstr "Recursos"
+
+#: eventapplet.cpp:402
+msgid "Open \"%1\""
+msgstr "Abrir \"%1\""
+
+#: eventapplet.cpp:409
+msgid "Add new event"
+msgstr "Añadir nuevo evento"
+
+#: eventapplet.cpp:414
+msgid "Add new todo"
+msgstr "Añadir nueva tarea"
+
+#: eventapplet.cpp:419
+msgid "Select shown resources"
+msgstr "Recursos Akonadi a mostrar"
+
+#: eventapplet.cpp:436
+msgid "Upcoming events from Akonadi resources"
+msgstr "Lista de Eventos"
+
+#: eventapplet.cpp:464
+msgid "General"
+msgstr "General"
+
+#: eventapplet.cpp:465
+msgid "Text Format"
+msgstr "Formato de texto"
+
+#: eventapplet.cpp:466
+msgid "Colors"
+msgstr "Colores"
+
+#: eventmodel.cpp:141
+msgid "The Akonadi server is not running!"
+msgstr "¡El sistema Akonadi no está funcionando!"
+
+#: eventmodel.cpp:174
+msgid "Earlier stuff"
+msgstr "Eventos anteriores"
+
+#: eventmodel.cpp:174
+msgid "Unfinished todos, still ongoing earlier events etc."
+msgstr "Tareas sin terminar, eventos aún en curso, etc."
+
+#: eventmodel.cpp:178
+msgid "Some day"
+msgstr "Algún dÃa"
+
+#: eventmodel.cpp:178
+msgid "Todos with no due date"
+msgstr "Tareas sin una fecha fija"
+
+#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
+#: formatconfig.cpp:40
+msgid "Unspecified"
+msgstr "Sin especificar"
+
+#. i18n: file: eventappletgeneralconfig.ui:55
+#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
+#: generalconfig.cpp:49 rc.cpp:191
+msgid "Title"
+msgstr "TÃtulo"
+
+#. i18n: file: eventappletcolorconfig.ui:14
+#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
+#. i18n: file: eventappletformatconfig.ui:14
+#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
+#. i18n: file: eventappletgeneralconfig.ui:14
+#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
+msgid "Form"
+msgstr "Forma"
+
+#. i18n: file: eventappletcolorconfig.ui:20
+#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
+#: rc.cpp:6
+msgid "Times"
+msgstr "Urgencias"
+
+#. i18n: file: eventappletcolorconfig.ui:26
+#. i18n: ectx: property (text), widget (QLabel, label_8)
+#: rc.cpp:9
+msgid "Urgency for normal events:"
+msgstr "Eventos normales:"
+
+#. i18n: file: eventappletcolorconfig.ui:33
+#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
+#: rc.cpp:12
+msgid "The time left until an event is marked as soon beginning."
+msgstr "Los minutos que quedan para que un evento sea marcado como próximo a comenzar."
+
+#. i18n: file: eventappletcolorconfig.ui:36
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
+#: rc.cpp:15
+msgid "min"
+msgstr " min"
+
+#. i18n: file: eventappletcolorconfig.ui:59
+#. i18n: ectx: property (text), widget (QLabel, label_11)
+#: rc.cpp:18
+msgid "Urgency for birthdays:"
+msgstr "Cumpleaños:"
+
+#. i18n: file: eventappletcolorconfig.ui:66
+#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
+#: rc.cpp:21
+msgid "The days left until a birthday or anniversary is marked as being soon."
+msgstr ""
+"Los dÃas que quedan hasta que un cumpleaños o aniversario sea marcado "
+"como de próxima ocurrencia"
+
+#. i18n: file: eventappletcolorconfig.ui:69
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
+#: rc.cpp:24
+msgid "days"
+msgstr " dÃas"
+
+#. i18n: file: eventappletcolorconfig.ui:82
+#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
+#: rc.cpp:27
+msgid "Colors for normal events"
+msgstr "Colores de fondo para eventos importantes"
+
+#. i18n: file: eventappletcolorconfig.ui:88
+#. i18n: ectx: property (text), widget (QLabel, label)
+#: rc.cpp:30
+msgid "Backgroundcolor for near events:"
+msgstr "Eventos urgentes:"
+
+#. i18n: file: eventappletcolorconfig.ui:101
+#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
+#: rc.cpp:33
+msgid "The backgroundcolor for soon beginning events."
+msgstr "El color de fondo que marca que un evento o cumpleaños tiene urgencia."
+
+#. i18n: file: eventappletcolorconfig.ui:108
+#. i18n: ectx: property (text), widget (QLabel, label_5)
+#. i18n: file: eventappletcolorconfig.ui:174
+#. i18n: ectx: property (text), widget (QLabel, label_10)
+#. i18n: file: eventappletcolorconfig.ui:231
+#. i18n: ectx: property (text), widget (QLabel, label_13)
+#. i18n: file: eventappletcolorconfig.ui:257
+#. i18n: ectx: property (text), widget (QLabel, label_14)
+#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
+msgid "Opacity:"
+msgstr "Opacidad:"
+
+#. i18n: file: eventappletcolorconfig.ui:115
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
+#. i18n: file: eventappletcolorconfig.ui:181
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
+#. i18n: file: eventappletcolorconfig.ui:238
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
+#. i18n: file: eventappletcolorconfig.ui:264
+#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
+#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
+#, no-c-format
+msgid "%"
+msgstr "%"
+
+#. i18n: file: eventappletcolorconfig.ui:125
+#. i18n: ectx: property (text), widget (QLabel, label_4)
+#: rc.cpp:43
+msgid "Textcolor for started or passed events:"
+msgstr "Eventos ya iniciados o pasados:"
+
+#. i18n: file: eventappletcolorconfig.ui:138
+#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
+#: rc.cpp:46
+msgid "The textcolor for already started or passed events."
+msgstr "El color de fondo que marca que un evento se inició, o ya ha pasado."
+
+#. i18n: file: eventappletcolorconfig.ui:148
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
+#: rc.cpp:49
+msgid "Colors for todos"
+msgstr "Colores de fondo para tareas"
+
+#. i18n: file: eventappletcolorconfig.ui:154
+#. i18n: ectx: property (text), widget (QLabel, label_9)
+#: rc.cpp:52
+msgid "Backgroundcolor for todos:"
+msgstr "Tareas pendientes:"
+
+#. i18n: file: eventappletcolorconfig.ui:167
+#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
+#: rc.cpp:55
+msgid "The backgroundcolor for common todos."
+msgstr "El color de fondo para las tareas que están pendientes."
+
+#. i18n: file: eventappletcolorconfig.ui:194
+#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
+#: rc.cpp:65
+msgid "Show or hide already finished todos."
+msgstr "Muestra o esconde las tareas que han sido terminadas."
+
+#. i18n: file: eventappletcolorconfig.ui:197
+#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
+#: rc.cpp:68
+msgid "Show finished todos"
+msgstr "Mostrar tareas terminadas"
+
+#. i18n: file: eventappletcolorconfig.ui:217
+#. i18n: ectx: property (text), widget (QLabel, label_12)
+#: rc.cpp:71
+msgid "Background for finished todos:"
+msgstr "Tareas terminadas:"
+
+#. i18n: file: eventappletcolorconfig.ui:224
+#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
+#: rc.cpp:74
+msgid "The backgroundcolor for already finished todos."
+msgstr "El color de fondo con el que se muestran las tareas terminadas."
+
+#. i18n: file: eventappletcolorconfig.ui:251
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
+#: rc.cpp:84
+msgid "KOrganizer colors"
+msgstr "Fondos de KOrganizer"
+
+#. i18n: file: eventappletformatconfig.ui:20
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
+#: rc.cpp:97
+msgid "Event text formatting"
+msgstr "Eventos"
+
+#. i18n: file: eventappletformatconfig.ui:26
+#. i18n: ectx: property (text), widget (QLabel, label_3)
+#: rc.cpp:100
+msgid "Format for normal events:"
+msgstr "Código para los eventos sin categorÃa:"
+
+#. i18n: file: eventappletformatconfig.ui:33
+#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
+#: rc.cpp:103
+msgid "The text displayed for common events."
+msgstr "El texto que se mostrará en los eventos sin categorÃa."
+
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+msgid "Category"
+msgstr "CategorÃa"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+msgid "Format"
+msgstr "Código a mostrar"
+
+#. i18n: file: eventappletformatconfig.ui:72
+#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
+#. i18n: file: eventappletgeneralconfig.ui:73
+#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
+#: rc.cpp:112 rc.cpp:200
+msgid "Add"
+msgstr "Añadir"
+
+#. i18n: file: eventappletformatconfig.ui:79
+#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
+#: rc.cpp:115
+msgid "Copy"
+msgstr "Copiar"
+
+#. i18n: file: eventappletformatconfig.ui:86
+#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
+#. i18n: file: eventappletgeneralconfig.ui:80
+#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
+#: rc.cpp:118 rc.cpp:203
+msgid "Remove"
+msgstr "Borrar"
+
+#. i18n: file: eventappletformatconfig.ui:100
+#. i18n: ectx: property (text), widget (QLabel, label_5)
+#: rc.cpp:122
+#, no-c-format
+msgid ""
+"The format for the displayed text for events.\n"
+"Substitutions (mostly self-explanatory) are:\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
+"%{yearsSince} - years since the first time (useful for birthdays),\n"
+"%{resourceName} - the i18n name of the Akonadi resource,\n"
+"%{mainCategory}, %{categories} - the first or all categories,\n"
+"%{tab} - a tabulator"
+msgstr ""
+"El formato para el texto mostrado para los eventos. Los campos a reemplazar "
+"son:\n"
+"%{startDate}, %{endDate} - Fechas de inicio y de fin "
+"%{startTime}, %{endTime} - Horas de inicio y de fin\n"
+"%{summary} - Resumen %{description} - Descripción\n"
+"%{location} - Ubicación "
+"%{duration} - Duración\n"
+"%{yearsSince} - Años desde que ocurrió el evento "
+"%{resourceName} - Nombre del recurso\n"
+"%{mainCategory}, %{categories} - CategorÃa(s) "
+"%{tab} - Un tabulador"
+
+#. i18n: file: eventappletformatconfig.ui:110
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
+#: rc.cpp:132
+msgid "Todo text formatting"
+msgstr "Tareas"
+
+#. i18n: file: eventappletformatconfig.ui:122
+#. i18n: ectx: property (text), widget (QLabel, label_7)
+#: rc.cpp:136
+#, no-c-format
+msgid ""
+"The format for the displayed text for todos.\n"
+"Substutions (again mostly self-explanatory) are:\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
+"%{resourceName} - the i18n name of the Akonadi resource,\n"
+"%{mainCategory}, %{categories} - the first or all categories,\n"
+"%{tab} - a tabulator"
+msgstr ""
+"Formato de texto mostrado para las tareas. Los campos a reemplazar son:\n"
+"%{dueDate}, %{dueTime} - Hora y fecha de vencimiento del plazo,\n"
+"%{startDate}, %{startTime} - Hora y fecha de inicio "
+"%{summary} - Resumen\n"
+"%{description} - Descripción "
+"%{percent} - Porcentaje terminado\n"
+"%{location} - Ubicación "
+"%{resourceName} - Nombre del recurso\n"
+"%{mainCategory}, %{categories} - CategorÃa(s) "
+"%{tab} - Un tabulador"
+
+#. i18n: file: eventappletformatconfig.ui:129
+#. i18n: ectx: property (text), widget (QLabel, label_8)
+#: rc.cpp:145
+msgid "Format for todos:"
+msgstr "Tareas con plazo:"
+
+#. i18n: file: eventappletformatconfig.ui:136
+#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
+#: rc.cpp:148
+msgid "The text displayed for common todos."
+msgstr "El texto a mostrar para tareas comunes."
+
+#. i18n: file: eventappletformatconfig.ui:146
+#. i18n: ectx: property (text), widget (QLabel, label_9)
+#: rc.cpp:151
+msgid "Todos with no due date:"
+msgstr "Tareas sin plazo:"
+
+#. i18n: file: eventappletformatconfig.ui:153
+#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
+#: rc.cpp:154
+msgid "The text displayed for todos with no due date."
+msgstr "El texto a mostrar para las tareas sin un plazo"
+
+#. i18n: file: eventappletformatconfig.ui:163
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
+#: rc.cpp:157
+msgid "Date appearance settings"
+msgstr "Apariencia de la fecha"
+
+#. i18n: file: eventappletformatconfig.ui:169
+#. i18n: ectx: property (text), widget (QLabel, label)
+#: rc.cpp:160
+msgid "Date format:"
+msgstr "Formato:"
+
+#. i18n: file: eventappletformatconfig.ui:176
+#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
+#: rc.cpp:163
+msgid "What date format to use."
+msgstr ""
+"El formato de fecha a usar. Lista de Eventos puede usar la fecha corta\n"
+"de sistema, la fecha larga de sistema o un código personalizado."
+
+#. i18n: file: eventappletformatconfig.ui:180
+#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
+#: rc.cpp:166
+msgid "KDE ShortDate"
+msgstr "Fecha corta de sistema"
+
+#. i18n: file: eventappletformatconfig.ui:185
+#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
+#: rc.cpp:169
+msgid "KDE LongDate"
+msgstr "Fecha larga de sistema"
+
+#. i18n: file: eventappletformatconfig.ui:190
+#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
+#: rc.cpp:172
+msgid "Custom"
+msgstr "Fecha personalizada"
+
+#. i18n: file: eventappletformatconfig.ui:198
+#. i18n: ectx: property (text), widget (QLabel, label_2)
+#: rc.cpp:175
+msgid "Custom format:"
+msgstr "Código:"
+
+#. i18n: file: eventappletformatconfig.ui:205
+#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
+#: rc.cpp:178
+msgid "A string describing the custom format. It is using the QDate syntax."
+msgstr ""
+"Un código que describe el formato personalizado. Se usa aquà el formato\n"
+"QDate (el mismo formato usado por KDE para su propia personalización de\n"
+"fecha)."
+
+#. i18n: file: eventappletgeneralconfig.ui:20
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
+#: rc.cpp:184
+msgid "Header sections"
+msgstr "Ventanas de tiempo"
+
+#. i18n: file: eventappletgeneralconfig.ui:27
+#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
+#: rc.cpp:187
+msgid ""
+"Add your own headers here, start is the first day of the period counting "
+"from today,\n"
+"it will stretch to the next header or end of the displayed timeframe."
+msgstr ""
+"Las ventanas de tiempo muestran los eventos que ocurrirán desde el dÃa de\n"
+"inicio, que es el número de dÃas a mostrar desde hoy, hasta la próxima\n"
+"ventana, o hasta el fin del periodo a mostrar. Aquà se pueden añadir\n "
+"o quitar ventanas."
+
+#. i18n: file: eventappletgeneralconfig.ui:60
+#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
+#: rc.cpp:194
+msgid "Tooltip"
+msgstr "Descripción"
+
+#. i18n: file: eventappletgeneralconfig.ui:65
+#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
+#: rc.cpp:197
+msgid "Start"
+msgstr "DÃas desde hoy"
+
+#. i18n: file: eventappletgeneralconfig.ui:90
+#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
+#: rc.cpp:206
+msgid "Miscellenous options"
+msgstr "Opciones misceláneas"
+
+#. i18n: file: eventappletgeneralconfig.ui:96
+#. i18n: ectx: property (text), widget (QLabel, label_6)
+#: rc.cpp:209
+msgid "Period to show incidences (in days):"
+msgstr "Total de dÃas a mostrar:"
+
+#. i18n: file: eventappletgeneralconfig.ui:103
+#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
+#: rc.cpp:212
+msgid "The time frame to show incidences."
+msgstr "El plazo total en dÃas en el cual se mostrarán eventos."
+
+#: rc.cpp:213
+msgctxt "NAME OF TRANSLATORS"
+msgid "Your names"
+msgstr "Ernesto ManrÃquez"
+
+#: rc.cpp:214
+msgctxt "EMAIL OF TRANSLATORS"
+msgid "Your emails"
+msgstr "[email protected]"
+
+#~ msgid "Colors for recurring events"
+#~ msgstr "Farben für wiederkehrende Termine"
+
+#~ msgid "Backgroundcolor for Birthdays:"
+#~ msgstr "Hintergrundfarbe für Geburtstage:"
+
+#~ msgid "The backgroundcolor for birthdays."
+#~ msgstr "Die Hintergrundfarbe für Geburtstage."
+
+#~ msgid "Backgroundcolor for Anniversaries:"
+#~ msgstr "Hintergrundfarbe für Jahrestage:"
+
+#~ msgid "The backgroundcolor for anniversaries."
+#~ msgstr "Die Hintergrundfarbe für Jahrestage."
+
+#~ msgid "Birthday & Anniversaries:"
+#~ msgstr "Geburtstage & Jahrestage:"
+
+#~ msgid "The text displayed for birthdays or anniversaries."
+#~ msgstr "Der Text der für Geburtstage und Jahrestage angezeigt wird."
+
+#~ msgid "Open event"
+#~ msgstr "Termin öffnen"
+
+#~ msgid "Open todo"
+#~ msgstr "Aufgabe öffnen"
+
+#~ msgid "Urgency:"
+#~ msgstr "Dringlichkeit:"
+
+#~ msgid "%1 retries to start/connect to the Akonadi server"
+#~ msgstr "%1 Versuche eine Verbindung zum Akonadiserver herzustellen"
+
+#~ msgid "Could not connect to the Akonadi server"
+#~ msgstr "Konnte keine Verbindung zum Akonadiserver herstellen"
+
+#~ msgid "Events after the next month"
+#~ msgstr "Termine nach dem nächsten Monat"
+
+#~ msgid "Use colors"
+#~ msgstr "Benutze Farben"
+
+#~ msgid "Checkintervall:"
+#~ msgstr "Ãberprüfungsintervall:"
+
+#~ msgid "How often the items are checked for urgency or already started."
+#~ msgstr ""
+#~ "Abstand wie oft Items auf baldiges Beginnen oder bereits angefangen "
+#~ "überprüft werden."
diff --git a/src/applet/plasma-applet-events.desktop b/src/applet/plasma-applet-events.desktop
index f5fee77..22b235d 100644
--- a/src/applet/plasma-applet-events.desktop
+++ b/src/applet/plasma-applet-events.desktop
@@ -1,28 +1,30 @@
[Desktop Entry]
Encoding=UTF-8
Name=Eventlist
Name[de]=Ereignisliste
Name[sk]=Zoznam udalostÃ
Name[uk]=СпиÑок подÑй
Name[ru]=СпиÑок ÑобÑÑий
Name[it]=Eventlist
+Name[es]=Lista de Eventos
Comment=Shows a list with the events from Akonadi resources
Comment[de]=Zeigt eine Liste mit den Ereignissen etc. von Akonadi Ressourcen
Comment[sk]=Zobrazuje zoznam udalostà z Akonadi zdrojov
Comment[uk]=ÐоказÑÑ ÑпиÑок подÑй Ñз ÑеÑÑÑÑÑв Akonadi
Comment[ru]=ÐоказÑÐ²Ð°ÐµÑ ÑпиÑок ÑобÑÑий из ÑеÑÑÑÑов Akonadi
Comment[it]=Mostra un elenco di eventi presi dalle risorse di Akonadi
+Comment[es]=Muestra la lista de los eventos contenidos en recursos Akonadi
Icon=view-pim-tasks
Type=Service
ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_events
X-KDE-PluginInfo-Author=Gerd Fleischer
X-KDE-PluginInfo-Email=
X-KDE-PluginInfo-Name=plasma_applet_events
X-KDE-PluginInfo-Version=0.3.97
X-KDE-PluginInfo-Category=Date and Time
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
|
geflei/plasmoid-eventlist | b0a33cc72eed31288763de5e429f75eb8e1b10cf | format-text-code is not part of oxygen-icons | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index db6d107..4f3cabd 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,702 +1,702 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
#include <KTabWidget>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_eventFormatConfig(),
m_todoFormatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
#endif
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#ifdef HAS_AKONADI_PIM
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::eventMimeType()) ||
agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::todoMimeType()) ||
agentMimeTypes.contains("text/calendar")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
KTabWidget *formatTabs = new KTabWidget();
QWidget *eventFormatWidget = new QWidget();
m_eventFormatConfig.setupUi(eventFormatWidget);
m_eventFormatConfig.setupConnections();
QWidget *todoFormatWidget = new QWidget();
m_todoFormatConfig.setupUi(todoFormatWidget);
formatTabs->addTab(eventFormatWidget, i18n("Event text formatting"));
formatTabs->addTab(todoFormatWidget, i18n("Todo text formatting"));
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
- parent->addPage(formatTabs, i18n("Text Format"), "format-text-code");
+ parent->addPage(formatTabs, i18n("Text Format"), "format-text-bold");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_generalConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_generalConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_eventFormatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_eventFormatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_todoFormatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_todoFormatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
//general config
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int dateFormat = m_generalConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_generalConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
//event config
QString normalEventFormat = m_eventFormatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_eventFormatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
//todo config
QString todoFormat = m_todoFormatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_todoFormatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
m_delegate->setCategoryFormats(m_categoryFormat);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
//color config
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
|
geflei/plasmoid-eventlist | a9b7693ec269d5e0c3033df16104751afb730a19 | a bit of error handling | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index f347d83..8981fde 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,547 +1,557 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
connect(job, SIGNAL(result(KJob *)), this, SLOT(initialCollectionFetchFinished(KJob *)));
job->start();
}
void EventModel::initialCollectionFetchFinished(KJob *job)
{
- Akonadi::CollectionFetchJob *cJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
- Akonadi::Collection::List collections = cJob->collections();
- foreach (const Akonadi::Collection &collection, collections) {
- m_collections.insert(collection.id(), collection);
- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
- job->fetchScope().fetchFullPayload();
- connect(job, SIGNAL(result(KJob *)), this, SLOT(initialItemFetchFinished(KJob *)));
- job->start();
+ if (job->error()) {
+ kDebug() << "Initial collection fetch failed!";
+ } else {
+ Akonadi::CollectionFetchJob *cJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
+ Akonadi::Collection::List collections = cJob->collections();
+ foreach (const Akonadi::Collection &collection, collections) {
+ m_collections.insert(collection.id(), collection);
+ Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
+ job->fetchScope().fetchFullPayload();
+ job->fetchScope().setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
+
+ connect(job, SIGNAL(result(KJob *)), this, SLOT(initialItemFetchFinished(KJob *)));
+ job->start();
+ }
}
}
void EventModel::initialItemFetchFinished(KJob *job)
{
- Akonadi::ItemFetchJob *iJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
- Akonadi::Item::List items = iJob->items();
- foreach (const Akonadi::Item &item, items) {
- if (item.hasPayload <KCal::Event::Ptr>()) {
- KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
- if (event) {
- addEventItem(eventDetails(item, event));
- } // if event
- } else if (item.hasPayload <KCal::Todo::Ptr>()) {
- KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
- if (todo) {
- addTodoItem(todoDetails(item, todo));
- }
- } // if hasPayload
- } // foreach
+ if (job->error()) {
+ kDebug() << "Initial item fetch failed!";
+ } else {
+ Akonadi::ItemFetchJob *iJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
+ Akonadi::Item::List items = iJob->items();
+ foreach (const Akonadi::Item &item, items) {
+ if (item.hasPayload <KCal::Event::Ptr>()) {
+ KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
+ if (event) {
+ addEventItem(eventDetails(item, event));
+ } // if event
+ } else if (item.hasPayload <KCal::Todo::Ptr>()) {
+ KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
+ if (todo) {
+ addTodoItem(todoDetails(item, todo));
+ }
+ } // if hasPayload
+ } // foreach
+ }
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
m_collections.insert(collection.id(), collection);
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
n > 2000 ? data["yearsSince"] = "XX" : data["yearsSince"] = QString::number(n); // workaround missing facebook birthdays
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 33a047ed1dcb332c35a52969b98b1c3979eaabc1 | twice? | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index ba5740e..f347d83 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,542 +1,541 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
-#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
connect(job, SIGNAL(result(KJob *)), this, SLOT(initialCollectionFetchFinished(KJob *)));
job->start();
}
void EventModel::initialCollectionFetchFinished(KJob *job)
{
Akonadi::CollectionFetchJob *cJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
Akonadi::Collection::List collections = cJob->collections();
foreach (const Akonadi::Collection &collection, collections) {
m_collections.insert(collection.id(), collection);
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
job->fetchScope().fetchFullPayload();
connect(job, SIGNAL(result(KJob *)), this, SLOT(initialItemFetchFinished(KJob *)));
job->start();
}
}
void EventModel::initialItemFetchFinished(KJob *job)
{
Akonadi::ItemFetchJob *iJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
Akonadi::Item::List items = iJob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo));
}
} // if hasPayload
} // foreach
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
m_collections.insert(collection.id(), collection);
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
n > 2000 ? data["yearsSince"] = "XX" : data["yearsSince"] = QString::number(n); // workaround missing facebook birthdays
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo)
{
QMap <QString, QVariant> values;
Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
values["resource"] = itemCollection.resource();
values["resourceName"] = itemCollection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
|
geflei/plasmoid-eventlist | 9d80be7a1627a03ce9283cf0ce8ea60623e34f08 | make initial fetch asyncronous | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 3808980..ba5740e 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,536 +1,548 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
+ connect(job, SIGNAL(result(KJob *)), this, SLOT(initialCollectionFetchFinished(KJob *)));
+ job->start();
+}
- if (job->exec()) {
- Akonadi::Collection::List collections = job->collections();
- foreach (const Akonadi::Collection &collection, collections) {
- Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
- ijob->fetchScope().fetchFullPayload();
-
- if (ijob->exec()) {
- Akonadi::Item::List items = ijob->items();
- foreach (const Akonadi::Item &item, items) {
- if (item.hasPayload <KCal::Event::Ptr>()) {
- KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
- if (event) {
- addEventItem(eventDetails(item, event, collection));
- } // if event
- } else if (item.hasPayload <KCal::Todo::Ptr>()) {
- KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
- if (todo) {
- addTodoItem(todoDetails(item, todo, collection));
- }
- } // if hasPayload
- } // foreach
- }
- }
+void EventModel::initialCollectionFetchFinished(KJob *job)
+{
+ Akonadi::CollectionFetchJob *cJob = qobject_cast<Akonadi::CollectionFetchJob *>(job);
+ Akonadi::Collection::List collections = cJob->collections();
+ foreach (const Akonadi::Collection &collection, collections) {
+ m_collections.insert(collection.id(), collection);
+ Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
+ job->fetchScope().fetchFullPayload();
+ connect(job, SIGNAL(result(KJob *)), this, SLOT(initialItemFetchFinished(KJob *)));
+ job->start();
}
}
+void EventModel::initialItemFetchFinished(KJob *job)
+{
+ Akonadi::ItemFetchJob *iJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
+ Akonadi::Item::List items = iJob->items();
+ foreach (const Akonadi::Item &item, items) {
+ if (item.hasPayload <KCal::Event::Ptr>()) {
+ KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
+ if (event) {
+ addEventItem(eventDetails(item, event));
+ } // if event
+ } else if (item.hasPayload <KCal::Todo::Ptr>()) {
+ KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
+ if (todo) {
+ addTodoItem(todoDetails(item, todo));
+ }
+ } // if hasPayload
+ } // foreach
+}
+
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
+ m_collections.insert(collection.id(), collection);
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
- addEventItem(eventDetails(item, event, collection));
+ addEventItem(eventDetails(item, event));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
- addTodoItem(todoDetails(item, todo, collection));
+ addTodoItem(todoDetails(item, todo));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
n > 2000 ? data["yearsSince"] = "XX" : data["yearsSince"] = QString::number(n); // workaround missing facebook birthdays
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
-QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
+QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event)
{
QMap <QString, QVariant> values;
- values["resource"] = collection.resource();
- values["resourceName"] = collection.name();
+ Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
+ values["resource"] = itemCollection.resource();
+ values["resourceName"] = itemCollection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
- values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
+ values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
-QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
+QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo)
{
QMap <QString, QVariant> values;
- values["resource"] = collection.resource();
- values["resourceName"] = collection.name();
+ Akonadi::Collection itemCollection = m_collections.value(item.storageCollectionId());
+ values["resource"] = itemCollection.resource();
+ values["resourceName"] = itemCollection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
- values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
+ values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(itemCollection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index 1cc1340..3262c11 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,111 +1,115 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
+class KJob;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int todoColorPos = 2;
static const int finishedTodoColorPos = 3;
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(const QHash<QString, QColor>);
void setHeaderItems(QStringList headerParts);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
+ void initialCollectionFetchFinished(KJob *);
+ void initialItemFetchFinished(KJob *);
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void createHeaderItems(QStringList headerParts);
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
- QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
- QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
+ QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *);
+ QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *);
private:
QStandardItem *parentItem;
QStringList m_headerPartsList;
QMap<QDate, QStandardItem *> m_sectionItemsMap;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, todoBg, finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
+ QHash<Akonadi::Entity::Id, Akonadi::Collection> m_collections;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | 2fd19257f9c6d3bb583df855ce25eb2a36fa616a | try workaround for missing birthdays in facebook | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 7f6bceb..3808980 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,536 +1,536 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
- data["yearsSince"] = QString::number(n);
+ n > 2000 ? data["yearsSince"] = "XX" : data["yearsSince"] = QString::number(n); // workaround missing facebook birthdays
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 10dc60bd747be453da762e059f792246129b6630 | forgot to add mimetypes | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 4cdf1e3..db6d107 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,699 +1,702 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
#include <KTabWidget>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
+#include <akonadi/kcal/incidencemimetypevisitor.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_eventFormatConfig(),
m_todoFormatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
#endif
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#ifdef HAS_AKONADI_PIM
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
- if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
+ if (agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::eventMimeType()) ||
+ agentMimeTypes.contains(Akonadi::IncidenceMimeTypeVisitor::todoMimeType()) ||
+ agentMimeTypes.contains("text/calendar")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
KTabWidget *formatTabs = new KTabWidget();
QWidget *eventFormatWidget = new QWidget();
m_eventFormatConfig.setupUi(eventFormatWidget);
m_eventFormatConfig.setupConnections();
QWidget *todoFormatWidget = new QWidget();
m_todoFormatConfig.setupUi(todoFormatWidget);
formatTabs->addTab(eventFormatWidget, i18n("Event text formatting"));
formatTabs->addTab(todoFormatWidget, i18n("Todo text formatting"));
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatTabs, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_generalConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_generalConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_eventFormatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_eventFormatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_todoFormatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_todoFormatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
//general config
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int dateFormat = m_generalConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_generalConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
//event config
QString normalEventFormat = m_eventFormatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_eventFormatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
//todo config
QString todoFormat = m_todoFormatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_todoFormatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
m_delegate->setCategoryFormats(m_categoryFormat);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
//color config
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
|
geflei/plasmoid-eventlist | e86b1f6c55226c114616a5ecdc07f2a7b5abb6a5 | rework the config dialog to for netbooks too | diff --git a/src/applet/CMakeLists.txt b/src/applet/CMakeLists.txt
index addb050..6e022e5 100644
--- a/src/applet/CMakeLists.txt
+++ b/src/applet/CMakeLists.txt
@@ -1,42 +1,42 @@
project(EVENTAPPLET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(eventapplet_SRCS
eventapplet.cpp
eventmodel.cpp
eventfiltermodel.cpp
eventtreeview.cpp
eventitemdelegate.cpp
korganizerappletutil.cpp
generalconfig.cpp
formatconfig.cpp
headerdelegate.cpp
)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.korganizer.Korganizer.xml korganizer_interface)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.Korganizer.Calendar.xml calendar_interface)
-kde4_add_ui_files(eventapplet_SRCS eventappletgeneralconfig.ui eventappletformatconfig.ui eventappletcolorconfig.ui)
+kde4_add_ui_files(eventapplet_SRCS eventappletgeneralconfig.ui eventappletformatconfig.ui todoformatconfig.ui eventappletcolorconfig.ui)
kde4_add_plugin(plasma_applet_events ${eventapplet_SRCS})
set(MY_LIBRARIES
${KDE4_PLASMA_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_AKONADI_LIBS}
${KDE4_KCAL_LIBS}
${KDE4_KABC_LIBS}
${KDEPIMLIBS_AKONADI_KCAL_LIBS})
if (${KDE_VERSION} VERSION_LESS 4.5.0)
set(MY_LIBRARIES
${MY_LIBRARIES}
${KDE4_KIO_LIBS})
endif(${KDE_VERSION} VERSION_LESS 4.5.0)
target_link_libraries(plasma_applet_events ${MY_LIBRARIES})
install(TARGETS plasma_applet_events DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-events.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 41f5256..4cdf1e3 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,685 +1,699 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
+#include <KTabWidget>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
- m_formatConfig(),
+ m_eventFormatConfig(),
+ m_todoFormatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
#endif
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#ifdef HAS_AKONADI_PIM
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
- QWidget *formatWidget = new QWidget();
- m_formatConfig.setupUi(formatWidget);
- m_formatConfig.setupConnections();
+
+ KTabWidget *formatTabs = new KTabWidget();
+
+ QWidget *eventFormatWidget = new QWidget();
+ m_eventFormatConfig.setupUi(eventFormatWidget);
+ m_eventFormatConfig.setupConnections();
+ QWidget *todoFormatWidget = new QWidget();
+ m_todoFormatConfig.setupUi(todoFormatWidget);
+
+ formatTabs->addTab(eventFormatWidget, i18n("Event text formatting"));
+ formatTabs->addTab(todoFormatWidget, i18n("Todo text formatting"));
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
- parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
+ parent->addPage(formatTabs, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
+ m_generalConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
+ m_generalConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
- m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
- m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
- m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
- m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
- m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
+ m_eventFormatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
- m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
+ m_eventFormatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
+ m_todoFormatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
+ m_todoFormatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
+
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
+ //general config
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
+ int dateFormat = m_generalConfig.dateFormatBox->currentIndex();
+ cg.writeEntry("DateFormat", dateFormat);
+ QString customString = m_generalConfig.customFormatEdit->text();
+ cg.writeEntry("CustomDateFormat", customString);
- QString normalEventFormat = m_formatConfig.normalEventEdit->text();
+ //event config
+ QString normalEventFormat = m_eventFormatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
- QString todoFormat = m_formatConfig.todoEdit->text();
+ m_categoryFormat.clear();
+ QStringList keys, values;
+ QTreeWidgetItemIterator it(m_eventFormatConfig.categoryFormatWidget);
+ while (*it) {
+ m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
+ keys << (*it)->text(0);
+ values << (*it)->text(1);
+ ++it;
+ }
+ cg.writeEntry("CategoryFormatsKeys", keys);
+ cg.writeEntry("CategoryFormatsValues", values);
+
+ //todo config
+ QString todoFormat = m_todoFormatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
- QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
+ QString noDueDateFormat = m_todoFormatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
- int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
- cg.writeEntry("DateFormat", dateFormat);
- QString customString = m_formatConfig.customFormatEdit->text();
- cg.writeEntry("CustomDateFormat", customString);
+ m_delegate->setCategoryFormats(m_categoryFormat);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
+ //color config
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
- m_categoryFormat.clear();
- QStringList keys, values;
- QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
- while (*it) {
- m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
- keys << (*it)->text(0);
- values << (*it)->text(1);
- ++it;
- }
-
- cg.writeEntry("CategoryFormatsKeys", keys);
- cg.writeEntry("CategoryFormatsValues", values);
- m_delegate->setCategoryFormats(m_categoryFormat);
-
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index f73073a..4bc9815 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,119 +1,121 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
#include "generalconfig.h"
#include "formatconfig.h"
+#include "ui_todoformatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
class KDirWatch;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
void plasmaThemeChanged();
void koConfigChanged();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
KDirWatch *m_categoryColorWatch;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
Plasma::Label *title;
EventItemDelegate *m_delegate;
GeneralConfig m_generalConfig;
- FormatConfig m_formatConfig;
+ FormatConfig m_eventFormatConfig;
+ Ui::TodoFormatConfig m_todoFormatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
QStringList disabledResources, m_headerItemsList;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
};
#endif
diff --git a/src/applet/eventappletcolorconfig.ui b/src/applet/eventappletcolorconfig.ui
index 9bc4f54..869de4e 100644
--- a/src/applet/eventappletcolorconfig.ui
+++ b/src/applet/eventappletcolorconfig.ui
@@ -1,313 +1,313 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletColorConfig</class>
<widget class="QWidget" name="EventAppletColorConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
- <height>687</height>
+ <height>486</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="timeBox">
<property name="title">
<string>Times</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Urgency for normal events:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="urgencyBox">
<property name="toolTip">
<string>The time left until an event is marked as soon beginning.</string>
</property>
<property name="suffix">
<string>min</string>
</property>
<property name="maximum">
<number>280</number>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>397</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Urgency for birthdays:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KIntSpinBox" name="birthdayUrgencyBox">
<property name="toolTip">
<string>The days left until a birthday or anniversary is marked as being soon.</string>
</property>
<property name="suffix">
<string>days</string>
</property>
<property name="maximum">
<number>30</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="normalEventsBox">
<property name="title">
<string>Colors for normal events</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Backgroundcolor for near events:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="urgentColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The backgroundcolor for soon beginning events.</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="KIntSpinBox" name="urgentOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Textcolor for started or passed events:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KColorButton" name="startedColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The textcolor for already started or passed events.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Colors for todos</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Backgroundcolor for todos:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="todoColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The backgroundcolor for common todos.</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="KIntSpinBox" name="todoOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showFinishedTodos">
<property name="toolTip">
<string>Show or hide already finished todos.</string>
</property>
<property name="text">
<string>Show finished todos</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>371</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Background for finished todos:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KColorButton" name="finishedTodoButton">
<property name="toolTip">
<string>The backgroundcolor for already finished todos.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="KIntSpinBox" name="finishedTodoOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>KOrganizer colors</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="korganizerOpacity">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>93</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/eventappletformatconfig.ui b/src/applet/eventappletformatconfig.ui
index 2f1609e..f7beb3c 100644
--- a/src/applet/eventappletformatconfig.ui
+++ b/src/applet/eventappletformatconfig.ui
@@ -1,241 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletFormatConfig</class>
<widget class="QWidget" name="EventAppletFormatConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
- <height>837</height>
+ <height>380</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
- <string>Event text formatting</string>
+ <string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format for normal events:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KLineEdit" name="normalEventEdit">
<property name="toolTip">
<string>The text displayed for common events.</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="4">
<widget class="QTreeWidget" name="categoryFormatWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Category</string>
</property>
</column>
<column>
<property name="text">
<string>Format</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="addCategoryButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="copyCategoryButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="removeCategoryButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>The format for the displayed text for events.
Substitutions (mostly self-explanatory) are:
%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - start and end time,
%{summary} - summary, %{description} - description, %{location} - location, %{duration} - duration,
%{yearsSince} - years since the first time (useful for birthdays),
%{resourceName} - the i18n name of the Akonadi resource,
%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Todo text formatting</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>The format for the displayed text for todos.
-Substutions (again mostly self-explanatory) are:
-%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - start date and time,
-%{summary} - summary, %{description} - description, %{percent} - finished percent, %{location} - location,
-%{resourceName} - the i18n name of the Akonadi resource,
-%{mainCategory}, %{categories} - the first or all categories,
-%{tab} - a tabulator</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Format for todos:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="todoEdit">
- <property name="toolTip">
- <string>The text displayed for common todos.</string>
- </property>
- <property name="statusTip">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Todos with no due date:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KLineEdit" name="noDueDateEdit">
- <property name="toolTip">
- <string>The text displayed for todos with no due date.</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Date appearance settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Date format:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="dateFormatBox">
- <property name="toolTip">
- <string>What date format to use.</string>
- </property>
- <item>
- <property name="text">
- <string>KDE ShortDate</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>KDE LongDate</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Custom</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Custom format:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="customFormatEdit">
- <property name="toolTip">
- <string>A string describing the custom format. It is using the QDate syntax.</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/eventappletgeneralconfig.ui b/src/applet/eventappletgeneralconfig.ui
index c60b05a..ef7f093 100644
--- a/src/applet/eventappletgeneralconfig.ui
+++ b/src/applet/eventappletgeneralconfig.ui
@@ -1,156 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletGeneralConfig</class>
<widget class="QWidget" name="EventAppletGeneralConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>422</width>
<height>518</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Header sections</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="headerWidget">
<property name="toolTip">
<string>Add your own headers here, start is the first day of the period counting from today,
it will stretch to the next header or end of the displayed timeframe.</string>
</property>
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string>Tooltip</string>
</property>
</column>
<column>
<property name="text">
<string>Start</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="addHeaderButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeHeaderButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Miscellenous options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Period to show incidences (in days):</string>
</property>
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="periodBox">
<property name="toolTip">
<string>The time frame to show incidences.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>365</number>
</property>
<property name="value">
<number>365</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>113</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Date appearance settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Date format:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="dateFormatBox">
+ <property name="toolTip">
+ <string>What date format to use.</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>KDE ShortDate</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>KDE LongDate</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Custom format:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KLineEdit" name="customFormatEdit">
+ <property name="toolTip">
+ <string>A string describing the custom format. It is using the QDate syntax.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>186</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/todoformatconfig.ui b/src/applet/todoformatconfig.ui
new file mode 100644
index 0000000..86da299
--- /dev/null
+++ b/src/applet/todoformatconfig.ui
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TodoFormatConfig</class>
+ <widget class="QWidget" name="TodoFormatConfig">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>599</width>
+ <height>508</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>The format for the displayed text for todos.
+Substutions (again mostly self-explanatory) are:
+%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - start date and time,
+%{summary} - summary, %{description} - description, %{percent} - finished percent, %{location} - location,
+%{resourceName} - the i18n name of the Akonadi resource,
+%{mainCategory}, %{categories} - the first or all categories,
+%{tab} - a tabulator</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Format for todos:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KLineEdit" name="todoEdit">
+ <property name="toolTip">
+ <string>The text displayed for common todos.</string>
+ </property>
+ <property name="statusTip">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Todos with no due date:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="KLineEdit" name="noDueDateEdit">
+ <property name="toolTip">
+ <string>The text displayed for todos with no due date.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>329</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
|
geflei/plasmoid-eventlist | d486b20c567a4ffaf8a9d9de8c90e3a30ca7cd34 | add text/calendar mimetype to work with googledata | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 6bb2aca..7f6bceb 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,533 +1,536 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchScope scope;
QStringList mimeTypes;
- mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType() << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
+ mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType();
+ mimeTypes << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
+ mimeTypes << "text/calendar";
scope.setContentMimeTypes(mimeTypes);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
job->setFetchScope(scope);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
+ m_monitor->setMimeTypeMonitored("text/calendar", true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 7f7d1aaa94aa0bfb0aefb30876e1ec6a94bebd78 | add Aleš Nejdr | diff --git a/AUTHORS b/AUTHORS
index f5360bf..9f9bfec 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,11 +1,12 @@
- Gerd Fleischer <gerdfleischer @ web dot de>
- Javier Goday <jgoday @ gmail dot com>
Translators
russian - pfactum
ukrainian - pfactum
french - gnumdk
slovak - Karol Slanina
italian - Jacopo Ferrigno
+czech - Aleš Nejdr
german - me
|
geflei/plasmoid-eventlist | 7ddd26ccd2e935cca78fffc2efd3e820ff8de0ba | mention plasmoidviewer for testing | diff --git a/README b/README
index 4cffa79..54dbd03 100644
--- a/README
+++ b/README
@@ -1,37 +1,41 @@
To install:
To build out of the source tree
unpack the archive,
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` PATH_TO_APPLET_ROOT
make
sudo make install or su -c "make install"
+kbuildsycoca4
where PATH_TO_APPLET_ROOT is the path to the applet source (e.g. $HOME/plasmoid-eventlist-0.3.95/).
+To test the applet from a shell use
+plasmoidviewer plasma_applet_events
+
If you use kdepim 4.6 and open events/todos with rightclick does not work try
adding -DHAS_AKONADI_PIM=1 to cmake
How to setup Akonadi:
Of course you have to install the akonadiserver (openSUSE the akonadi-runtime package),
the resources are in the kdepim-runtime package where are also the config modules and utilities.
From 4.4 akonadi settings aren't anymore in systemsettings, you must use the akonaditray utility.
Create a file $HOME/.local/share/akonadi/mysql-local.conf
with the content
user=username
where username is you your username.
If you get errors in the server test like
[Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[ERROR] Cannot open mysql.db
[ERROR] Cannot open mysql.user
[ERROR] Cannot open mysql.event
Execute from a terminal with the running akonadiserver:
mysql_install_db --datadir=$HOME/.local/share/akonadi/db_data/
mysql_upgrade --socket=$HOME/.local/share/akonadi/db_misc/mysql.socket
Then stop and restart the server.
Then you can add resources.
|
geflei/plasmoid-eventlist | 34bf5bd4da7a570a9e191c8ce0e967156420effd | more detailed install information | diff --git a/README b/README
index 938fb75..4cffa79 100644
--- a/README
+++ b/README
@@ -1,32 +1,37 @@
To install:
+To build out of the source tree
+unpack the archive,
+mkdir build
cd build
-cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
+cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` PATH_TO_APPLET_ROOT
make
-sudo make install
+sudo make install or su -c "make install"
+
+where PATH_TO_APPLET_ROOT is the path to the applet source (e.g. $HOME/plasmoid-eventlist-0.3.95/).
If you use kdepim 4.6 and open events/todos with rightclick does not work try
adding -DHAS_AKONADI_PIM=1 to cmake
How to setup Akonadi:
Of course you have to install the akonadiserver (openSUSE the akonadi-runtime package),
the resources are in the kdepim-runtime package where are also the config modules and utilities.
From 4.4 akonadi settings aren't anymore in systemsettings, you must use the akonaditray utility.
Create a file $HOME/.local/share/akonadi/mysql-local.conf
with the content
user=username
where username is you your username.
If you get errors in the server test like
[Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[ERROR] Cannot open mysql.db
[ERROR] Cannot open mysql.user
[ERROR] Cannot open mysql.event
Execute from a terminal with the running akonadiserver:
mysql_install_db --datadir=$HOME/.local/share/akonadi/db_data/
mysql_upgrade --socket=$HOME/.local/share/akonadi/db_misc/mysql.socket
Then stop and restart the server.
Then you can add resources.
|
geflei/plasmoid-eventlist | ea1889768fcc3e1fdd650a1b4cb2aa5f1444811d | set collectionfetchscope only fetch collections with todos and events speed up initial fetch | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 442e82a..6bb2aca 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,525 +1,533 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
+#include <akonadi/collectionfetchscope.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
+ Akonadi::CollectionFetchScope scope;
+ QStringList mimeTypes;
+ mimeTypes << Akonadi::IncidenceMimeTypeVisitor::eventMimeType() << Akonadi::IncidenceMimeTypeVisitor::todoMimeType();
+ scope.setContentMimeTypes(mimeTypes);
+
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
+ job->setFetchScope(scope);
+
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
removeItem(item);
addItem(item, item.parentCollection());
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 9c03ab8fee2bbb5b30ea3c65d105f3332cdded70 | switch to commandline definition to build for pim 4.6 distributions will ship pim 4.4 for now, I guess | diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde7ac0..0e17ded 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,27 +1,33 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules )
# search packages used by KDE
find_package(KDE4 REQUIRED)
find_package(Akonadi REQUIRED)
find_package(KdepimLibs REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
include(MacroOptionalAddSubdirectory)
include(FindKdepimLibs)
SET (CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
ADD_DEFINITIONS (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+
+IF (HAS_AKONADI_PIM)
+ ADD_DEFINITIONS (-DHAS_AKONADI_PIM)
+ MESSAGE ("-- Compiling for KDE PIM 4.6")
+ENDIF (HAS_AKONADI_PIM)
+
INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${AKONADI_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/akonadi
${CMAKE_SOURCE_DIR}/libkdepim
${KDEPIMLIBS_INCLUDE_DIRS}
)
add_subdirectory(src/applet)
# add_subdirectory(src/dataengine)
add_subdirectory(po)
diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 2ef6f64..41f5256 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,685 +1,685 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
#endif
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
-#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
+#ifdef HAS_AKONADI_PIM
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index 5df8e68..1cc1340 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,115 +1,111 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int todoColorPos = 2;
static const int finishedTodoColorPos = 3;
-#define HAS_REAL_AKONADI_PIM_MAJOR 4
-#define HAS_REAL_AKONADI_PIM_MINOR 6
-#define HAS_REAL_AKONADI_PIM_PATCH 1
-
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(const QHash<QString, QColor>);
void setHeaderItems(QStringList headerParts);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void createHeaderItems(QStringList headerParts);
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
QStandardItem *parentItem;
QStringList m_headerPartsList;
QMap<QDate, QStandardItem *> m_sectionItemsMap;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, todoBg, finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | bae2e08581c65ce688e3078de830514e9a4bb28a | this was necessary with pim 4.5 (which is dead) | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 4ca5d5d..442e82a 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,533 +1,525 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::setHeaderItems(QStringList headerParts)
{
m_headerPartsList = headerParts;
}
void EventModel::createHeaderItems(QStringList headerParts)
{
m_sectionItemsMap.clear();
QStandardItem *olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
QStandardItem *somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
for (int i = 0; i < headerParts.size(); i += 3) {
QStandardItem *item = new QStandardItem();
initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
}
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
-#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
-#else
- Q_UNUSED(item);
-#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
-#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
-#else
- Q_UNUSED(item);
-#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->appendRow(headerItem);
parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 676aeb4268231c38ba45705eca766f7d2c263551 | fix build with 4.4 | diff --git a/src/applet/CMakeLists.txt b/src/applet/CMakeLists.txt
index 2a9aec6..addb050 100644
--- a/src/applet/CMakeLists.txt
+++ b/src/applet/CMakeLists.txt
@@ -1,33 +1,42 @@
project(EVENTAPPLET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(eventapplet_SRCS
eventapplet.cpp
eventmodel.cpp
eventfiltermodel.cpp
eventtreeview.cpp
eventitemdelegate.cpp
korganizerappletutil.cpp
generalconfig.cpp
formatconfig.cpp
headerdelegate.cpp
)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.korganizer.Korganizer.xml korganizer_interface)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.Korganizer.Calendar.xml calendar_interface)
kde4_add_ui_files(eventapplet_SRCS eventappletgeneralconfig.ui eventappletformatconfig.ui eventappletcolorconfig.ui)
kde4_add_plugin(plasma_applet_events ${eventapplet_SRCS})
-target_link_libraries(plasma_applet_events
- ${KDE4_PLASMA_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_AKONADI_LIBS}
- ${KDE4_KCAL_LIBS}
- ${KDE4_KABC_LIBS}
- ${KDEPIMLIBS_AKONADI_KCAL_LIBS})
+
+set(MY_LIBRARIES
+ ${KDE4_PLASMA_LIBS}
+ ${KDE4_KDEUI_LIBS}
+ ${KDE4_AKONADI_LIBS}
+ ${KDE4_KCAL_LIBS}
+ ${KDE4_KABC_LIBS}
+ ${KDEPIMLIBS_AKONADI_KCAL_LIBS})
+
+if (${KDE_VERSION} VERSION_LESS 4.5.0)
+set(MY_LIBRARIES
+ ${MY_LIBRARIES}
+ ${KDE4_KIO_LIBS})
+endif(${KDE_VERSION} VERSION_LESS 4.5.0)
+
+target_link_libraries(plasma_applet_events ${MY_LIBRARIES})
install(TARGETS plasma_applet_events DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-events.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 9ea255f..2ef6f64 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,683 +1,685 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
+#if KDE_IS_VERSION(4,5,0)
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
-
+#endif
+
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
QPalette p = palette();
p.setColor(QPalette::Base, baseColor);
p.setColor(QPalette::AlternateBase, altBaseColor);
p.setColor(QPalette::Button, buttonColor);
p.setColor(QPalette::Foreground, textColor);
p.setColor(QPalette::Text, textColor);
m_view->viewport()->setPalette(p);
m_view->setPalette(p);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
|
geflei/plasmoid-eventlist | a2d52ab712914ac89a0929e6bedce432b4dd1bc8 | somehow that got not translated | diff --git a/po/cs.po b/po/cs.po
index 3cb4de5..911ba49 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -1,541 +1,555 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Karol Slanina <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2010-08-07 23:48+0200\n"
"Last-Translator: Karol Slanina <[email protected]>\n"
"Language-Team: Slovak <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sk\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n"
"X-Language: cs_CZ\n"
"X-Source-Language: C\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Narozeniny"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Dnešnà udalosti"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ZÃtra"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Ãlohy na zÃtra"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Týden"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Události následujÃcÃho týdne"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Dalšà 4 týdny"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Události v následujÃcÃch 4 týdnech"
#: eventapplet.cpp:151
msgid "Later"
msgstr "PozdÄji"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Události za vÃce než 4 týdny"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "NadcházejÃcà události"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Vybrat zdroje"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "OtevÅÃt \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "PÅidat novou událost"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "PÅidat nový úkol"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Vybrat zobrazované zdroje"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "NadcházejÃcà události ze zdrojů Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formát textu"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Barvy"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Server Akonadi nebÄžÃ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "DÅÃvÄjšà položky"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "NedokonÄené úkoly, probÃhajÃcà dÅÃvÄjšà události atd."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "NÄkdy"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ãkoly bez termÃnu"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "Äasy"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "FormuláÅ"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Äasy"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorita bÄžných událostÃ:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Äas, od kterého jsou události zvýraznÄné jako blÃzké."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorita narozenin:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Äas, od ktorého sú narodeniny alebo výroÄia zvýraznené ako blÃzke."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "dnÃ"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Barva pro bÄžné události"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Barva pozadà pro blÃzké události:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Barva pozadà pro blÃzké události."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Neprůhlednost:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Barva textu pro bÄžÃcÃ, nebo uplynulé události:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Barva textu pro bÄžÃcÃ, nebo uplynulé události."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Barvy pro úkoly"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Barva pozadà pro úkoly:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Barva pozadà pro bÄžné úkoly."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Ukázat, nebo skrýt dokonÄené úkoly."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Ukázat dokonÄené úkoly"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Barva pozadà pro dokonÄené úkoly:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Barva pozadà pro dokonÄené úkoly."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formátovánà textu událostÃ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formát bežných událostÃ:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Text, který bude zobrazený pro bÄžné události."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "PozdÄji"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "FormuláÅ"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pro události.\n"
"Nahrazuje se:\n"
"%{startDate} - datum zaÄátku, %{endDate} - datum konce,\n"
"%{startTime} - Äas zaÄátku, %{endTime} - Äas konce,\n"
"%{summary} - shrnutÃ, %{description} - popis,\n"
"%{location} - mÃsto, %{duration} - trvánà v hodinách,\n"
"%{yearsSince} - poÄet roků od prvnÃho opakovanà (užiteÄné pro narozeniny),\n"
"%{resourceName} - i18n jméno Akonadi zdroje,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "Formátovánà textu úkolů"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pro úkoly.\n"
"Nahrazuje se:\n"
"%{dueDate} - termÃn (den), %{dueTime} - termÃn (Äas),\n"
"%{startDate} - datum zaÄátku, %{startTime} - Äas zaÄátku,\n"
"%{summary} - shrnutÃ, %{description} - popis,\n"
"%{percent} - postup v procentech, %{location} - mÃsto,\n"
"%{resourceName} - i18n jméno Akonadi zdroje,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "Formát úkolů:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "Text, který bude zobrazený pro bÄžné úkoly."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Ãkoly bez termÃnu:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "Text, který bude zobrazený pro úkoly bez termÃnu."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "Nastavenà zobrazenà data"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "Formát data:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Jaký formát datumu bude použitý."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "KDE krátký formát"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "KDE dlouhý formát"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "VlastnÃ"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "Vlastnà formát:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Text popisujÃcà vlastnà formát. Je tÅeba použÃt syntaxi QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "Ostatnà nastavenÃ"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "Zobrazený Äasový úsek (ve dnech):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "Pro jaký Äasový úsek budou zobrazené události."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Aleš Nejdr"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Barvy pro opakujÃcà se události"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Barva pozadà pro narozeniny:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Barva pozadà pro narozeniny."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Barva pozadà pro výroÄÃ:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Barva pozadà pro výroÄÃ."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Narozeniny a výroÄÃ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Text, který bude zobrazený pro narozeniny a výroÄÃ."
diff --git a/po/de.po b/po/de.po
index db6f35c..c6ea57d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,578 +1,592 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Gerd Fleischer <[email protected]>, 2010.
# Gerd Fleischer <[email protected]>, 2010, 2011.
msgid ""
msgstr ""
"Project-Id-Version: 0.2.4\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2011-02-25 12:08+0100\n"
"Last-Translator: Gerd Fleischer <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Geburtstag"
#: eventapplet.cpp:137
msgid "Holiday"
msgstr "Ferien"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Heute"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Termine von heute"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Morgen"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Termine von morgen"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Nächste 7 Tage"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Termine der nächsten Woche"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Nächste 4 Wochen"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Termine des nächsten Monats"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Später"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Termine später als 4 Wochen"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Anstehende Termine"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Ressourcen auswählen"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "\"%1\" öffnen"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Neuer Termin"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Neue Aufgabe"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Angezeigte Ressourcen auswählen"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Anstehende Termine von Akonadi Ressourcen"
#: eventapplet.cpp:464
msgid "General"
msgstr "Allgemein"
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Textformat"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Farben"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Der Akonadiserver läuft nicht!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Ãltere Sachen "
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Unfertige Aufgaben, noch währende Termine etc."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Irgendwann"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Aufgaben ohne festen Termin"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr "Nicht angegeben"
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
msgid "Title"
msgstr "Titel"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "Form"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Zeiten"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Dringlichkeit für normale Ereignisse:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Die Zeit ab wann ein bald beginnender Termin markiert werden soll."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Dringlichkeit für Geburtstage:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"Die Zeit ab wann ein Geburtstag oder Jahrestag als dringend markiert werden "
"soll."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "Tage"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Farben für normale Ereignisse"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Hintergrundfarbe für bald beginnende Termine:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Die Hintergrundfarbe für bald beginnende Termine."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Deckkraft:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Textfarbe für angefangene oder vergangene Termine:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Die Textfarbe für bereits angefangene oder vergangene Termine."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Farben für Aufgaben"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Hintergrundfarbe für Aufgaben:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Die Hintergrundfarbe für Aufgaben."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Unerledigte Aufgaben anzeigen oder verstecken."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Erledigte Aufgaben anzeigen"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Hintergrundfarbe für erledigte Aufgaben:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Die Hintergrundfarbe für erledigte Aufgaben."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr "KOrganizer Farben"
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Ereigniss Textformatierung"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Format für normale Ereignisse:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Der Text der für normale Ereignisse angezeigt wird."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "Später"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "Form"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr "Hinzufügen"
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr "Kopieren"
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr "Löschen"
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Das Format für den angezeigten Text für die Ereignisse.\n"
"Platzhalter (gröÃtenteils selbsterklärend):\n"
"%{startDate}, %{endDate} - Start - und Enddatum, %{startTime}, %{endTime} - "
"Start - und Endzeit,\n"
"%{summary} - Zusammenfassung, %{description} - Beschreibung, %{location} - "
"Ort, %{duration} - Dauer,\n"
"%{yearsSince} - Jahre seit dem ersten Stattfinden (nützlich für "
"Geburtstage),\n"
"%{resourceName} - der i18n Name der Akonadi Ressource,\n"
"%{mainCategory}, %{categories} - die erste oder alle Kategorien,\n"
"%{tab} - ein Tabulator"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "Aufgaben Textformatierung"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Das Format für den angezeigten Text für Aufgaben.\n"
"Als Platzhalter (auch gröÃtenteils selbsterklärend):\n"
-"%{dueDate}, %{dueTime} - Fälligkeitsdatum und -zeit, %{startDate}, "
-"%{startTime} - Startdatum und -zeit,\n"
+"%{dueDate}, %{dueTime} - Fälligkeitsdatum und -zeit, %{startDate}, %"
+"{startTime} - Startdatum und -zeit,\n"
"%{summary} - Zusammenfassung, %{description} - Beschreibung, %{percent} - "
"erledigter Anteil, %{location} - Ort,\n"
"%{resourceName} - der i18n Name der Akonadi Ressource,\n"
"%{mainCategory}, %{categories} - die erste oder alle Kategorien,\n"
"%{tab} - ein Tabulator"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "Format für Aufgaben:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "Der Text der für Aufgaben angezeigt wird."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Aufgaben ohne festen Termin:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "Der Text der für Aufgaben ohne festen Termin angezeigt wird."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "Einstellung für die Datumsanzeige"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "Datumsformat:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Verwendetes Datumsformat."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "KDE Kurzes Datum"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "KDE Langes Datum"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "Benutzerdefiniert"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "Benutzerdefiniertes Format:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Eine Zeichenfolge für das benutzerdefinierte Format. Es wird die QDate "
"Syntax verwendet."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr "Zeiträume"
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
"Hier können eigene Zeiträume definiert werden, Anfang ist der erste Tag, von "
"heute an gezählt,\n"
"ersteckt sich bis zum Beginn des nächsten oder zum Ende des angezeigten "
"gesamten Zeitraums."
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr "Tooltip"
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr "Anfang"
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "Verschiedene Optionen"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "Angezeigter Zeitraum (in Tagen):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "Für welchen Zeitraum Ereignisse angezeigt werden sollen."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Gerd Fleischer"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Farben für wiederkehrende Termine"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Hintergrundfarbe für Geburtstage:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Die Hintergrundfarbe für Geburtstage."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Hintergrundfarbe für Jahrestage:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Die Hintergrundfarbe für Jahrestage."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Geburtstage & Jahrestage:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Der Text der für Geburtstage und Jahrestage angezeigt wird."
#~ msgid "Open event"
#~ msgstr "Termin öffnen"
#~ msgid "Open todo"
#~ msgstr "Aufgabe öffnen"
#~ msgid "Urgency:"
#~ msgstr "Dringlichkeit:"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 Versuche eine Verbindung zum Akonadiserver herzustellen"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Konnte keine Verbindung zum Akonadiserver herstellen"
#~ msgid "Events after the next month"
#~ msgstr "Termine nach dem nächsten Monat"
#~ msgid "Use colors"
#~ msgstr "Benutze Farben"
#~ msgid "Checkintervall:"
#~ msgstr "Ãberprüfungsintervall:"
#~ msgid "How often the items are checked for urgency or already started."
#~ msgstr ""
#~ "Abstand wie oft Items auf baldiges Beginnen oder bereits angefangen "
#~ "überprüft werden."
diff --git a/po/eventapplet.pot b/po/eventapplet.pot
index 7fa28c5..fc8118a 100644
--- a/po/eventapplet.pot
+++ b/po/eventapplet.pot
@@ -1,498 +1,510 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr ""
#: eventapplet.cpp:137
msgid "Holiday"
msgstr ""
#: eventapplet.cpp:147
msgid "Today"
msgstr ""
#: eventapplet.cpp:147
msgid "Events of today"
msgstr ""
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr ""
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr ""
#: eventapplet.cpp:149
msgid "Week"
msgstr ""
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr ""
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr ""
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr ""
#: eventapplet.cpp:151
msgid "Later"
msgstr ""
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr ""
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr ""
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr ""
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr ""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr ""
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr ""
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr ""
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr ""
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr ""
#: eventapplet.cpp:466
msgid "Colors"
msgstr ""
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr ""
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr ""
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr ""
#: eventmodel.cpp:178
msgid "Some day"
msgstr ""
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr ""
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
msgid "Title"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr ""
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+msgid "Category"
+msgstr ""
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+msgid "Format"
+msgstr ""
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr ""
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr ""
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 7f8f8f0..297ac59 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,556 +1,570 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Cédric Bellegarde <[email protected]>, 2010.
# Gerd Fleischer <[email protected]>, 2011.
# Cédric Bellegarde <[email protected]>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2011-02-07 09:13+0100\n"
"Last-Translator: Cédric Bellegarde <[email protected]>\n"
"Language-Team: French <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Anniversaires"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Aujourd'hui"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Aujourd'hui"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Evénements pour aujourd'hui"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Demain"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Evénement pour demain"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Semaine à venir"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Evénements pour la semaine prochaine"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Quatre prochaines semaines"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Evénements pour les quatre prochaines semaines"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Plus tard"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Evénements dans plus de 4 semaines"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Evénements à venir"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Sélectionner les ressources"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Ouvrir \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Ajouter un événement"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Ajouter une nouvelle tâche"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Ressources à afficher"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Evénements à venirs (ressources Akonadi)"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Format du texte"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Couleurs"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Le serveur Akonadi ne fonctionne pas!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Evénements précédents"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Tâches non terminées, événements passés encore en cours à venir etc"
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Un jour ou l'autre"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Tâches sans date de fin"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "Heure"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "Formulaire"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Heure"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorité des événement normaux:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorité pour les anniversaires:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "jours"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Couleur des événement normaux"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Couleur de fond pour les événements proches"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Couleur de fond pour les événements débutant prochainnement"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Opacité:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "La couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Couleur des tâches"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Couleur de fond pour les tâches:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "La couleur de fond pour les tâches."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Montrer ou cacher les tâches terminées"
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Montrer les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Couleur de fond pour les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "La couleur de fond des des tâches déjà terminées."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Format des événements"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Format des événement normaux:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Texte affiché des événements normaux"
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "Plus tard"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "Formulaire"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Format du texte des événements.\n"
"Les substitutions sont:\n"
"%{startDate} - Date de départ, %{endDate} - Date de fin,\n"
"%{startTime} - Heure de départ, %{endTime} - Heure de fin,\n"
"%{summary} - Résumé, %{description} - Description,\n"
"%{location} - Emplacement, %{duration} - Durée en, heure,\n"
"%{yearsSince} - Années depuis la première fois (utile pour les "
"anniversaires),\n"
"%{resourceName} - Le nom de la ressource Akonadi,\n"
"%{tab} - Tabulation"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "Format des tâches"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Le format pour le texte des tâches à faire:\n"
"Les substitutions sont:\n"
"%{dueDate} - la date de fin, %{dueTime} - l'heure de fin,\n"
"%{startDate} - la date de départ, %{startTime} - l'heure de départ,\n"
"%{summary} - le résumé, %{description} - la description,\n"
"%{percent} - pourcentage accompli, %{location} - emplacement,\n"
"%{resourceName} - le nom de la ressource Akonadi,\n"
"%{tab} - une tabulation"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "Format des tâches:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "Texte affiché pour les tâches"
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "Texte affiché pour les tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "Apparance des dates"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "Format des dates:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Quel format de date utilisé"
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "Dates KDE courtes"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "Dates KDE longues"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "Personnalisé"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "Format personnalisé:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Une chaîne décrivant le format personnalisé (utilisation de la syntaxe QDate)"
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "Options diverses"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "Durée d'affichage d'un événement (en jours):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "Intervalle de temps pour l'affichage"
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Lannehoa Yves"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Couleur pour les événements récurrents"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Couleur de fond pour les anniversaires:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "La couleur de fond pour les anniversaires."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Couleur de fond des commémorations:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "La couleur de fond des commémorations."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Anniversaires et commémorations:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Texte affiché pour les commémorations"
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Ouvrir l'événement courant"
#~ msgid "Urgency:"
#~ msgstr "Urgence"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 essais de connexion au serveur Akonadi"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Ne peut se connecter au serveur Akonadi"
diff --git a/po/it.po b/po/it.po
index 97c61f4..ca9d30f 100644
--- a/po/it.po
+++ b/po/it.po
@@ -1,558 +1,572 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Cédric Bellegarde <[email protected]>, 2010.
# jacopo, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2010-09-28 21:15+0200\n"
"Last-Translator: jacopo\n"
"Language-Team: French <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Compleanno"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Oggi"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Oggi"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Eventi di oggi"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Domani"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Eventi di domani"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Settimana"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Eventi della prossima settimana "
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Prossime 4 settimane"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Eventi delle prossime 4 settimane"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Più tardi"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Eventi oltre le 4 settimane"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Prossimi eventi"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Seleziona la risorsa"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Apri \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Aggiungi un nuovo evento "
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Aggiungi una nuova cosa-da-fare"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Risorse per la visualizzazione"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Prossimi eventi (risorse di Akonadi)"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formato del testo "
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Colori"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Il server Akonadi non è in esecuzione!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "In svolgimento"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Cose-da-fare non terminate, eventi ancora in svolgimento, ecc."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Alcuni giorni"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Cose-da-fare senza scadenza"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "Tempi"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "Form"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Tempi"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Tempo di preavviso per gli eventi normali:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Quanti ore prima un evento e' impostato come se stesse per iniziare."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Tempo di preavviso per i compleanni:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"Quanti giorni prima un compleanno od un anniversario e' impostato come se "
"stesse per iniziare."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "giorni"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Colore per gli eventi normali"
# da controllare
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Colore di sfondo per gli eventi prossimi:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Colore di fondo per gli eventi che stano per iniziare"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Trasparenza:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Colore del testo per gli eventi iniziati o finiti:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Colore del testo per gli eventi iniziati o finiti:"
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Colore per le cose-da-fare"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Colore di fondo per le cose-da-fare"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Colore di sfondo per le code-da-fare normali."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Mostra/nascondi le cose-da-fare terminate."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Mostra le cose-da-fare terminate:"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Sfondo per le cose-da-fare terminate:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Sfondo per le cose-da-fare terminate."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formato del testo degli eventi"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formato per gli eventi normali:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Il testo mostrato per gli eventi comuni."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "Più tardi"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "Form"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Il formato del testo per gli eventi mostrati.\n"
"I segnaposto sono:\n"
"%{startDate} - data d'inizio, %{endDate} - data di termine,\n"
"%{startTime} - ora d'inizio, %{endTime} - ora di termine,\n"
"%{summary} - sommario, %{description} - descrizione,\n"
"%{location} - luogo, %{duration} - durata (in ore),\n"
"%{yearsSince} - anni passati dalla prima volta (utile per i compleanni),\n"
"%{resourceName} - il i18n nome della risorsa di Akonadi ,\n"
"%{tab} - carattere di tabulazione"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "Formato del testo per le cose-da-fare"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Il formato del testo per le cose-da-fare mostrate.\n"
"I segnaposto sono:\n"
"%{dueDate} - data di scadenza , %{dueTime} - ora di scadenza,\n"
"%{startDate} - data d'inizio, %{endDate} - data di termine,\n"
"%{summary} - sommario, %{description} - descrizione,\n"
"%{percent} - percentuale di completamento, %{location} - luogo\n"
"%{resourceName} - il i18n nome della risorsa di Akonadi ,\n"
"%{tab} - carattere di tabulazione"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "Formato delle cose-da-fare:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "Testo mostrato per le cose-da-fare normali."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Cose-da-fare senza scadenza:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "Testo mostrato per le cose-da-fare senza scadenza:"
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "Formato della data"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "Formato della data:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Quale formato usare per la data."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "Date corte di KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "Date Lunghe di KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "Personalizzato "
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "Formato personalizzato:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Una stringa che descriva il formato personalizzato( secondo la sintassi di "
"QDate)"
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "Opzioni varie"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "Periodo di tempo per cui mostrare evento (in giorni):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "Arco di tempo in cui mostrare un evento."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Jacopo Ferrigno"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Colore per gli eventi ricorrenti"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Colore di fondo per i Compleanni:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Colore di fondo per i compleanni:"
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Colore di fondo per gli Anniversari:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Colore di fondo per gli anniversari:"
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Compleanni ed anniversari:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Testo mostrato per compleanni o anniversari"
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Ouvrir l'événement courant"
#~ msgid "Urgency:"
#~ msgstr "Urgence"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 essais de connexion au serveur Akonadi"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Ne peut se connecter au serveur Akonadi"
diff --git a/po/ru.po b/po/ru.po
index be178b7..400443e 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -1,553 +1,567 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Oleksandr Natalenko <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2010-09-26 23:55+0300\n"
"Last-Translator: Oleksandr Natalenko <[email protected]>\n"
"Language-Team: Ukrainian <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "ÐÐµÐ½Ñ ÑождениÑÐÐµÐ½Ñ ÑождениÑ"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "СегоднÑ"
#: eventapplet.cpp:147
msgid "Today"
msgstr "СегоднÑ"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "СобÑÑÐ¸Ñ ÑегоднÑ"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ÐавÑÑа"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "СобÑÑÐ¸Ñ Ð·Ð°Ð²ÑÑа"
#: eventapplet.cpp:149
msgid "Week"
msgstr "ÐеделÑ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "СобÑÑÐ¸Ñ ÑледÑÑÑей недели"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "СледÑÑÑие 4 недели"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "СобÑÑÐ¸Ñ ÑледÑÑÑиÑ
4 неделÑ"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Ðозднее"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "СобÑÑиÑ, коÑоÑÑе пÑоизойдÑÑ Ð¿Ð¾Ð·Ð´Ð½ÐµÐµ, Ñем ÑеÑез 4 недели"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "ÐлижайÑие ÑобÑÑиÑ"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "ÐÑбÑаÑÑ ÑеÑÑÑÑÑ"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "ÐÑкÑÑÑÑ Â«%1»"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "ÐобавиÑÑ Ð½Ð¾Ð²Ð¾Ðµ ÑобÑÑие"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "ÐобавиÑÑ Ð½Ð¾Ð²Ð¾Ðµ дело"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "ÐоказаÑÑ Ð²ÑбÑаннÑе ÑеÑÑÑÑÑ"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "ÐлижайÑие ÑобÑÑÐ¸Ñ Ñ ÑеÑÑÑÑов Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑа"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "ЦвеÑа"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "СеÑÐ²ÐµÑ Akonadi не ÑабоÑаеÑ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "РанÑÑе"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "ÐезаконÑеннÑе дела, ÑобÑÑиÑ, коÑоÑÑе еÑÑ Ð¿ÑоиÑÑ
одÑÑ Ð¸ Ñ. д."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "ÐекоÑоÑÑй денÑ"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ðела без даÑÑ Ð²ÑполнениÑ"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "ÐÑемÑ"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "ФоÑма"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "ÐÑемÑ"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "СÑоÑноÑÑÑ Ð½Ð¾ÑмалÑнÑÑ
ÑобÑÑий:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr ""
"ÐÑемÑ, коÑоÑое оÑÑалоÑÑ Ð´Ð¾ обознаÑÐµÐ½Ð¸Ñ ÑобÑÑÐ¸Ñ Ñаким, коÑоÑое ÑкоÑо "
"наÑинаеÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "мин"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "СÑоÑноÑÑÑ Ð´Ð½ÐµÐ¹ ÑождениÑ:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"ÐÑемÑ, коÑоÑое оÑÑалоÑÑ Ð´Ð¾ обознаÑÐµÐ½Ð¸Ñ Ð´Ð½Ñ ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ годовÑÐ¸Ð½Ñ Ñакой, "
"коÑоÑÐ°Ñ ÑкоÑо наÑинаеÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "дней"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "ЦвеÑа ноÑмалÑнÑÑ
ÑобÑÑий"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð±Ð»Ð¸Ð¶Ð°Ð¹ÑиÑ
ÑобÑÑий:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "ФоновÑй ÑÐ²ÐµÑ ÑобÑÑий, коÑоÑÑе ÑкоÑо наÑнÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "ÐÑозÑаÑноÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Ð¦Ð²ÐµÑ ÑекÑÑа Ð´Ð»Ñ Ð¿ÑопÑÑеннÑÑ
ÑобÑÑий или ÑобÑÑий, коÑоÑÑе наÑалиÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Ð¦Ð²ÐµÑ ÑекÑÑа Ð´Ð»Ñ Ð¿ÑопÑÑеннÑÑ
ÑобÑÑий или ÑобÑÑий, коÑоÑÑе Ñже наÑалиÑÑ."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "ЦвеÑа Ð´Ð»Ñ Ð´ÐµÐ»"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð»Ñ Ð´ÐµÐ»:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
дел."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "ÐоказаÑÑ Ð¸Ð»Ð¸ ÑпÑÑÑаÑÑ Ñже завеÑÑÑннÑе дела."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "ÐоказаÑÑ Ð·Ð°Ð²ÐµÑÑÑннÑе дела"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð·Ð°Ð²ÐµÑÑÑннÑÑ
дел:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "ФоновÑй ÑÐ²ÐµÑ Ñже завеÑÑÑннÑÑ
дел."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "ФоÑмаÑиÑование ÑвеÑа ÑобÑÑиÑ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "ФоÑÐ¼Ð°Ñ Ð½Ð¾ÑмалÑнÑÑ
ÑобÑÑий:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
ÑобÑÑий."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "Ðозднее"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "ФоÑма"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑа ÑобÑÑий.\n"
"ÐодÑÑановками ÑвлÑÑÑÑÑ:\n"
"%{startDate} â даÑа наÑала, %{endDate} â даÑа оконÑаниÑ,\n"
"%{startTime} â вÑÐµÐ¼Ñ Ð½Ð°Ñала, %{endTime} â вÑÐµÐ¼Ñ Ð¾ÐºÐ¾Ð½ÑаниÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑание,\n"
"%{location} â ÑазмеÑение, %{duration} â длиÑелÑноÑÑÑ Ð² ÑаÑаÑ
,\n"
"%{yearsSince} â леÑ, наÑÐ¸Ð½Ð°Ñ Ñ Ð¿ÐµÑвого Ñаза (полезно Ð´Ð»Ñ Ð´Ð½ÐµÐ¹ ÑождениÑ),\n"
"%{resourceName} â инÑеÑнаÑионализиÑованное название ÑеÑÑÑÑа Akonadi,\n"
"%{tab} - ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑа дел"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑа дел.\n"
"ÐодÑÑановками ÑвлÑÑÑÑÑ:\n"
"%{dueDate} â даÑа оконÑаниÑ, %{dueTime} â вÑÐµÐ¼Ñ Ð¾ÐºÐ¾Ð½ÑаниÑ,\n"
"%{startDate} â даÑа наÑала, %{startTime} â вÑÐµÐ¼Ñ Ð½Ð°Ñала,\n"
"%{summary} â ÑезÑме, %{description} â опиÑание,\n"
"%{percent} â пÑоÑÐµÐ½Ñ Ð·Ð°Ð²ÐµÑÑениÑ, %{location} â ÑаÑположение,\n"
"%{resourceName} â инÑеÑнаÑионализиÑованное Ð¸Ð¼Ñ ÑеÑÑÑÑп Akonadi,\n"
"%{tab} â ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ Ð´ÐµÐ»:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
дел."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Ðела без даÑÑ Ð·Ð°Ð²ÐµÑÑениÑ:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð´ÐµÐ» без даÑÑ Ð·Ð°Ð²ÐµÑÑениÑ."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "ÐаÑÑÑойки даÑÑ"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð°ÑÑ:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Ðакой ÑоÑÐ¼Ð°Ñ Ð´Ð¾ÑÑ Ð¸ÑполÑзоваÑÑ."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "ÐÑаÑÐºÐ°Ñ Ð´Ð°Ñа KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "ÐÐ»Ð¸Ð½Ð½Ð°Ñ Ð´Ð°Ñа KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "СобÑÑвеннÑй"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "СобÑÑвеннÑй ÑоÑмаÑ:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "СÑÑока, опиÑÑваÑÑÐ°Ñ ÑобÑÑвеннÑй ÑоÑмаÑ. ÐÑполÑзÑеÑÑÑ ÑинÑакÑÐ¸Ñ QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "ÐополниÑелÑнÑе наÑÑÑойки"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "ÐеÑиод показа ÑобÑÑий (в днÑÑ
):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "ÐÑеменной ÐºÐ°Ð´Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° ÑобÑÑий."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Oleksandr Natalenko"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "ЦвеÑа повÑоÑÑÑÑиÑ
ÑÑ ÑобÑÑий"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð½ÐµÐ¹ ÑождениÑ:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð½ÐµÐ¹ ÑождениÑ."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð³Ð¾Ð´Ð¾Ð²Ñин:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð³Ð¾Ð´Ð¾Ð²Ñин."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Ðни ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸ годовÑинÑ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð´Ð½ÐµÐ¹ ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ годовÑин."
#~ msgid "Open event"
#~ msgstr "ÐÑкÑÑÑÑ ÑобÑÑие"
#~ msgid "Open todo"
#~ msgstr "ÐÑкÑÑÑÑ Ð´ÐµÐ»Ð¾"
#~ msgid "Urgency:"
#~ msgstr "ТеÑмÑновÑÑÑÑ:"
diff --git a/po/sk.po b/po/sk.po
index ce445d5..0cbf5e2 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -1,552 +1,566 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Karol Slanina <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2010-08-07 23:48+0200\n"
"Last-Translator: Karol Slanina <[email protected]>\n"
"Language-Team: Slovak <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sk\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr ""
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Dnešné udalosti"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Zajtra"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Ãlohy na zajtra"
#: eventapplet.cpp:149
msgid "Week"
msgstr "TýždeÅ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Udalosti nasledujúceho týždÅa"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "ÄalÅ¡ie 4 týždne"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Udalosti nasledujúcich 4 týždÅov"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Neskôr"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Udalosti neskôr než o 4 týždne"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Prichádzajúce udalosti"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Vybrať zdroje"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Otvoriť \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Pridať novú udalosť"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Pridať novú úlohu"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Vybrať zobrazované zdroje"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Prichádzajúce udalosti zo zdrojov Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formát textu"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Farby"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Akonadi server nebežÃ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Skoršie položky"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "NedokonÄené úlohy, prebiehajúce skorÅ¡ie udalosti atÄ."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Niekedy"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ãlohy bez termÃnu"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "Äasy:"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "Formulár"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Äasy:"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorita bežných udalostÃ:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Äas, od ktorého sú udalosti zvýraznené ako blÃzke"
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorita narodenÃn:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Äas, od ktorého sú narodeniny alebo výroÄia zvýraznené ako blÃzke"
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "dnÃ"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Farba pre bežné udalosti"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Farba pozadia pre blÃzke udalosti:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Farba pozadia pre blÃzke udalosti."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Nepriehľadnosť:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Farba textu pre bežiace alebo uplynulé udalosti:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Farba textu pre bežiace alebo uplynulé udalosti."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Farby pre úlohy"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Farba pozadia pre úlohy:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Farba pozadia pre bežné úlohy."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "UkázaÅ¥ alebo skryÅ¥ ukonÄené úlohy."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "UkázaÅ¥ ukonÄené úlohy"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Farba pozadia pre ukonÄené úlohy:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Farba pozadia pre ukonÄené úlohy."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formátovanie textu udalostÃ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formát bežných udalostÃ:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Text, ktorý bude zobrazený pre bežné udalosti."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "Neskôr"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "Formulár"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pre udalosti.\n"
"Nahradzuje sa:\n"
"%{startDate} - dátum zaÄiatku, %{endDate} - dátum konca,\n"
"%{startTime} - Äas zaÄiatku, %{endTime} - Äas konca,\n"
"%{summary} - zhrnutie, %{description} - popis,\n"
"%{location} - miesto, %{duration} - trvanie v hodinách,\n"
"%{yearsSince} - poÄet rokov od prvého opakovania (užitoÄné pre narodeniny),\n"
"%{resourceName} - i18n meno Akonadi zdroja,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "Formátovanie textu úloh"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pre úlohy.\n"
"Nahradzuje sa:\n"
"%{dueDate} - termÃn (deÅ), %{dueTime} - termÃn (Äas),\n"
"%{startDate} - dátum zaÄiatku, %{startTime} - Äas zaÄiatku,\n"
"%{summary} - zhrnutie, %{description} - popis,\n"
"%{percent} - postup v percentách, %{location} - miesto,\n"
"%{resourceName} - i18n meno Akonadi zdroja,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "Formát úloh:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "Text, ktorý bude zobrazený pre bežné úlohy."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "Ãlohy bez termÃnu:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "Text, ktorý bude zobrazený pre úlohy bez termÃnu."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "Nastavenie zobrazenia dátumu"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "Formát dátumu:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Aký formát dátumu bude použitý"
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "KDE krátky formát"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "KDE dlhý formát"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "Vlastný"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "Vlastný formát:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Text popisujúci vlastný formát. Treba použiť syntax QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "Ostatné nastavenia"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "Zobrazený Äasový úsek (v dÅoch):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "Pre aký Äasový úsek budú zobrazené udalosti."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Karol Slanina"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Farby pre opakujúce sa udalosti"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Farba pozadia pre narodeniny:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Farba pozadia pre narodeniny."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Farba pozadia pre výroÄia:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Farba pozadia pre výroÄia."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Narodeniny a výroÄia:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Text, ktorý bude zobrazený pre narodeniny a výroÄia."
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Otvoriť aktuálnu udalosť"
#~ msgid "Urgency:"
#~ msgstr "Upozornenie:"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1. pokus naštartovať/pripojiť sa na Akonadi server"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Nemôžem sa pripojiť na Akonadi server"
diff --git a/po/uk.po b/po/uk.po
index acf6b7d..787ec95 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -1,552 +1,566 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Oleksandr Natalenko <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 12:02+0100\n"
+"POT-Creation-Date: 2011-02-25 12:16+0100\n"
"PO-Revision-Date: 2010-09-26 23:56+0300\n"
"Last-Translator: Oleksandr Natalenko <[email protected]>\n"
"Language-Team: Ukrainian <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "ÐÐµÐ½Ñ Ð½Ð°ÑодженнÑ"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "СÑогоднÑ"
#: eventapplet.cpp:147
msgid "Today"
msgstr "СÑогоднÑ"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "СÑогоднÑÑÐ½Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ÐавÑÑа"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "ÐавÑÑаÑÐ½Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:149
msgid "Week"
msgstr "ТижденÑ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "ÐодÑÑ Ð½Ð°ÑÑÑпного ÑижнÑ"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "ÐаÑÑÑÐ¿Ð½Ñ 4 ÑижнÑ"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "ÐодÑÑ Ð½Ð°ÑÑÑпниÑ
4 ÑижнÑв"
#: eventapplet.cpp:151
msgid "Later"
msgstr "ÐÑзнÑÑе"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "ÐодÑÑ, ÑÐºÑ Ð²ÑдбÑдÑÑÑÑÑ Ð¿ÑзнÑÑе, нÑж ÑеÑез 4 ÑижнÑ"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "ÐайближÑÑ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "ÐбÑаÑи ÑеÑÑÑÑи"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "ÐÑдкÑиÑи «%1»"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "ÐодаÑи Ð½Ð¾Ð²Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "ÐодаÑи Ð½Ð¾Ð²Ñ ÑпÑавÑ"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "ÐбÑаÑи Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ñ ÑеÑÑÑÑи"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "ÐайближÑÑ Ð¿Ð¾Ð´ÑÑ Ñз ÑеÑÑÑÑÑв Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑÑ"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "ÐолÑоÑи"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "СеÑÐ²ÐµÑ Akonadi не пÑаÑÑÑ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "РанÑÑе"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "ÐезавеÑÑÐµÐ½Ñ ÑпÑави, подÑÑ, ÑÐºÑ Ñе вÑдбÑваÑÑÑÑÑ Ñ Ñ. д."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "ЯкийÑÑ Ð´ÐµÐ½Ñ"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "СпÑави без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: generalconfig.cpp:49 rc.cpp:187
+#: generalconfig.cpp:49 rc.cpp:191
#, fuzzy
msgid "Title"
msgstr "ЧаÑ"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
-#: rc.cpp:3 rc.cpp:94 rc.cpp:177
+#: rc.cpp:3 rc.cpp:94 rc.cpp:181
msgid "Form"
msgstr "ФоÑма"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "ЧаÑ"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "ТеÑмÑновÑÑÑÑ Ð½Ð¾ÑмалÑниÑ
подÑй:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "ЧаÑ, Ñо лиÑивÑÑ Ð´Ð¾ познаÑÐµÐ½Ð½Ñ Ð¿Ð¾Ð´ÑÑ ÑакоÑ, Ñка ÑкоÑо поÑинаÑÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "Ñ
в"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "ТеÑмÑновÑÑÑÑ Ð´Ð½Ñв наÑодженÑ:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"ЧаÑ, Ñо лиÑивÑÑ Ð´Ð¾ познаÑÐµÐ½Ð½Ñ Ð´Ð½Ñ Ð½Ð°ÑÐ¾Ð´Ð¶ÐµÐ½Ð½Ñ Ð°Ð±Ð¾ ÑÑÑниÑÑ ÑакоÑ, Ñка ÑкоÑо "
"поÑнеÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "днÑв"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "ÐолÑоÑи ноÑмалÑниÑ
подÑй"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Фоновий колÑÑ Ð½Ð°Ð¹Ð±Ð»Ð¸Ð¶ÑиÑ
подÑй:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Фоновий колÑÑ Ð¿Ð¾Ð´Ñй, ÑÐºÑ ÑкоÑо поÑнÑÑÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "ÐÑозоÑÑÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "ÐолÑÑ ÑекÑÑÑ Ð´Ð»Ñ Ð¿ÑопÑÑениÑ
подÑй Ñи подÑй, ÑÐºÑ ÑозпоÑалиÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "ÐолÑÑ ÑекÑÑÑ Ð´Ð»Ñ Ð¿ÑопÑÑениÑ
подÑй Ñи подÑй, ÑÐºÑ Ñже ÑозпоÑалиÑÑ."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "ÐолÑÑ Ð´Ð»Ñ ÑпÑав"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑпÑав:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Фоновий колÑÑ Ð·Ð°Ð³Ð°Ð»ÑниÑ
ÑпÑав."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "ÐоказаÑи Ñи ÑÑ
оваÑи вже зÑÐ¾Ð±Ð»ÐµÐ½Ñ ÑпÑави."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "ÐоказаÑи зÑÐ¾Ð±Ð»ÐµÐ½Ñ ÑпÑави"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Фоновий колÑÑ Ð´Ð»Ñ Ð·Ð°Ð²ÐµÑÑениÑ
ÑпÑав:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Фоновий колÑÑ Ñже зÑоблениÑ
ÑпÑав."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "ФоÑмаÑÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ Ð¿Ð¾Ð´ÑÑ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "ФоÑÐ¼Ð°Ñ Ð½Ð¾ÑмалÑниÑ
подÑй:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð·Ð°Ð³Ð°Ð»ÑниÑ
подÑй."
+#. i18n: file: eventappletformatconfig.ui:59
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:106
+#, fuzzy
+msgid "Category"
+msgstr "ÐÑзнÑÑе"
+
+#. i18n: file: eventappletformatconfig.ui:64
+#. i18n: ectx: property (text), widget (QTreeWidget, categoryFormatWidget)
+#: rc.cpp:109
+#, fuzzy
+msgid "Format"
+msgstr "ФоÑма"
+
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
-#: rc.cpp:108 rc.cpp:196
+#: rc.cpp:112 rc.cpp:200
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
-#: rc.cpp:111
+#: rc.cpp:115
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
-#: rc.cpp:114 rc.cpp:199
+#: rc.cpp:118 rc.cpp:203
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
-#: rc.cpp:118
+#: rc.cpp:122
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
"start and end time,\n"
"%{summary} - summary, %{description} - description, %{location} - location, %"
"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑÑ Ð¿Ð¾Ð´Ñй.\n"
"ÐÑдÑÑановками Ñ:\n"
"%{startDate} â даÑа поÑаÑкÑ, %{endDate} â даÑа закÑнÑеннÑ,\n"
"%{startTime} â ÑÐ°Ñ Ð¿Ð¾ÑаÑкÑ, %{endTime} â ÑÐ°Ñ Ð·Ð°ÐºÑнÑеннÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑ,\n"
"%{location} â ÑозÑаÑÑваннÑ, %{duration} â ÑÑивалÑÑÑÑ Ñ Ð³Ð¾Ð´Ð¸Ð½Ð°Ñ
,\n"
"%{yearsSince} â ÑокÑв, поÑинаÑÑи Ñз пеÑÑого ÑÐ°Ð·Ñ (коÑиÑно Ð´Ð»Ñ Ð´Ð½Ñв "
"наÑодженÑ),\n"
"%{resourceName} â ÑнÑеÑнаÑÑоналÑзована назва ÑеÑÑÑÑÑ Akonadi,\n"
"%{tab} - ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
-#: rc.cpp:128
+#: rc.cpp:132
msgid "Todo text formatting"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑÑ ÑпÑав"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
-#: rc.cpp:132
+#: rc.cpp:136
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
"start date and time,\n"
"%{summary} - summary, %{description} - description, %{percent} - finished "
"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ ÑекÑÑÑ ÑпÑав.\n"
"ÐÑдÑÑановками Ñ:\n"
"%{dueDate} â даÑа виконаннÑ, %{dueTime} â ÑÐ°Ñ Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ,\n"
"%{startDate} â даÑа поÑаÑкÑ, %{startTime} â ÑÐ°Ñ Ð¿Ð¾ÑаÑкÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑ,\n"
"%{percent} â вÑдÑоÑок завеÑÑеннÑ, %{location} â ÑозмÑÑеннÑ,\n"
"%{resourceName} â ÑнÑеÑнаÑÑоналÑзована назва ÑеÑÑÑÑÑ Akonadi,\n"
"%{tab} â ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
-#: rc.cpp:141
+#: rc.cpp:145
msgid "Format for todos:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑпÑав:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
-#: rc.cpp:144
+#: rc.cpp:148
msgid "The text displayed for common todos."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð·Ð°Ð³Ð°Ð»ÑниÑ
ÑпÑав."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
-#: rc.cpp:147
+#: rc.cpp:151
msgid "Todos with no due date:"
msgstr "СпÑави без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
-#: rc.cpp:150
+#: rc.cpp:154
msgid "The text displayed for todos with no due date."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ ÑпÑав без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
-#: rc.cpp:153
+#: rc.cpp:157
msgid "Date appearance settings"
msgstr "ÐалаÑÑÑÐ²Ð°Ð½Ð½Ñ Ð´Ð°Ñи"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
-#: rc.cpp:156
+#: rc.cpp:160
msgid "Date format:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð°Ñи:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
-#: rc.cpp:159
+#: rc.cpp:163
msgid "What date format to use."
msgstr "Який ÑоÑÐ¼Ð°Ñ Ð´Ð°Ñи викоÑиÑÑовÑваÑи."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:162
+#: rc.cpp:166
msgid "KDE ShortDate"
msgstr "ÐоÑоÑка даÑа KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:165
+#: rc.cpp:169
msgid "KDE LongDate"
msgstr "Ðовга даÑа KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
-#: rc.cpp:168
+#: rc.cpp:172
msgid "Custom"
msgstr "ÐовÑлÑний"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
-#: rc.cpp:171
+#: rc.cpp:175
msgid "Custom format:"
msgstr "ÐовÑлÑний ÑоÑмаÑ:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
-#: rc.cpp:174
+#: rc.cpp:178
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Ð Ñдок, Ñкий опиÑÑÑ Ð´Ð¾Ð²ÑлÑний ÑоÑмаÑ. ÐикоÑиÑÑовÑÑÑÑÑÑ ÑинÑакÑÐ¸Ñ QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
-#: rc.cpp:180
+#: rc.cpp:184
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
-#: rc.cpp:183
+#: rc.cpp:187
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:190
+#: rc.cpp:194
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
-#: rc.cpp:193
+#: rc.cpp:197
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
-#: rc.cpp:202
+#: rc.cpp:206
msgid "Miscellenous options"
msgstr "ÐодаÑÐºÐ¾Ð²Ñ Ð½Ð°Ð»Ð°ÑÑÑваннÑ"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
-#: rc.cpp:205
+#: rc.cpp:209
msgid "Period to show incidences (in days):"
msgstr "ÐеÑÑод Ð¿Ð¾ÐºÐ°Ð·Ñ Ð¿Ð¾Ð´Ñй (Ñ Ð´Ð½ÑÑ
):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
-#: rc.cpp:208
+#: rc.cpp:212
msgid "The time frame to show incidences."
msgstr "ЧаÑовий ÐºÐ°Ð´Ñ Ð¿Ð¾ÐºÐ°Ð·Ñ Ð¿Ð¾Ð´Ñй."
-#: rc.cpp:209
+#: rc.cpp:213
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Oleksandr Natalenko"
-#: rc.cpp:210
+#: rc.cpp:214
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "ÐолÑоÑи подÑй, Ñо повÑоÑÑÑÑÑÑÑ"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Фоновий колÑÑ Ð´Ð½Ñв наÑодженÑ:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Фоновий колÑÑ Ð´Ð½Ñв наÑодженÑ."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑÑÑниÑÑ:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑÑÑниÑÑ."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "ÐÐ½Ñ Ð½Ð°ÑÐ¾Ð´Ð¶ÐµÐ½Ñ Ñа ÑÑÑниÑÑ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð´Ð½Ñв наÑÐ¾Ð´Ð¶ÐµÐ½Ñ Ñи ÑÑÑниÑÑ."
#~ msgid "Open event"
#~ msgstr "ÐÑдкÑиÑи подÑÑ"
#~ msgid "Open todo"
#~ msgstr "ÐÑдкÑиÑи ÑпÑавÑ"
#~ msgid "Urgency:"
#~ msgstr "ТеÑмÑновÑÑÑÑ:"
diff --git a/src/applet/eventappletformatconfig.ui b/src/applet/eventappletformatconfig.ui
index 6dd76ea..2f1609e 100644
--- a/src/applet/eventappletformatconfig.ui
+++ b/src/applet/eventappletformatconfig.ui
@@ -1,241 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletFormatConfig</class>
<widget class="QWidget" name="EventAppletFormatConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>837</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Event text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format for normal events:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KLineEdit" name="normalEventEdit">
<property name="toolTip">
<string>The text displayed for common events.</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="4">
<widget class="QTreeWidget" name="categoryFormatWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
- <string notr="true">Category</string>
+ <string>Category</string>
</property>
</column>
<column>
<property name="text">
- <string notr="true">Format</string>
+ <string>Format</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="addCategoryButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="copyCategoryButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="removeCategoryButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>The format for the displayed text for events.
Substitutions (mostly self-explanatory) are:
%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - start and end time,
%{summary} - summary, %{description} - description, %{location} - location, %{duration} - duration,
%{yearsSince} - years since the first time (useful for birthdays),
%{resourceName} - the i18n name of the Akonadi resource,
%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Todo text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>The format for the displayed text for todos.
Substutions (again mostly self-explanatory) are:
%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - start date and time,
%{summary} - summary, %{description} - description, %{percent} - finished percent, %{location} - location,
%{resourceName} - the i18n name of the Akonadi resource,
%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Format for todos:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="todoEdit">
<property name="toolTip">
<string>The text displayed for common todos.</string>
</property>
<property name="statusTip">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Todos with no due date:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="noDueDateEdit">
<property name="toolTip">
<string>The text displayed for todos with no due date.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Date appearance settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Date format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="dateFormatBox">
<property name="toolTip">
<string>What date format to use.</string>
</property>
<item>
<property name="text">
<string>KDE ShortDate</string>
</property>
</item>
<item>
<property name="text">
<string>KDE LongDate</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Custom format:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="customFormatEdit">
<property name="toolTip">
<string>A string describing the custom format. It is using the QDate syntax.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
|
geflei/plasmoid-eventlist | 111933c8fdd623590128c34e812c12d9707ba9f8 | dont think all users are native english speaker | diff --git a/po/cs.po b/po/cs.po
index 194dc0c..3cb4de5 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -1,537 +1,541 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Karol Slanina <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2010-08-07 23:48+0200\n"
"Last-Translator: Karol Slanina <[email protected]>\n"
"Language-Team: Slovak <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sk\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n"
"X-Language: cs_CZ\n"
"X-Source-Language: C\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Narozeniny"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Dnešnà udalosti"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ZÃtra"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Ãlohy na zÃtra"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Týden"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Události následujÃcÃho týdne"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Dalšà 4 týdny"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Události v následujÃcÃch 4 týdnech"
#: eventapplet.cpp:151
msgid "Later"
msgstr "PozdÄji"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Události za vÃce než 4 týdny"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "NadcházejÃcà události"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Vybrat zdroje"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "OtevÅÃt \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "PÅidat novou událost"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "PÅidat nový úkol"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Vybrat zobrazované zdroje"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "NadcházejÃcà události ze zdrojů Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formát textu"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Barvy"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Server Akonadi nebÄžÃ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "DÅÃvÄjšà položky"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "NedokonÄené úkoly, probÃhajÃcà dÅÃvÄjšà události atd."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "NÄkdy"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ãkoly bez termÃnu"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "Äasy"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "FormuláÅ"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Äasy"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorita bÄžných událostÃ:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Äas, od kterého jsou události zvýraznÄné jako blÃzké."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorita narozenin:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Äas, od ktorého sú narodeniny alebo výroÄia zvýraznené ako blÃzke."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "dnÃ"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Barva pro bÄžné události"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Barva pozadà pro blÃzké události:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Barva pozadà pro blÃzké události."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Neprůhlednost:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Barva textu pro bÄžÃcÃ, nebo uplynulé události:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Barva textu pro bÄžÃcÃ, nebo uplynulé události."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Barvy pro úkoly"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Barva pozadà pro úkoly:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Barva pozadà pro bÄžné úkoly."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Ukázat, nebo skrýt dokonÄené úkoly."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Ukázat dokonÄené úkoly"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Barva pozadà pro dokonÄené úkoly:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Barva pozadà pro dokonÄené úkoly."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formátovánà textu událostÃ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formát bežných událostÃ:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Text, který bude zobrazený pro bÄžné události."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pro události.\n"
"Nahrazuje se:\n"
"%{startDate} - datum zaÄátku, %{endDate} - datum konce,\n"
"%{startTime} - Äas zaÄátku, %{endTime} - Äas konce,\n"
"%{summary} - shrnutÃ, %{description} - popis,\n"
"%{location} - mÃsto, %{duration} - trvánà v hodinách,\n"
"%{yearsSince} - poÄet roků od prvnÃho opakovanà (užiteÄné pro narozeniny),\n"
"%{resourceName} - i18n jméno Akonadi zdroje,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "Formátovánà textu úkolů"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pro úkoly.\n"
"Nahrazuje se:\n"
"%{dueDate} - termÃn (den), %{dueTime} - termÃn (Äas),\n"
"%{startDate} - datum zaÄátku, %{startTime} - Äas zaÄátku,\n"
"%{summary} - shrnutÃ, %{description} - popis,\n"
"%{percent} - postup v procentech, %{location} - mÃsto,\n"
"%{resourceName} - i18n jméno Akonadi zdroje,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "Formát úkolů:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "Text, který bude zobrazený pro bÄžné úkoly."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Ãkoly bez termÃnu:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "Text, který bude zobrazený pro úkoly bez termÃnu."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "Nastavenà zobrazenà data"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "Formát data:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Jaký formát datumu bude použitý."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "KDE krátký formát"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "KDE dlouhý formát"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "VlastnÃ"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "Vlastnà formát:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Text popisujÃcà vlastnà formát. Je tÅeba použÃt syntaxi QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "Ostatnà nastavenÃ"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "Zobrazený Äasový úsek (ve dnech):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "Pro jaký Äasový úsek budou zobrazené události."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Aleš Nejdr"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Barvy pro opakujÃcà se události"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Barva pozadà pro narozeniny:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Barva pozadà pro narozeniny."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Barva pozadà pro výroÄÃ:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Barva pozadà pro výroÄÃ."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Narozeniny a výroÄÃ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Text, který bude zobrazený pro narozeniny a výroÄÃ."
diff --git a/po/de.po b/po/de.po
index 56b2b90..1b84314 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,571 +1,575 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Gerd Fleischer <[email protected]>, 2010.
# Gerd Fleischer <[email protected]>, 2010, 2011.
msgid ""
msgstr ""
"Project-Id-Version: 0.2.4\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2011-02-25 11:58+0100\n"
"Last-Translator: Gerd Fleischer <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Geburtstag"
#: eventapplet.cpp:137
msgid "Holiday"
msgstr "Ferien"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Heute"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Termine von heute"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Morgen"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Termine von morgen"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Nächste 7 Tage"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Termine der nächsten Woche"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Nächste 4 Wochen"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Termine des nächsten Monats"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Später"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Termine später als 4 Wochen"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Anstehende Termine"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Ressourcen auswählen"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "\"%1\" öffnen"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Neuer Termin"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Neue Aufgabe"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Angezeigte Ressourcen auswählen"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Anstehende Termine von Akonadi Ressourcen"
#: eventapplet.cpp:464
msgid "General"
msgstr "Allgemein"
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Textformat"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Farben"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Der Akonadiserver läuft nicht!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Ãltere Sachen "
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Unfertige Aufgaben, noch währende Termine etc."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Irgendwann"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Aufgaben ohne festen Termin"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr "Nicht angegeben"
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
msgid "Title"
msgstr "Titel"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "Form"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Zeiten"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Dringlichkeit für normale Ereignisse:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Die Zeit ab wann ein bald beginnender Termin markiert werden soll."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Dringlichkeit für Geburtstage:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"Die Zeit ab wann ein Geburtstag oder Jahrestag als dringend markiert werden "
"soll."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "Tage"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Farben für normale Ereignisse"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Hintergrundfarbe für bald beginnende Termine:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Die Hintergrundfarbe für bald beginnende Termine."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Deckkraft:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Textfarbe für angefangene oder vergangene Termine:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Die Textfarbe für bereits angefangene oder vergangene Termine."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Farben für Aufgaben"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Hintergrundfarbe für Aufgaben:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Die Hintergrundfarbe für Aufgaben."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Unerledigte Aufgaben anzeigen oder verstecken."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Erledigte Aufgaben anzeigen"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Hintergrundfarbe für erledigte Aufgaben:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Die Hintergrundfarbe für erledigte Aufgaben."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr "KOrganizer Farben"
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Ereigniss Textformatierung"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Format für normale Ereignisse:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Der Text der für normale Ereignisse angezeigt wird."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr "Hinzufügen"
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr "Kopieren"
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr "Löschen"
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
-#, no-c-format
+#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Das Format für den angezeigten Text für die Ereignisse.\n"
"Als Platzhalter (gröÃtenteils selbsterklärend):\n"
"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
"%{summary}, %{description}, %{location} - Ort, %{duration},\n"
"%{yearsSince} - Jahre seit dem ersten Stattfinden (nützlich für "
"Geburtstage),\n"
"%{resourceName} - der i18n Name der Akonadi Ressource,\n"
"%{mainCategory}, %{categories} - die erste oder alle Kategorien,\n"
"%{tab} - ein Tabulator"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "Aufgaben Textformatierung"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Das Format für den angezeigten Text für Aufgaben.\n"
"Als Platzhalter kann verwendet werden:\n"
"%{dueDate} - Fälligkeitstermin, %{dueTime} - Fälligkeitszeit,\n"
"%{startDate} - Datum des Beginns, %{startTime} - Startzeit,\n"
"%{summary} - Zusammenfassung, %{description} - Beschreibung\n"
"%{percent} - erledigter Anteil, %{location} - Ort,\n"
"%{resourceName} - der i18n Name der Akonadi Ressource,\n"
"%{tab} - ein Tabulator"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "Format für Aufgaben:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "Der Text der für Aufgaben angezeigt wird."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Aufgaben ohne festen Termin:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "Der Text der für Aufgaben ohne festen Termin angezeigt wird."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "Einstellung für die Datumsanzeige"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "Datumsformat:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Verwendetes Datumsformat."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "KDE Kurzes Datum"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "KDE Langes Datum"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "Benutzerdefiniert"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "Benutzerdefiniertes Format:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Eine Zeichenfolge für das benutzerdefinierte Format. Es wird die QDate "
"Syntax verwendet."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr "Zeiträume"
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
-"Hier können eigene Zeiträume definiert werden, Anfang ist der erste Tag, "
-"von heute an gezählt,\n"
+"Hier können eigene Zeiträume definiert werden, Anfang ist der erste Tag, von "
+"heute an gezählt,\n"
"ersteckt sich bis zum Beginn des nächsten oder zum Ende des angezeigten "
"gesamten Zeitraums."
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr "Tooltip"
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr "Anfang"
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "Verschiedene Optionen"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "Angezeigter Zeitraum (in Tagen):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "Für welchen Zeitraum Ereignisse angezeigt werden sollen."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Gerd Fleischer"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Farben für wiederkehrende Termine"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Hintergrundfarbe für Geburtstage:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Die Hintergrundfarbe für Geburtstage."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Hintergrundfarbe für Jahrestage:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Die Hintergrundfarbe für Jahrestage."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Geburtstage & Jahrestage:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Der Text der für Geburtstage und Jahrestage angezeigt wird."
#~ msgid "Open event"
#~ msgstr "Termin öffnen"
#~ msgid "Open todo"
#~ msgstr "Aufgabe öffnen"
#~ msgid "Urgency:"
#~ msgstr "Dringlichkeit:"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 Versuche eine Verbindung zum Akonadiserver herzustellen"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Konnte keine Verbindung zum Akonadiserver herstellen"
#~ msgid "Events after the next month"
#~ msgstr "Termine nach dem nächsten Monat"
#~ msgid "Use colors"
#~ msgstr "Benutze Farben"
#~ msgid "Checkintervall:"
#~ msgstr "Ãberprüfungsintervall:"
#~ msgid "How often the items are checked for urgency or already started."
#~ msgstr ""
#~ "Abstand wie oft Items auf baldiges Beginnen oder bereits angefangen "
#~ "überprüft werden."
diff --git a/po/eventapplet.pot b/po/eventapplet.pot
index 8ee2881..7fa28c5 100644
--- a/po/eventapplet.pot
+++ b/po/eventapplet.pot
@@ -1,494 +1,498 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr ""
#: eventapplet.cpp:137
msgid "Holiday"
msgstr ""
#: eventapplet.cpp:147
msgid "Today"
msgstr ""
#: eventapplet.cpp:147
msgid "Events of today"
msgstr ""
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr ""
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr ""
#: eventapplet.cpp:149
msgid "Week"
msgstr ""
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr ""
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr ""
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr ""
#: eventapplet.cpp:151
msgid "Later"
msgstr ""
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr ""
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr ""
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr ""
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr ""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr ""
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr ""
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr ""
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr ""
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr ""
#: eventapplet.cpp:466
msgid "Colors"
msgstr ""
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr ""
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr ""
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr ""
#: eventmodel.cpp:178
msgid "Some day"
msgstr ""
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr ""
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
msgid "Title"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr ""
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr ""
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr ""
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr ""
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 57c38e9..7f8f8f0 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,552 +1,556 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Cédric Bellegarde <[email protected]>, 2010.
# Gerd Fleischer <[email protected]>, 2011.
# Cédric Bellegarde <[email protected]>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2011-02-07 09:13+0100\n"
"Last-Translator: Cédric Bellegarde <[email protected]>\n"
"Language-Team: French <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Anniversaires"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Aujourd'hui"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Aujourd'hui"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Evénements pour aujourd'hui"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Demain"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Evénement pour demain"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Semaine à venir"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Evénements pour la semaine prochaine"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Quatre prochaines semaines"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Evénements pour les quatre prochaines semaines"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Plus tard"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Evénements dans plus de 4 semaines"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Evénements à venir"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Sélectionner les ressources"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Ouvrir \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Ajouter un événement"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Ajouter une nouvelle tâche"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Ressources à afficher"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Evénements à venirs (ressources Akonadi)"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Format du texte"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Couleurs"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Le serveur Akonadi ne fonctionne pas!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Evénements précédents"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Tâches non terminées, événements passés encore en cours à venir etc"
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Un jour ou l'autre"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Tâches sans date de fin"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "Heure"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "Formulaire"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Heure"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorité des événement normaux:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorité pour les anniversaires:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "jours"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Couleur des événement normaux"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Couleur de fond pour les événements proches"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Couleur de fond pour les événements débutant prochainnement"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Opacité:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "La couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Couleur des tâches"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Couleur de fond pour les tâches:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "La couleur de fond pour les tâches."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Montrer ou cacher les tâches terminées"
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Montrer les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Couleur de fond pour les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "La couleur de fond des des tâches déjà terminées."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Format des événements"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Format des événement normaux:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Texte affiché des événements normaux"
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Format du texte des événements.\n"
"Les substitutions sont:\n"
"%{startDate} - Date de départ, %{endDate} - Date de fin,\n"
"%{startTime} - Heure de départ, %{endTime} - Heure de fin,\n"
"%{summary} - Résumé, %{description} - Description,\n"
"%{location} - Emplacement, %{duration} - Durée en, heure,\n"
"%{yearsSince} - Années depuis la première fois (utile pour les "
"anniversaires),\n"
"%{resourceName} - Le nom de la ressource Akonadi,\n"
"%{tab} - Tabulation"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "Format des tâches"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Le format pour le texte des tâches à faire:\n"
"Les substitutions sont:\n"
"%{dueDate} - la date de fin, %{dueTime} - l'heure de fin,\n"
"%{startDate} - la date de départ, %{startTime} - l'heure de départ,\n"
"%{summary} - le résumé, %{description} - la description,\n"
"%{percent} - pourcentage accompli, %{location} - emplacement,\n"
"%{resourceName} - le nom de la ressource Akonadi,\n"
"%{tab} - une tabulation"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "Format des tâches:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "Texte affiché pour les tâches"
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "Texte affiché pour les tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "Apparance des dates"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "Format des dates:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Quel format de date utilisé"
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "Dates KDE courtes"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "Dates KDE longues"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "Personnalisé"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "Format personnalisé:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Une chaîne décrivant le format personnalisé (utilisation de la syntaxe QDate)"
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "Options diverses"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "Durée d'affichage d'un événement (en jours):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "Intervalle de temps pour l'affichage"
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Lannehoa Yves"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Couleur pour les événements récurrents"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Couleur de fond pour les anniversaires:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "La couleur de fond pour les anniversaires."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Couleur de fond des commémorations:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "La couleur de fond des commémorations."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Anniversaires et commémorations:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Texte affiché pour les commémorations"
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Ouvrir l'événement courant"
#~ msgid "Urgency:"
#~ msgstr "Urgence"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 essais de connexion au serveur Akonadi"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Ne peut se connecter au serveur Akonadi"
diff --git a/po/it.po b/po/it.po
index df13e0f..97c61f4 100644
--- a/po/it.po
+++ b/po/it.po
@@ -1,554 +1,558 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Cédric Bellegarde <[email protected]>, 2010.
# jacopo, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2010-09-28 21:15+0200\n"
"Last-Translator: jacopo\n"
"Language-Team: French <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "Compleanno"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Oggi"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Oggi"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Eventi di oggi"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Domani"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Eventi di domani"
#: eventapplet.cpp:149
msgid "Week"
msgstr "Settimana"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Eventi della prossima settimana "
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "Prossime 4 settimane"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Eventi delle prossime 4 settimane"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Più tardi"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Eventi oltre le 4 settimane"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Prossimi eventi"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Seleziona la risorsa"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Apri \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Aggiungi un nuovo evento "
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Aggiungi una nuova cosa-da-fare"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Risorse per la visualizzazione"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Prossimi eventi (risorse di Akonadi)"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formato del testo "
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Colori"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Il server Akonadi non è in esecuzione!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "In svolgimento"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Cose-da-fare non terminate, eventi ancora in svolgimento, ecc."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Alcuni giorni"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Cose-da-fare senza scadenza"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "Tempi"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "Form"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Tempi"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Tempo di preavviso per gli eventi normali:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Quanti ore prima un evento e' impostato come se stesse per iniziare."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Tempo di preavviso per i compleanni:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"Quanti giorni prima un compleanno od un anniversario e' impostato come se "
"stesse per iniziare."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "giorni"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Colore per gli eventi normali"
# da controllare
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Colore di sfondo per gli eventi prossimi:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Colore di fondo per gli eventi che stano per iniziare"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Trasparenza:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Colore del testo per gli eventi iniziati o finiti:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Colore del testo per gli eventi iniziati o finiti:"
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Colore per le cose-da-fare"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Colore di fondo per le cose-da-fare"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Colore di sfondo per le code-da-fare normali."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "Mostra/nascondi le cose-da-fare terminate."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "Mostra le cose-da-fare terminate:"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Sfondo per le cose-da-fare terminate:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Sfondo per le cose-da-fare terminate."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formato del testo degli eventi"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formato per gli eventi normali:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Il testo mostrato per gli eventi comuni."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Il formato del testo per gli eventi mostrati.\n"
"I segnaposto sono:\n"
"%{startDate} - data d'inizio, %{endDate} - data di termine,\n"
"%{startTime} - ora d'inizio, %{endTime} - ora di termine,\n"
"%{summary} - sommario, %{description} - descrizione,\n"
"%{location} - luogo, %{duration} - durata (in ore),\n"
"%{yearsSince} - anni passati dalla prima volta (utile per i compleanni),\n"
"%{resourceName} - il i18n nome della risorsa di Akonadi ,\n"
"%{tab} - carattere di tabulazione"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "Formato del testo per le cose-da-fare"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Il formato del testo per le cose-da-fare mostrate.\n"
"I segnaposto sono:\n"
"%{dueDate} - data di scadenza , %{dueTime} - ora di scadenza,\n"
"%{startDate} - data d'inizio, %{endDate} - data di termine,\n"
"%{summary} - sommario, %{description} - descrizione,\n"
"%{percent} - percentuale di completamento, %{location} - luogo\n"
"%{resourceName} - il i18n nome della risorsa di Akonadi ,\n"
"%{tab} - carattere di tabulazione"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "Formato delle cose-da-fare:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "Testo mostrato per le cose-da-fare normali."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Cose-da-fare senza scadenza:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "Testo mostrato per le cose-da-fare senza scadenza:"
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "Formato della data"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "Formato della data:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Quale formato usare per la data."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "Date corte di KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "Date Lunghe di KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "Personalizzato "
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "Formato personalizzato:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr ""
"Una stringa che descriva il formato personalizzato( secondo la sintassi di "
"QDate)"
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "Opzioni varie"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "Periodo di tempo per cui mostrare evento (in giorni):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "Arco di tempo in cui mostrare un evento."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Jacopo Ferrigno"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Colore per gli eventi ricorrenti"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Colore di fondo per i Compleanni:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Colore di fondo per i compleanni:"
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Colore di fondo per gli Anniversari:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Colore di fondo per gli anniversari:"
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Compleanni ed anniversari:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Testo mostrato per compleanni o anniversari"
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Ouvrir l'événement courant"
#~ msgid "Urgency:"
#~ msgstr "Urgence"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 essais de connexion au serveur Akonadi"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Ne peut se connecter au serveur Akonadi"
diff --git a/po/ru.po b/po/ru.po
index bddc347..be178b7 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -1,549 +1,553 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Oleksandr Natalenko <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2010-09-26 23:55+0300\n"
"Last-Translator: Oleksandr Natalenko <[email protected]>\n"
"Language-Team: Ukrainian <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "ÐÐµÐ½Ñ ÑождениÑÐÐµÐ½Ñ ÑождениÑ"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "СегоднÑ"
#: eventapplet.cpp:147
msgid "Today"
msgstr "СегоднÑ"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "СобÑÑÐ¸Ñ ÑегоднÑ"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ÐавÑÑа"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "СобÑÑÐ¸Ñ Ð·Ð°Ð²ÑÑа"
#: eventapplet.cpp:149
msgid "Week"
msgstr "ÐеделÑ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "СобÑÑÐ¸Ñ ÑледÑÑÑей недели"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "СледÑÑÑие 4 недели"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "СобÑÑÐ¸Ñ ÑледÑÑÑиÑ
4 неделÑ"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Ðозднее"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "СобÑÑиÑ, коÑоÑÑе пÑоизойдÑÑ Ð¿Ð¾Ð·Ð´Ð½ÐµÐµ, Ñем ÑеÑез 4 недели"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "ÐлижайÑие ÑобÑÑиÑ"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "ÐÑбÑаÑÑ ÑеÑÑÑÑÑ"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "ÐÑкÑÑÑÑ Â«%1»"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "ÐобавиÑÑ Ð½Ð¾Ð²Ð¾Ðµ ÑобÑÑие"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "ÐобавиÑÑ Ð½Ð¾Ð²Ð¾Ðµ дело"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "ÐоказаÑÑ Ð²ÑбÑаннÑе ÑеÑÑÑÑÑ"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "ÐлижайÑие ÑобÑÑÐ¸Ñ Ñ ÑеÑÑÑÑов Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑа"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "ЦвеÑа"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "СеÑÐ²ÐµÑ Akonadi не ÑабоÑаеÑ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "РанÑÑе"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "ÐезаконÑеннÑе дела, ÑобÑÑиÑ, коÑоÑÑе еÑÑ Ð¿ÑоиÑÑ
одÑÑ Ð¸ Ñ. д."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "ÐекоÑоÑÑй денÑ"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ðела без даÑÑ Ð²ÑполнениÑ"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "ÐÑемÑ"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "ФоÑма"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "ÐÑемÑ"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "СÑоÑноÑÑÑ Ð½Ð¾ÑмалÑнÑÑ
ÑобÑÑий:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr ""
"ÐÑемÑ, коÑоÑое оÑÑалоÑÑ Ð´Ð¾ обознаÑÐµÐ½Ð¸Ñ ÑобÑÑÐ¸Ñ Ñаким, коÑоÑое ÑкоÑо "
"наÑинаеÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "мин"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "СÑоÑноÑÑÑ Ð´Ð½ÐµÐ¹ ÑождениÑ:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"ÐÑемÑ, коÑоÑое оÑÑалоÑÑ Ð´Ð¾ обознаÑÐµÐ½Ð¸Ñ Ð´Ð½Ñ ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ годовÑÐ¸Ð½Ñ Ñакой, "
"коÑоÑÐ°Ñ ÑкоÑо наÑинаеÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "дней"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "ЦвеÑа ноÑмалÑнÑÑ
ÑобÑÑий"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð±Ð»Ð¸Ð¶Ð°Ð¹ÑиÑ
ÑобÑÑий:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "ФоновÑй ÑÐ²ÐµÑ ÑобÑÑий, коÑоÑÑе ÑкоÑо наÑнÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "ÐÑозÑаÑноÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Ð¦Ð²ÐµÑ ÑекÑÑа Ð´Ð»Ñ Ð¿ÑопÑÑеннÑÑ
ÑобÑÑий или ÑобÑÑий, коÑоÑÑе наÑалиÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Ð¦Ð²ÐµÑ ÑекÑÑа Ð´Ð»Ñ Ð¿ÑопÑÑеннÑÑ
ÑобÑÑий или ÑобÑÑий, коÑоÑÑе Ñже наÑалиÑÑ."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "ЦвеÑа Ð´Ð»Ñ Ð´ÐµÐ»"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð»Ñ Ð´ÐµÐ»:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
дел."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "ÐоказаÑÑ Ð¸Ð»Ð¸ ÑпÑÑÑаÑÑ Ñже завеÑÑÑннÑе дела."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "ÐоказаÑÑ Ð·Ð°Ð²ÐµÑÑÑннÑе дела"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "ФоновÑй ÑÐ²ÐµÑ Ð·Ð°Ð²ÐµÑÑÑннÑÑ
дел:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "ФоновÑй ÑÐ²ÐµÑ Ñже завеÑÑÑннÑÑ
дел."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "ФоÑмаÑиÑование ÑвеÑа ÑобÑÑиÑ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "ФоÑÐ¼Ð°Ñ Ð½Ð¾ÑмалÑнÑÑ
ÑобÑÑий:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
ÑобÑÑий."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑа ÑобÑÑий.\n"
"ÐодÑÑановками ÑвлÑÑÑÑÑ:\n"
"%{startDate} â даÑа наÑала, %{endDate} â даÑа оконÑаниÑ,\n"
"%{startTime} â вÑÐµÐ¼Ñ Ð½Ð°Ñала, %{endTime} â вÑÐµÐ¼Ñ Ð¾ÐºÐ¾Ð½ÑаниÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑание,\n"
"%{location} â ÑазмеÑение, %{duration} â длиÑелÑноÑÑÑ Ð² ÑаÑаÑ
,\n"
"%{yearsSince} â леÑ, наÑÐ¸Ð½Ð°Ñ Ñ Ð¿ÐµÑвого Ñаза (полезно Ð´Ð»Ñ Ð´Ð½ÐµÐ¹ ÑождениÑ),\n"
"%{resourceName} â инÑеÑнаÑионализиÑованное название ÑеÑÑÑÑа Akonadi,\n"
"%{tab} - ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑа дел"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑа дел.\n"
"ÐодÑÑановками ÑвлÑÑÑÑÑ:\n"
"%{dueDate} â даÑа оконÑаниÑ, %{dueTime} â вÑÐµÐ¼Ñ Ð¾ÐºÐ¾Ð½ÑаниÑ,\n"
"%{startDate} â даÑа наÑала, %{startTime} â вÑÐµÐ¼Ñ Ð½Ð°Ñала,\n"
"%{summary} â ÑезÑме, %{description} â опиÑание,\n"
"%{percent} â пÑоÑÐµÐ½Ñ Ð·Ð°Ð²ÐµÑÑениÑ, %{location} â ÑаÑположение,\n"
"%{resourceName} â инÑеÑнаÑионализиÑованное Ð¸Ð¼Ñ ÑеÑÑÑÑп Akonadi,\n"
"%{tab} â ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ Ð´ÐµÐ»:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð¾Ð±ÑиÑ
дел."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Ðела без даÑÑ Ð·Ð°Ð²ÐµÑÑениÑ:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð´ÐµÐ» без даÑÑ Ð·Ð°Ð²ÐµÑÑениÑ."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "ÐаÑÑÑойки даÑÑ"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð°ÑÑ:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Ðакой ÑоÑÐ¼Ð°Ñ Ð´Ð¾ÑÑ Ð¸ÑполÑзоваÑÑ."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "ÐÑаÑÐºÐ°Ñ Ð´Ð°Ñа KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "ÐÐ»Ð¸Ð½Ð½Ð°Ñ Ð´Ð°Ñа KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "СобÑÑвеннÑй"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "СобÑÑвеннÑй ÑоÑмаÑ:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "СÑÑока, опиÑÑваÑÑÐ°Ñ ÑобÑÑвеннÑй ÑоÑмаÑ. ÐÑполÑзÑеÑÑÑ ÑинÑакÑÐ¸Ñ QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "ÐополниÑелÑнÑе наÑÑÑойки"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "ÐеÑиод показа ÑобÑÑий (в днÑÑ
):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "ÐÑеменной ÐºÐ°Ð´Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° ÑобÑÑий."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Oleksandr Natalenko"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "ЦвеÑа повÑоÑÑÑÑиÑ
ÑÑ ÑобÑÑий"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð½ÐµÐ¹ ÑождениÑ:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð´Ð½ÐµÐ¹ ÑождениÑ."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð³Ð¾Ð´Ð¾Ð²Ñин:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "ФоновÑй ÑÐ²ÐµÑ Ð³Ð¾Ð´Ð¾Ð²Ñин."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Ðни ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸ годовÑинÑ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "ТекÑÑ, коÑоÑÑй оÑобÑажаеÑÑÑ Ð´Ð»Ñ Ð´Ð½ÐµÐ¹ ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ годовÑин."
#~ msgid "Open event"
#~ msgstr "ÐÑкÑÑÑÑ ÑобÑÑие"
#~ msgid "Open todo"
#~ msgstr "ÐÑкÑÑÑÑ Ð´ÐµÐ»Ð¾"
#~ msgid "Urgency:"
#~ msgstr "ТеÑмÑновÑÑÑÑ:"
diff --git a/po/sk.po b/po/sk.po
index 7eb6f46..ce445d5 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -1,548 +1,552 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Karol Slanina <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2010-08-07 23:48+0200\n"
"Last-Translator: Karol Slanina <[email protected]>\n"
"Language-Team: Slovak <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sk\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr ""
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Today"
msgstr "Dnes"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "Dnešné udalosti"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "Zajtra"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "Ãlohy na zajtra"
#: eventapplet.cpp:149
msgid "Week"
msgstr "TýždeÅ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "Udalosti nasledujúceho týždÅa"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "ÄalÅ¡ie 4 týždne"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "Udalosti nasledujúcich 4 týždÅov"
#: eventapplet.cpp:151
msgid "Later"
msgstr "Neskôr"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "Udalosti neskôr než o 4 týždne"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "Prichádzajúce udalosti"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "Vybrať zdroje"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "Otvoriť \"%1\""
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "Pridať novú udalosť"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "Pridať novú úlohu"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "Vybrať zobrazované zdroje"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "Prichádzajúce udalosti zo zdrojov Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "Formát textu"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "Farby"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "Akonadi server nebežÃ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "Skoršie položky"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "NedokonÄené úlohy, prebiehajúce skorÅ¡ie udalosti atÄ."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "Niekedy"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "Ãlohy bez termÃnu"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "Äasy:"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "Formulár"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Äasy:"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorita bežných udalostÃ:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Äas, od ktorého sú udalosti zvýraznené ako blÃzke"
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorita narodenÃn:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Äas, od ktorého sú narodeniny alebo výroÄia zvýraznené ako blÃzke"
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "dnÃ"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Farba pre bežné udalosti"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Farba pozadia pre blÃzke udalosti:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Farba pozadia pre blÃzke udalosti."
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "Nepriehľadnosť:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Farba textu pre bežiace alebo uplynulé udalosti:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "Farba textu pre bežiace alebo uplynulé udalosti."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "Farby pre úlohy"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Farba pozadia pre úlohy:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Farba pozadia pre bežné úlohy."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "UkázaÅ¥ alebo skryÅ¥ ukonÄené úlohy."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "UkázaÅ¥ ukonÄené úlohy"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Farba pozadia pre ukonÄené úlohy:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Farba pozadia pre ukonÄené úlohy."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "Formátovanie textu udalostÃ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "Formát bežných udalostÃ:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "Text, ktorý bude zobrazený pre bežné udalosti."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pre udalosti.\n"
"Nahradzuje sa:\n"
"%{startDate} - dátum zaÄiatku, %{endDate} - dátum konca,\n"
"%{startTime} - Äas zaÄiatku, %{endTime} - Äas konca,\n"
"%{summary} - zhrnutie, %{description} - popis,\n"
"%{location} - miesto, %{duration} - trvanie v hodinách,\n"
"%{yearsSince} - poÄet rokov od prvého opakovania (užitoÄné pre narodeniny),\n"
"%{resourceName} - i18n meno Akonadi zdroja,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "Formátovanie textu úloh"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"Formát zobrazovaného textu pre úlohy.\n"
"Nahradzuje sa:\n"
"%{dueDate} - termÃn (deÅ), %{dueTime} - termÃn (Äas),\n"
"%{startDate} - dátum zaÄiatku, %{startTime} - Äas zaÄiatku,\n"
"%{summary} - zhrnutie, %{description} - popis,\n"
"%{percent} - postup v percentách, %{location} - miesto,\n"
"%{resourceName} - i18n meno Akonadi zdroja,\n"
"%{tab} - tabulátor"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "Formát úloh:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "Text, ktorý bude zobrazený pre bežné úlohy."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "Ãlohy bez termÃnu:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "Text, ktorý bude zobrazený pre úlohy bez termÃnu."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "Nastavenie zobrazenia dátumu"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "Formát dátumu:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Aký formát dátumu bude použitý"
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "KDE krátky formát"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "KDE dlhý formát"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "Vlastný"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "Vlastný formát:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Text popisujúci vlastný formát. Treba použiť syntax QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "Ostatné nastavenia"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "Zobrazený Äasový úsek (v dÅoch):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "Pre aký Äasový úsek budú zobrazené udalosti."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Karol Slanina"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "Farby pre opakujúce sa udalosti"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Farba pozadia pre narodeniny:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Farba pozadia pre narodeniny."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Farba pozadia pre výroÄia:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Farba pozadia pre výroÄia."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "Narodeniny a výroÄia:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "Text, ktorý bude zobrazený pre narodeniny a výroÄia."
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Otvoriť aktuálnu udalosť"
#~ msgid "Urgency:"
#~ msgstr "Upozornenie:"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1. pokus naštartovať/pripojiť sa na Akonadi server"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Nemôžem sa pripojiť na Akonadi server"
diff --git a/po/uk.po b/po/uk.po
index 0290a98..acf6b7d 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -1,548 +1,552 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Oleksandr Natalenko <[email protected]>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2011-02-25 11:42+0100\n"
+"POT-Creation-Date: 2011-02-25 12:02+0100\n"
"PO-Revision-Date: 2010-09-26 23:56+0300\n"
"Last-Translator: Oleksandr Natalenko <[email protected]>\n"
"Language-Team: Ukrainian <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"X-Generator: Lokalize 1.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: eventapplet.cpp:137 eventmodel.cpp:274 eventmodel.cpp:276
#: eventmodel.cpp:277 eventmodel.cpp:455
msgid "Birthday"
msgstr "ÐÐµÐ½Ñ Ð½Ð°ÑодженнÑ"
#: eventapplet.cpp:137
#, fuzzy
msgid "Holiday"
msgstr "СÑогоднÑ"
#: eventapplet.cpp:147
msgid "Today"
msgstr "СÑогоднÑ"
#: eventapplet.cpp:147
msgid "Events of today"
msgstr "СÑогоднÑÑÐ½Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:148
msgid "Tomorrow"
msgstr "ÐавÑÑа"
#: eventapplet.cpp:148
msgid "Events for tomorrow"
msgstr "ÐавÑÑаÑÐ½Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:149
msgid "Week"
msgstr "ТижденÑ"
#: eventapplet.cpp:149
msgid "Events of the next week"
msgstr "ÐодÑÑ Ð½Ð°ÑÑÑпного ÑижнÑ"
#: eventapplet.cpp:150
msgid "Next 4 weeks"
msgstr "ÐаÑÑÑÐ¿Ð½Ñ 4 ÑижнÑ"
#: eventapplet.cpp:150
msgid "Events for the next 4 weeks"
msgstr "ÐодÑÑ Ð½Ð°ÑÑÑпниÑ
4 ÑижнÑв"
#: eventapplet.cpp:151
msgid "Later"
msgstr "ÐÑзнÑÑе"
#: eventapplet.cpp:151
msgid "Events later than 4 weeks"
msgstr "ÐодÑÑ, ÑÐºÑ Ð²ÑдбÑдÑÑÑÑÑ Ð¿ÑзнÑÑе, нÑж ÑеÑез 4 ÑижнÑ"
#: eventapplet.cpp:297 eventapplet.cpp:435
msgid "Upcoming Events"
msgstr "ÐайближÑÑ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:351
msgid "Select Resources"
msgstr "ÐбÑаÑи ÑеÑÑÑÑи"
#: eventapplet.cpp:402
msgid "Open \"%1\""
msgstr "ÐÑдкÑиÑи «%1»"
#: eventapplet.cpp:409
msgid "Add new event"
msgstr "ÐодаÑи Ð½Ð¾Ð²Ñ Ð¿Ð¾Ð´ÑÑ"
#: eventapplet.cpp:414
msgid "Add new todo"
msgstr "ÐодаÑи Ð½Ð¾Ð²Ñ ÑпÑавÑ"
#: eventapplet.cpp:419
msgid "Select shown resources"
msgstr "ÐбÑаÑи Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ñ ÑеÑÑÑÑи"
#: eventapplet.cpp:436
msgid "Upcoming events from Akonadi resources"
msgstr "ÐайближÑÑ Ð¿Ð¾Ð´ÑÑ Ñз ÑеÑÑÑÑÑв Akonadi"
#: eventapplet.cpp:464
msgid "General"
msgstr ""
#: eventapplet.cpp:465
msgid "Text Format"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑÑ"
#: eventapplet.cpp:466
msgid "Colors"
msgstr "ÐолÑоÑи"
#: eventmodel.cpp:141
msgid "The Akonadi server is not running!"
msgstr "СеÑÐ²ÐµÑ Akonadi не пÑаÑÑÑ!"
#: eventmodel.cpp:174
msgid "Earlier stuff"
msgstr "РанÑÑе"
#: eventmodel.cpp:174
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "ÐезавеÑÑÐµÐ½Ñ ÑпÑави, подÑÑ, ÑÐºÑ Ñе вÑдбÑваÑÑÑÑÑ Ñ Ñ. д."
#: eventmodel.cpp:178
msgid "Some day"
msgstr "ЯкийÑÑ Ð´ÐµÐ½Ñ"
#: eventmodel.cpp:178
msgid "Todos with no due date"
msgstr "СпÑави без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ"
#: eventmodel.cpp:431 eventmodel.cpp:432 eventmodel.cpp:484 eventmodel.cpp:485
#: formatconfig.cpp:40
msgid "Unspecified"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:55
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: generalconfig.cpp:49 rc.cpp:187
#, fuzzy
msgid "Title"
msgstr "ЧаÑ"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#. i18n: file: eventappletgeneralconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletGeneralConfig)
#: rc.cpp:3 rc.cpp:94 rc.cpp:177
msgid "Form"
msgstr "ФоÑма"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "ЧаÑ"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "ТеÑмÑновÑÑÑÑ Ð½Ð¾ÑмалÑниÑ
подÑй:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "ЧаÑ, Ñо лиÑивÑÑ Ð´Ð¾ познаÑÐµÐ½Ð½Ñ Ð¿Ð¾Ð´ÑÑ ÑакоÑ, Ñка ÑкоÑо поÑинаÑÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "Ñ
в"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "ТеÑмÑновÑÑÑÑ Ð´Ð½Ñв наÑодженÑ:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr ""
"ЧаÑ, Ñо лиÑивÑÑ Ð´Ð¾ познаÑÐµÐ½Ð½Ñ Ð´Ð½Ñ Ð½Ð°ÑÐ¾Ð´Ð¶ÐµÐ½Ð½Ñ Ð°Ð±Ð¾ ÑÑÑниÑÑ ÑакоÑ, Ñка ÑкоÑо "
"поÑнеÑÑÑÑ."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "днÑв"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "ÐолÑоÑи ноÑмалÑниÑ
подÑй"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Фоновий колÑÑ Ð½Ð°Ð¹Ð±Ð»Ð¸Ð¶ÑиÑ
подÑй:"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Фоновий колÑÑ Ð¿Ð¾Ð´Ñй, ÑÐºÑ ÑкоÑо поÑнÑÑÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (text), widget (QLabel, label_13)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_14)
#: rc.cpp:36 rc.cpp:58 rc.cpp:77 rc.cpp:87
msgid "Opacity:"
msgstr "ÐÑозоÑÑÑÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:238
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, korganizerOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:81 rc.cpp:91
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "ÐолÑÑ ÑекÑÑÑ Ð´Ð»Ñ Ð¿ÑопÑÑениÑ
подÑй Ñи подÑй, ÑÐºÑ ÑозпоÑалиÑÑ:"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "ÐолÑÑ ÑекÑÑÑ Ð´Ð»Ñ Ð¿ÑопÑÑениÑ
подÑй Ñи подÑй, ÑÐºÑ Ñже ÑозпоÑалиÑÑ."
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:49
msgid "Colors for todos"
msgstr "ÐолÑÑ Ð´Ð»Ñ ÑпÑав"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:52
msgid "Backgroundcolor for todos:"
msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑпÑав:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for common todos."
msgstr "Фоновий колÑÑ Ð·Ð°Ð³Ð°Ð»ÑниÑ
ÑпÑав."
#. i18n: file: eventappletcolorconfig.ui:194
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:65
msgid "Show or hide already finished todos."
msgstr "ÐоказаÑи Ñи ÑÑ
оваÑи вже зÑÐ¾Ð±Ð»ÐµÐ½Ñ ÑпÑави."
#. i18n: file: eventappletcolorconfig.ui:197
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:68
msgid "Show finished todos"
msgstr "ÐоказаÑи зÑÐ¾Ð±Ð»ÐµÐ½Ñ ÑпÑави"
#. i18n: file: eventappletcolorconfig.ui:217
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:71
msgid "Background for finished todos:"
msgstr "Фоновий колÑÑ Ð´Ð»Ñ Ð·Ð°Ð²ÐµÑÑениÑ
ÑпÑав:"
#. i18n: file: eventappletcolorconfig.ui:224
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:74
msgid "The backgroundcolor for already finished todos."
msgstr "Фоновий колÑÑ Ñже зÑоблениÑ
ÑпÑав."
#. i18n: file: eventappletcolorconfig.ui:251
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:84
msgid "KOrganizer colors"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:97
msgid "Event text formatting"
msgstr "ФоÑмаÑÑÐ²Ð°Ð½Ð½Ñ ÑекÑÑÑ Ð¿Ð¾Ð´ÑÑ"
#. i18n: file: eventappletformatconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:100
msgid "Format for normal events:"
msgstr "ФоÑÐ¼Ð°Ñ Ð½Ð¾ÑмалÑниÑ
подÑй:"
#. i18n: file: eventappletformatconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:103
msgid "The text displayed for common events."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð·Ð°Ð³Ð°Ð»ÑниÑ
подÑй."
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (text), widget (QPushButton, addCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:73
#. i18n: ectx: property (text), widget (QPushButton, addHeaderButton)
#: rc.cpp:108 rc.cpp:196
msgid "Add"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:79
#. i18n: ectx: property (text), widget (QPushButton, copyCategoryButton)
#: rc.cpp:111
msgid "Copy"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:86
#. i18n: ectx: property (text), widget (QPushButton, removeCategoryButton)
#. i18n: file: eventappletgeneralconfig.ui:80
#. i18n: ectx: property (text), widget (QPushButton, removeHeaderButton)
#: rc.cpp:114 rc.cpp:199
msgid "Remove"
msgstr ""
#. i18n: file: eventappletformatconfig.ui:100
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:118
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions (mostly self-explanatory) are:\n"
-"%{startDate}, %{endDate}, %{startTime}, %{endTime},\n"
-"%{summary}, %{description}, %{location}, %{duration},\n"
+"%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - "
+"start and end time,\n"
+"%{summary} - summary, %{description} - description, %{location} - location, %"
+"{duration} - duration,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑекÑÑÑ Ð¿Ð¾Ð´Ñй.\n"
"ÐÑдÑÑановками Ñ:\n"
"%{startDate} â даÑа поÑаÑкÑ, %{endDate} â даÑа закÑнÑеннÑ,\n"
"%{startTime} â ÑÐ°Ñ Ð¿Ð¾ÑаÑкÑ, %{endTime} â ÑÐ°Ñ Ð·Ð°ÐºÑнÑеннÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑ,\n"
"%{location} â ÑозÑаÑÑваннÑ, %{duration} â ÑÑивалÑÑÑÑ Ñ Ð³Ð¾Ð´Ð¸Ð½Ð°Ñ
,\n"
"%{yearsSince} â ÑокÑв, поÑинаÑÑи Ñз пеÑÑого ÑÐ°Ð·Ñ (коÑиÑно Ð´Ð»Ñ Ð´Ð½Ñв "
"наÑодженÑ),\n"
"%{resourceName} â ÑнÑеÑнаÑÑоналÑзована назва ÑеÑÑÑÑÑ Akonadi,\n"
"%{tab} - ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:110
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:128
msgid "Todo text formatting"
msgstr "ФоÑÐ¼Ð°Ñ ÑекÑÑÑ ÑпÑав"
#. i18n: file: eventappletformatconfig.ui:122
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:132
#, fuzzy, no-c-format
msgid ""
"The format for the displayed text for todos.\n"
"Substutions (again mostly self-explanatory) are:\n"
-"%{dueDate}, %{dueTime}, %{startDate}, %{startTime},\n"
-"%{summary}, %{description}, %{percent}, %{location},\n"
+"%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - "
+"start date and time,\n"
+"%{summary} - summary, %{description} - description, %{percent} - finished "
+"percent, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{mainCategory}, %{categories} - the first or all categories,\n"
"%{tab} - a tabulator"
msgstr ""
"ФоÑÐ¼Ð°Ñ ÑекÑÑÑ ÑпÑав.\n"
"ÐÑдÑÑановками Ñ:\n"
"%{dueDate} â даÑа виконаннÑ, %{dueTime} â ÑÐ°Ñ Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ,\n"
"%{startDate} â даÑа поÑаÑкÑ, %{startTime} â ÑÐ°Ñ Ð¿Ð¾ÑаÑкÑ,\n"
"%{summary} â ÑезÑме, %{description} â опиÑ,\n"
"%{percent} â вÑдÑоÑок завеÑÑеннÑ, %{location} â ÑозмÑÑеннÑ,\n"
"%{resourceName} â ÑнÑеÑнаÑÑоналÑзована назва ÑеÑÑÑÑÑ Akonadi,\n"
"%{tab} â ÑабÑлÑÑоÑ"
#. i18n: file: eventappletformatconfig.ui:129
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:141
msgid "Format for todos:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð»Ñ ÑпÑав:"
#. i18n: file: eventappletformatconfig.ui:136
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:144
msgid "The text displayed for common todos."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð·Ð°Ð³Ð°Ð»ÑниÑ
ÑпÑав."
#. i18n: file: eventappletformatconfig.ui:146
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:147
msgid "Todos with no due date:"
msgstr "СпÑави без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ:"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:150
msgid "The text displayed for todos with no due date."
msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ ÑпÑав без Ð¿ÐµÐ²Ð½Ð¾Ñ Ð´Ð°Ñи виконаннÑ."
#. i18n: file: eventappletformatconfig.ui:163
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:153
msgid "Date appearance settings"
msgstr "ÐалаÑÑÑÐ²Ð°Ð½Ð½Ñ Ð´Ð°Ñи"
#. i18n: file: eventappletformatconfig.ui:169
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:156
msgid "Date format:"
msgstr "ФоÑÐ¼Ð°Ñ Ð´Ð°Ñи:"
#. i18n: file: eventappletformatconfig.ui:176
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:159
msgid "What date format to use."
msgstr "Який ÑоÑÐ¼Ð°Ñ Ð´Ð°Ñи викоÑиÑÑовÑваÑи."
#. i18n: file: eventappletformatconfig.ui:180
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:162
msgid "KDE ShortDate"
msgstr "ÐоÑоÑка даÑа KDE"
#. i18n: file: eventappletformatconfig.ui:185
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:165
msgid "KDE LongDate"
msgstr "Ðовга даÑа KDE"
#. i18n: file: eventappletformatconfig.ui:190
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:168
msgid "Custom"
msgstr "ÐовÑлÑний"
#. i18n: file: eventappletformatconfig.ui:198
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:171
msgid "Custom format:"
msgstr "ÐовÑлÑний ÑоÑмаÑ:"
#. i18n: file: eventappletformatconfig.ui:205
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:174
msgid "A string describing the custom format. It is using the QDate syntax."
msgstr "Ð Ñдок, Ñкий опиÑÑÑ Ð´Ð¾Ð²ÑлÑний ÑоÑмаÑ. ÐикоÑиÑÑовÑÑÑÑÑÑ ÑинÑакÑÐ¸Ñ QDate."
#. i18n: file: eventappletgeneralconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_5)
#: rc.cpp:180
msgid "Header sections"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:27
#. i18n: ectx: property (toolTip), widget (QTreeWidget, headerWidget)
#: rc.cpp:183
msgid ""
"Add your own headers here, start is the first day of the period counting "
"from today,\n"
"it will stretch to the next header or end of the displayed timeframe."
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:60
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:190
msgid "Tooltip"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:65
#. i18n: ectx: property (text), widget (QTreeWidget, headerWidget)
#: rc.cpp:193
msgid "Start"
msgstr ""
#. i18n: file: eventappletgeneralconfig.ui:90
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:202
msgid "Miscellenous options"
msgstr "ÐодаÑÐºÐ¾Ð²Ñ Ð½Ð°Ð»Ð°ÑÑÑваннÑ"
#. i18n: file: eventappletgeneralconfig.ui:96
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:205
msgid "Period to show incidences (in days):"
msgstr "ÐеÑÑод Ð¿Ð¾ÐºÐ°Ð·Ñ Ð¿Ð¾Ð´Ñй (Ñ Ð´Ð½ÑÑ
):"
#. i18n: file: eventappletgeneralconfig.ui:103
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:208
msgid "The time frame to show incidences."
msgstr "ЧаÑовий ÐºÐ°Ð´Ñ Ð¿Ð¾ÐºÐ°Ð·Ñ Ð¿Ð¾Ð´Ñй."
#: rc.cpp:209
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Oleksandr Natalenko"
#: rc.cpp:210
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#~ msgid "Colors for recurring events"
#~ msgstr "ÐолÑоÑи подÑй, Ñо повÑоÑÑÑÑÑÑÑ"
#~ msgid "Backgroundcolor for Birthdays:"
#~ msgstr "Фоновий колÑÑ Ð´Ð½Ñв наÑодженÑ:"
#~ msgid "The backgroundcolor for birthdays."
#~ msgstr "Фоновий колÑÑ Ð´Ð½Ñв наÑодженÑ."
#~ msgid "Backgroundcolor for Anniversaries:"
#~ msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑÑÑниÑÑ:"
#~ msgid "The backgroundcolor for anniversaries."
#~ msgstr "Фоновий колÑÑ Ð´Ð»Ñ ÑÑÑниÑÑ."
#~ msgid "Birthday & Anniversaries:"
#~ msgstr "ÐÐ½Ñ Ð½Ð°ÑÐ¾Ð´Ð¶ÐµÐ½Ñ Ñа ÑÑÑниÑÑ:"
#~ msgid "The text displayed for birthdays or anniversaries."
#~ msgstr "ТекÑÑ, Ñкий показÑÑÑÑÑÑ Ð´Ð»Ñ Ð´Ð½Ñв наÑÐ¾Ð´Ð¶ÐµÐ½Ñ Ñи ÑÑÑниÑÑ."
#~ msgid "Open event"
#~ msgstr "ÐÑдкÑиÑи подÑÑ"
#~ msgid "Open todo"
#~ msgstr "ÐÑдкÑиÑи ÑпÑавÑ"
#~ msgid "Urgency:"
#~ msgstr "ТеÑмÑновÑÑÑÑ:"
diff --git a/src/applet/eventappletformatconfig.ui b/src/applet/eventappletformatconfig.ui
index 9f9488f..6dd76ea 100644
--- a/src/applet/eventappletformatconfig.ui
+++ b/src/applet/eventappletformatconfig.ui
@@ -1,241 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletFormatConfig</class>
<widget class="QWidget" name="EventAppletFormatConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>582</width>
+ <width>604</width>
<height>837</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Event text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format for normal events:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KLineEdit" name="normalEventEdit">
<property name="toolTip">
<string>The text displayed for common events.</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="4">
<widget class="QTreeWidget" name="categoryFormatWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string notr="true">Category</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">Format</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="addCategoryButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="copyCategoryButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="removeCategoryButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>The format for the displayed text for events.
Substitutions (mostly self-explanatory) are:
-%{startDate}, %{endDate}, %{startTime}, %{endTime},
-%{summary}, %{description}, %{location}, %{duration},
+%{startDate}, %{endDate} - start and end date, %{startTime}, %{endTime} - start and end time,
+%{summary} - summary, %{description} - description, %{location} - location, %{duration} - duration,
%{yearsSince} - years since the first time (useful for birthdays),
%{resourceName} - the i18n name of the Akonadi resource,
%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Todo text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>The format for the displayed text for todos.
Substutions (again mostly self-explanatory) are:
-%{dueDate}, %{dueTime}, %{startDate}, %{startTime},
-%{summary}, %{description}, %{percent}, %{location},
+%{dueDate}, %{dueTime} - due date and time, %{startDate}, %{startTime} - start date and time,
+%{summary} - summary, %{description} - description, %{percent} - finished percent, %{location} - location,
%{resourceName} - the i18n name of the Akonadi resource,
%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Format for todos:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="todoEdit">
<property name="toolTip">
<string>The text displayed for common todos.</string>
</property>
<property name="statusTip">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Todos with no due date:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="noDueDateEdit">
<property name="toolTip">
<string>The text displayed for todos with no due date.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Date appearance settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Date format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="dateFormatBox">
<property name="toolTip">
<string>What date format to use.</string>
</property>
<item>
<property name="text">
<string>KDE ShortDate</string>
</property>
</item>
<item>
<property name="text">
<string>KDE LongDate</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Custom format:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="customFormatEdit">
<property name="toolTip">
<string>A string describing the custom format. It is using the QDate syntax.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
|
geflei/plasmoid-eventlist | c18603ca38486c38e6ea64f1855133b8cb992958 | set palette for the view on theme changes | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index f8268b6..9ea255f 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,664 +1,683 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
+
+ QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
+ QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
+ QColor altBaseColor = baseColor.darker(150);
+ QColor buttonColor = altBaseColor;
+ baseColor.setAlpha(50);
+ altBaseColor.setAlpha(50);
+ buttonColor.setAlpha(150);
+
+ QPalette p = palette();
+ p.setColor(QPalette::Base, baseColor);
+ p.setColor(QPalette::AlternateBase, altBaseColor);
+ p.setColor(QPalette::Button, buttonColor);
+ p.setColor(QPalette::Foreground, textColor);
+ p.setColor(QPalette::Text, textColor);
+
+ m_view->viewport()->setPalette(p);
+ m_view->setPalette(p);
+
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
|
geflei/plasmoid-eventlist | 7e31108ec8c19f0e3c56a0687561ede1e3b767de | add categories | diff --git a/src/applet/eventappletformatconfig.ui b/src/applet/eventappletformatconfig.ui
index 935164f..9f9488f 100644
--- a/src/applet/eventappletformatconfig.ui
+++ b/src/applet/eventappletformatconfig.ui
@@ -1,240 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletFormatConfig</class>
<widget class="QWidget" name="EventAppletFormatConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>363</width>
+ <width>582</width>
<height>837</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Event text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format for normal events:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KLineEdit" name="normalEventEdit">
<property name="toolTip">
<string>The text displayed for common events.</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="4">
<widget class="QTreeWidget" name="categoryFormatWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
<column>
<property name="text">
<string notr="true">Category</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">Format</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="addCategoryButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="copyCategoryButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="removeCategoryButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>The format for the displayed text for events.
-Substitutions are:
-%{startDate} - start date, %{endDate} - end date,
-%{startTime} - start time, %{endTime} - end time,
-%{summary} - summary, %{description} - description,
-%{location} - location, %{duration} - duration in hours,
+Substitutions (mostly self-explanatory) are:
+%{startDate}, %{endDate}, %{startTime}, %{endTime},
+%{summary}, %{description}, %{location}, %{duration},
%{yearsSince} - years since the first time (useful for birthdays),
%{resourceName} - the i18n name of the Akonadi resource,
+%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Todo text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
- <string>The format fot the displayed text for todos.
-Substutions are:
-%{dueDate} - the date due, %{dueTime} - the time due,
-%{startDate} - the start date, %{startTime} - the start time,
-%{summary} - summary, %{description} - description,
-%{percent} - percent completed, %{location} - location,
+ <string>The format for the displayed text for todos.
+Substutions (again mostly self-explanatory) are:
+%{dueDate}, %{dueTime}, %{startDate}, %{startTime},
+%{summary}, %{description}, %{percent}, %{location},
%{resourceName} - the i18n name of the Akonadi resource,
+%{mainCategory}, %{categories} - the first or all categories,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Format for todos:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="todoEdit">
<property name="toolTip">
<string>The text displayed for common todos.</string>
</property>
<property name="statusTip">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Todos with no due date:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="noDueDateEdit">
<property name="toolTip">
<string>The text displayed for todos with no due date.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Date appearance settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Date format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="dateFormatBox">
<property name="toolTip">
<string>What date format to use.</string>
</property>
<item>
<property name="text">
<string>KDE ShortDate</string>
</property>
</item>
<item>
<property name="text">
<string>KDE LongDate</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Custom format:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="customFormatEdit">
<property name="toolTip">
<string>A string describing the custom format. It is using the QDate syntax.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/eventitemdelegate.cpp b/src/applet/eventitemdelegate.cpp
index 09e285c..3f14798 100644
--- a/src/applet/eventitemdelegate.cpp
+++ b/src/applet/eventitemdelegate.cpp
@@ -1,197 +1,200 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventitemdelegate.h"
#include "eventmodel.h"
// #include <Plasma/Svg>
// #include <Plasma/Theme>
#include <KGlobal>
#include <KLocale>
#include <KMacroExpanderBase>
#include <QDateTime>
#include <QHash>
#include <QTextDocument>
#include <QPainter>
#include <QAbstractTextDocumentLayout>
// #include <QRectF>
// #include <QStyleOptionViewItem>
EventItemDelegate::EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString)
: QStyledItemDelegate(parent),
m_normal(normal),
m_todo(todo),
m_noDueDate(noDueDate),
m_dateString(dtString),
m_dateFormat(dtFormat)
{
}
EventItemDelegate::~EventItemDelegate()
{
}
QString EventItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
Q_UNUSED(locale);
QMap<QString, QVariant> data = value.toMap();
QString mainCategory = data["mainCategory"].toString();
int itemType = data["itemType"].toInt();
switch (itemType) {
case EventModel::HeaderItem:
return data["title"].toString();
break;
case EventModel::NormalItem:
case EventModel::BirthdayItem:
case EventModel::AnniversaryItem:
if (m_categoryFormats.contains(mainCategory))
return KMacroExpander::expandMacros(m_categoryFormats.value(mainCategory), eventHash(data));
else
return KMacroExpander::expandMacros(m_normal, eventHash(data));
break;
case EventModel::TodoItem:
if (data["hasDueDate"].toBool() == FALSE)
return KMacroExpander::expandMacros(m_noDueDate, todoHash(data));
else
return KMacroExpander::expandMacros(m_todo, todoHash(data));
break;
default:
break;
}
return QString();
}
void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
painter->save();
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
QVariant value = index.data();
QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
QBrush fgBrush = qvariant_cast<QBrush>(index.data(Qt::ForegroundRole));
painter->setClipRect( opt.rect );
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setBackground(Qt::transparent);
painter->setBrush(bgBrush);
if (bgBrush.style() != Qt::NoBrush) {
QPen bgPen;
bgPen.setColor(bgBrush.color().darker(250));
bgPen.setStyle(Qt::SolidLine);
bgPen.setWidth(1);
painter->setPen(bgPen);
painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
}
QTextDocument doc;
doc.setDocumentMargin(3);
doc.setDefaultStyleSheet("* {color: " + fgBrush.color().name() + ";}");
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
QAbstractTextDocumentLayout::PaintContext context;
doc.setPageSize( opt.rect.size());
painter->translate(opt.rect.x(), opt.rect.y());
doc.documentLayout()->draw(painter, context);
painter->restore();
}
QSize EventItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QVariant value = index.data();
QTextDocument doc;
doc.setDocumentMargin(3);
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
doc.setTextWidth(option.rect.width());
return doc.size().toSize();
}
QHash<QString, QString> EventItemDelegate::eventHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
ulong s;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("endDate", formattedDate(data["endDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("endTime", KGlobal::locale()->formatTime(data["endDate"].toTime()));
s = data["startDate"].toDateTime().secsTo(data["endDate"].toDateTime());
dataHash.insert("duration", KGlobal::locale()->prettyFormatDuration(s * 1000));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("yearsSince", data["yearsSince"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
- dataHash.insert("mainCategory", data["mainCategory"].toString());
+ dataHash.insert("mainCategory", data["mainCategory"].toString());
+ dataHash.insert("categories", data["categories"].toString());
dataHash.insert("tab", "\t");
return dataHash;
}
QHash<QString, QString> EventItemDelegate::todoHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("dueDate", formattedDate(data["dueDate"]));
dataHash.insert("dueTime", KGlobal::locale()->formatTime(data["dueDate"].toTime()));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
+ dataHash.insert("mainCategory", data["mainCategory"].toString());
+ dataHash.insert("categories", data["categories"].toString());
dataHash.insert("percent", QString::number(data["percent"].toInt()));
dataHash.insert("tab", "\t");
return dataHash;
}
void EventItemDelegate::setCategoryFormats(QMap<QString, QString> formats)
{
m_categoryFormats = formats;
}
QString EventItemDelegate::formattedDate(const QVariant &dtTime) const
{
QString date;
if (dtTime.toDateTime().isValid()) {
switch (m_dateFormat) {
case ShortDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::ShortDate);
break;
case LongDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::LongDate);
break;
case CustomDateFormat:
date = dtTime.toDate().toString(m_dateString);
break;
}
}
return date;
}
void EventItemDelegate::settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString)
{
m_normal = normal;
m_todo= todo;
m_noDueDate = noDueDate;
m_dateFormat = format;
m_dateString = customString;
}
|
geflei/plasmoid-eventlist | 08f69b4294f2018f54704eb09ce27a4241dc2490 | add tooltip | diff --git a/src/applet/eventappletgeneralconfig.ui b/src/applet/eventappletgeneralconfig.ui
index 3ad7bed..c60b05a 100644
--- a/src/applet/eventappletgeneralconfig.ui
+++ b/src/applet/eventappletgeneralconfig.ui
@@ -1,143 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletGeneralConfig</class>
<widget class="QWidget" name="EventAppletGeneralConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>422</width>
<height>518</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Header sections</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="headerWidget">
+ <property name="toolTip">
+ <string>Add your own headers here, start is the first day of the period counting from today,
+it will stretch to the next header or end of the displayed timeframe.</string>
+ </property>
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
+ <property name="expandsOnDoubleClick">
+ <bool>false</bool>
+ </property>
<property name="columnCount">
<number>3</number>
</property>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="headerStretchLastSection">
+ <bool>true</bool>
+ </attribute>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string>Tooltip</string>
</property>
</column>
<column>
<property name="text">
- <string>Begin</string>
+ <string>Start</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="addHeaderButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeHeaderButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Miscellenous options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Period to show incidences (in days):</string>
</property>
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="periodBox">
<property name="toolTip">
<string>The time frame to show incidences.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>365</number>
</property>
<property name="value">
<number>365</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>113</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>186</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
|
geflei/plasmoid-eventlist | d2ee19386625256464e2cb3fb2b3775fc3e47dbe | small update to french translation | diff --git a/po/fr.po b/po/fr.po
index c78bcb8..ff76507 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,500 +1,500 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Cédric Bellegarde <[email protected]>, 2010.
# Gerd Fleischer <[email protected]>, 2011.
+# Cédric Bellegarde <[email protected]>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2010-09-28 20:34+0200\n"
-"PO-Revision-Date: 2011-01-01 12:22+0100\n"
-"Last-Translator: Gerd Fleischer <[email protected]>\n"
+"PO-Revision-Date: 2011-02-07 09:13+0100\n"
+"Last-Translator: Cédric Bellegarde <[email protected]>\n"
"Language-Team: French <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
-"X-Generator: Lokalize 1.1\n"
+"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: eventapplet.cpp:210 eventapplet.cpp:347
msgid "Upcoming Events"
msgstr "Evénements à venir"
#: eventapplet.cpp:263
msgid "Select Resources"
msgstr "Sélectionner les ressources"
#: eventapplet.cpp:314
msgid "Open \"%1\""
msgstr "Ouvrir \"%1\""
#: eventapplet.cpp:321
msgid "Add new event"
msgstr "Ajouter un événement"
#: eventapplet.cpp:326
msgid "Add new todo"
msgstr "Ajouter une nouvelle tâche"
#: eventapplet.cpp:331
msgid "Select shown resources"
msgstr "Ressources à afficher"
#: eventapplet.cpp:348
msgid "Upcoming events from Akonadi resources"
msgstr "Evénements à venirs (ressources Akonadi)"
#: eventapplet.cpp:370
msgid "Text Format"
msgstr "Format du texte"
#: eventapplet.cpp:371
msgid "Colors"
msgstr "Couleurs"
#: eventmodel.cpp:78
msgid "Earlier stuff"
msgstr "Evénements précédents"
#: eventmodel.cpp:78
msgid "Unfinished todos, still ongoing earlier events etc."
msgstr "Tâches non terminées, événements passés encore en cours à venir etc"
#: eventmodel.cpp:83
msgid "Today"
msgstr "Aujourd'hui"
#: eventmodel.cpp:83
msgid "Events of today"
msgstr "Evénements pour aujourd'hui"
#: eventmodel.cpp:88
msgid "Tomorrow"
msgstr "Demain"
#: eventmodel.cpp:88
msgid "Events for tomorrow"
msgstr "Evénement pour demain"
#: eventmodel.cpp:93
msgid "Week"
msgstr "Semaine à venir"
#: eventmodel.cpp:93
msgid "Events of the next week"
msgstr "Evénements pour la semaine prochaine"
#: eventmodel.cpp:98
msgid "Next 4 weeks"
msgstr "Quatre prochaines semaines"
#: eventmodel.cpp:98
msgid "Events for the next 4 weeks"
msgstr "Evénements pour les quatre prochaines semaines"
#: eventmodel.cpp:103
msgid "Later"
msgstr "Plus tard"
#: eventmodel.cpp:103
msgid "Events later than 4 weeks"
msgstr "Evénements dans plus de 4 semaines"
#: eventmodel.cpp:108
msgid "Some day"
msgstr "Un jour ou l'autre"
#: eventmodel.cpp:108
msgid "Todos with no due date"
msgstr "Tâches sans date de fin"
#: eventmodel.cpp:202
msgid "The Akonadi server is not running!"
msgstr "Le serveur Akonadi ne fonctionne pas!"
#: eventmodel.cpp:302
msgid "Birthday"
msgstr "Anniversaires"
#. i18n: file: eventappletcolorconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletColorConfig)
#. i18n: file: eventappletformatconfig.ui:14
#. i18n: ectx: property (windowTitle), widget (QWidget, EventAppletFormatConfig)
#: rc.cpp:3 rc.cpp:113
msgid "Form"
msgstr "Formulaire"
#. i18n: file: eventappletcolorconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, timeBox)
#: rc.cpp:6
msgid "Times"
msgstr "Heure"
#. i18n: file: eventappletcolorconfig.ui:26
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:9
msgid "Urgency for normal events:"
msgstr "Priorité des événement normaux:"
#. i18n: file: eventappletcolorconfig.ui:33
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:12
msgid "The time left until an event is marked as soon beginning."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:36
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgencyBox)
#: rc.cpp:15
msgid "min"
msgstr "min"
#. i18n: file: eventappletcolorconfig.ui:59
#. i18n: ectx: property (text), widget (QLabel, label_11)
#: rc.cpp:18
msgid "Urgency for birthdays:"
msgstr "Priorité pour les anniversaires:"
#. i18n: file: eventappletcolorconfig.ui:66
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:21
msgid "The days left until a birthday or anniversary is marked as being soon."
msgstr "Temps restant avant qu'un événement soit marqué comme proche."
#. i18n: file: eventappletcolorconfig.ui:69
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayUrgencyBox)
#: rc.cpp:24
msgid "days"
msgstr "jours"
#. i18n: file: eventappletcolorconfig.ui:82
#. i18n: ectx: property (title), widget (QGroupBox, normalEventsBox)
#: rc.cpp:27
msgid "Colors for normal events"
msgstr "Couleur des événement normaux"
#. i18n: file: eventappletcolorconfig.ui:88
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:30
msgid "Backgroundcolor for near events:"
msgstr "Couleur de fond pour les événements proches"
#. i18n: file: eventappletcolorconfig.ui:101
#. i18n: ectx: property (toolTip), widget (KColorButton, urgentColorButton)
#: rc.cpp:33
msgid "The backgroundcolor for soon beginning events."
msgstr "Couleur de fond pour les événements débutant prochainnement"
#. i18n: file: eventappletcolorconfig.ui:108
#. i18n: ectx: property (text), widget (QLabel, label_5)
#. i18n: file: eventappletcolorconfig.ui:174
#. i18n: ectx: property (text), widget (QLabel, label_6)
#. i18n: file: eventappletcolorconfig.ui:211
#. i18n: ectx: property (text), widget (QLabel, label_7)
#. i18n: file: eventappletcolorconfig.ui:257
#. i18n: ectx: property (text), widget (QLabel, label_10)
#. i18n: file: eventappletcolorconfig.ui:314
#. i18n: ectx: property (text), widget (QLabel, label_13)
#: rc.cpp:36 rc.cpp:58 rc.cpp:71 rc.cpp:87 rc.cpp:106
msgid "Opacity:"
msgstr "Opacité:"
#. i18n: file: eventappletcolorconfig.ui:115
#. i18n: ectx: property (suffix), widget (KIntSpinBox, urgentOpacity)
#. i18n: file: eventappletcolorconfig.ui:181
#. i18n: ectx: property (suffix), widget (KIntSpinBox, birthdayOpacity)
#. i18n: file: eventappletcolorconfig.ui:218
#. i18n: ectx: property (suffix), widget (KIntSpinBox, anniversariesOpacity)
#. i18n: file: eventappletcolorconfig.ui:264
#. i18n: ectx: property (suffix), widget (KIntSpinBox, todoOpacity)
#. i18n: file: eventappletcolorconfig.ui:321
#. i18n: ectx: property (suffix), widget (KIntSpinBox, finishedTodoOpacity)
#: rc.cpp:40 rc.cpp:62 rc.cpp:75 rc.cpp:91 rc.cpp:110
#, no-c-format
msgid "%"
msgstr "%"
#. i18n: file: eventappletcolorconfig.ui:125
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:43
msgid "Textcolor for started or passed events:"
msgstr "Couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:138
#. i18n: ectx: property (toolTip), widget (KColorButton, startedColorButton)
#: rc.cpp:46
msgid "The textcolor for already started or passed events."
msgstr "La couleur du texte pour les événements en cours ou passés"
#. i18n: file: eventappletcolorconfig.ui:148
#. i18n: ectx: property (title), widget (QGroupBox, recurringEventsBox)
#: rc.cpp:49
msgid "Colors for recurring events"
msgstr "Couleur pour les événements récurrents"
#. i18n: file: eventappletcolorconfig.ui:154
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:52
msgid "Backgroundcolor for Birthdays:"
msgstr "Couleur de fond pour les anniversaires:"
#. i18n: file: eventappletcolorconfig.ui:167
#. i18n: ectx: property (toolTip), widget (KColorButton, birthdayColorButton)
#: rc.cpp:55
msgid "The backgroundcolor for birthdays."
msgstr "La couleur de fond pour les anniversaires."
#. i18n: file: eventappletcolorconfig.ui:191
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:65
msgid "Backgroundcolor for Anniversaries:"
msgstr "Couleur de fond des commémorations:"
#. i18n: file: eventappletcolorconfig.ui:204
#. i18n: ectx: property (toolTip), widget (KColorButton, anniversariesColorButton)
#: rc.cpp:68
msgid "The backgroundcolor for anniversaries."
msgstr "La couleur de fond des commémorations."
#. i18n: file: eventappletcolorconfig.ui:231
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:78
msgid "Colors for todos"
msgstr "Couleur des tâches"
#. i18n: file: eventappletcolorconfig.ui:237
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:81
msgid "Backgroundcolor for todos:"
msgstr "Couleur de fond pour les tâches:"
#. i18n: file: eventappletcolorconfig.ui:250
#. i18n: ectx: property (toolTip), widget (KColorButton, todoColorButton)
#: rc.cpp:84
msgid "The backgroundcolor for common todos."
msgstr "La couleur de fond pour les tâches."
#. i18n: file: eventappletcolorconfig.ui:277
#. i18n: ectx: property (toolTip), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:94
msgid "Show or hide already finished todos."
msgstr "Montrer ou cacher les tâches terminées"
#. i18n: file: eventappletcolorconfig.ui:280
#. i18n: ectx: property (text), widget (QCheckBox, showFinishedTodos)
#: rc.cpp:97
msgid "Show finished todos"
msgstr "Montrer les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:300
#. i18n: ectx: property (text), widget (QLabel, label_12)
#: rc.cpp:100
msgid "Background for finished todos:"
msgstr "Couleur de fond pour les tâches terminées:"
#. i18n: file: eventappletcolorconfig.ui:307
#. i18n: ectx: property (toolTip), widget (KColorButton, finishedTodoButton)
#: rc.cpp:103
msgid "The backgroundcolor for already finished todos."
msgstr "La couleur de fond des des tâches déjà terminées."
#. i18n: file: eventappletformatconfig.ui:20
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_2)
#: rc.cpp:116
msgid "Event text formatting"
msgstr "Format des événements"
#. i18n: file: eventappletformatconfig.ui:34
#. i18n: ectx: property (text), widget (QLabel, label_5)
#: rc.cpp:120
#, no-c-format
msgid ""
"The format for the displayed text for events.\n"
"Substitutions are:\n"
"%{startDate} - start date, %{endDate} - end date,\n"
"%{startTime} - start time, %{endTime} - end time,\n"
"%{summary} - summary, %{description} - description,\n"
"%{location} - location, %{duration} - duration in hours,\n"
"%{yearsSince} - years since the first time (useful for birthdays),\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{tab} - a tabulator"
msgstr ""
"Format du texte des événements.\n"
"Les substitutions sont:\n"
"%{startDate} - Date de départ, %{endDate} - Date de fin,\n"
"%{startTime} - Heure de départ, %{endTime} - Heure de fin,\n"
"%{summary} - Résumé, %{description} - Description,\n"
"%{location} - Emplacement, %{duration} - Durée en, heure,\n"
"%{yearsSince} - Années depuis la première fois (utile pour les "
"anniversaires),\n"
"%{resourceName} - Le nom de la ressource Akonadi,\n"
"%{tab} - Tabulation"
#. i18n: file: eventappletformatconfig.ui:41
#. i18n: ectx: property (text), widget (QLabel, label_3)
#: rc.cpp:131
msgid "Format for normal events:"
msgstr "Format des événement normaux:"
#. i18n: file: eventappletformatconfig.ui:48
#. i18n: ectx: property (toolTip), widget (KLineEdit, normalEventEdit)
#: rc.cpp:134
msgid "The text displayed for common events."
msgstr "Texte affiché des événements normaux"
#. i18n: file: eventappletformatconfig.ui:55
#. i18n: ectx: property (text), widget (QLabel, label_4)
#: rc.cpp:137
msgid "Birthday & Anniversaries:"
msgstr "Anniversaires et commémorations:"
#. i18n: file: eventappletformatconfig.ui:62
#. i18n: ectx: property (toolTip), widget (KLineEdit, recurringEventsEdit)
#: rc.cpp:140
msgid "The text displayed for birthdays or anniversaries."
msgstr "Texte affiché pour les commémorations"
#. i18n: file: eventappletformatconfig.ui:72
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_4)
#: rc.cpp:143
msgid "Todo text formatting"
msgstr "Format des tâches"
#. i18n: file: eventappletformatconfig.ui:85
#. i18n: ectx: property (text), widget (QLabel, label_7)
#: rc.cpp:147
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"The format fot the displayed text for todos.\n"
"Substutions are:\n"
"%{dueDate} - the date due, %{dueTime} - the time due,\n"
"%{startDate} - the start date, %{startTime} - the start time,\n"
"%{summary} - summary, %{description} - description,\n"
"%{percent} - percent completed, %{location} - location,\n"
"%{resourceName} - the i18n name of the Akonadi resource,\n"
"%{tab} - a tabulator"
msgstr ""
-"Format du texte des événements.\n"
+"Le format pour le texte des tâches à faire:\n"
"Les substitutions sont:\n"
-"%{startDate} - Date de départ, %{endDate} - Date de fin,\n"
-"%{startTime} - Heure de départ, %{endTime} - Heure de fin,\n"
-"%{summary} - Résumé, %{description} - Description,\n"
-"%{location} - Emplacement, %{duration} - Durée en, heure,\n"
-"%{yearsSince} - Années depuis la première fois (utile pour les "
-"anniversaires),\n"
-"%{resourceName} - Le nom de la ressource Akonadi,\n"
-"%{tab} - Tabulation"
+"%{dueDate} - la date de fin, %{dueTime} - l'heure de fin,\n"
+"%{startDate} - la date de départ, %{startTime} - l'heure de départ,\n"
+"%{summary} - le résumé, %{description} - la description,\n"
+"%{percent} - pourcentage accompli, %{location} - emplacement,\n"
+"%{resourceName} - le nom de la ressource Akonadi,\n"
+"%{tab} - une tabulation"
#. i18n: file: eventappletformatconfig.ui:92
#. i18n: ectx: property (text), widget (QLabel, label_8)
#: rc.cpp:157
msgid "Format for todos:"
msgstr "Format des tâches:"
#. i18n: file: eventappletformatconfig.ui:99
#. i18n: ectx: property (toolTip), widget (KLineEdit, todoEdit)
#: rc.cpp:160
msgid "The text displayed for common todos."
msgstr "Texte affiché pour les tâches"
#. i18n: file: eventappletformatconfig.ui:109
#. i18n: ectx: property (text), widget (QLabel, label_9)
#: rc.cpp:163
msgid "Todos with no due date:"
msgstr "Tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:116
#. i18n: ectx: property (toolTip), widget (KLineEdit, noDueDateEdit)
#: rc.cpp:166
msgid "The text displayed for todos with no due date."
msgstr "Texte affiché pour les tâches sans date de fin"
#. i18n: file: eventappletformatconfig.ui:126
#. i18n: ectx: property (title), widget (QGroupBox, groupBox)
#: rc.cpp:169
msgid "Date appearance settings"
msgstr "Apparance des dates"
#. i18n: file: eventappletformatconfig.ui:132
#. i18n: ectx: property (text), widget (QLabel, label)
#: rc.cpp:172
msgid "Date format:"
msgstr "Format des dates:"
#. i18n: file: eventappletformatconfig.ui:139
#. i18n: ectx: property (toolTip), widget (KComboBox, dateFormatBox)
#: rc.cpp:175
msgid "What date format to use."
msgstr "Quel format de date utilisé"
#. i18n: file: eventappletformatconfig.ui:143
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:178
msgid "KDE ShortDate"
msgstr "Dates KDE courtes"
#. i18n: file: eventappletformatconfig.ui:148
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:181
msgid "KDE LongDate"
msgstr "Dates KDE longues"
#. i18n: file: eventappletformatconfig.ui:153
#. i18n: ectx: property (text), item, widget (KComboBox, dateFormatBox)
#: rc.cpp:184
msgid "Custom"
msgstr "Personnalisé"
#. i18n: file: eventappletformatconfig.ui:161
#. i18n: ectx: property (text), widget (QLabel, label_2)
#: rc.cpp:187
msgid "Custom format:"
msgstr "Format personnalisé:"
#. i18n: file: eventappletformatconfig.ui:168
#. i18n: ectx: property (toolTip), widget (KLineEdit, customFormatEdit)
#: rc.cpp:190
msgid "A string describing the custom format. It is using the QDate syntax."
-msgstr "Une chaîne décrivant le format personnalisé (utilisation de la syntaxe QDate)"
+msgstr ""
+"Une chaîne décrivant le format personnalisé (utilisation de la syntaxe QDate)"
#. i18n: file: eventappletformatconfig.ui:178
#. i18n: ectx: property (title), widget (QGroupBox, groupBox_3)
#: rc.cpp:193
msgid "Miscellenous options"
msgstr "Options diverses"
#. i18n: file: eventappletformatconfig.ui:184
#. i18n: ectx: property (text), widget (QLabel, label_6)
#: rc.cpp:196
msgid "Period to show incidences (in days):"
msgstr "Durée d'affichage d'un événement (en jours):"
#. i18n: file: eventappletformatconfig.ui:191
#. i18n: ectx: property (toolTip), widget (KIntSpinBox, periodBox)
#: rc.cpp:199
msgid "The time frame to show incidences."
msgstr "Intervalle de temps pour l'affichage"
#: rc.cpp:200
msgctxt "NAME OF TRANSLATORS"
msgid "Your names"
msgstr "Lannehoa Yves"
#: rc.cpp:201
msgctxt "EMAIL OF TRANSLATORS"
msgid "Your emails"
msgstr "[email protected]"
#, fuzzy
#~ msgid "Open event"
#~ msgstr "Ouvrir l'événement courant"
#~ msgid "Urgency:"
#~ msgstr "Urgence"
#~ msgid "%1 retries to start/connect to the Akonadi server"
#~ msgstr "%1 essais de connexion au serveur Akonadi"
#~ msgid "Could not connect to the Akonadi server"
#~ msgstr "Ne peut se connecter au serveur Akonadi"
|
geflei/plasmoid-eventlist | c59246469b7451d708f3766184a98d130e9584bd | subclass QTreewidgetItem - enable correct sorting | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 923455a..f8268b6 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,669 +1,664 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
QStringList headerList;
headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
m_headerItemsList = cg.readEntry("HeaderItems", headerList);
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
title->setStyleSheet(currentStyle);
- QFont bold = title->font();
- bold.setBold(true);
- title->setFont(bold);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
title = new Plasma::Label();
- title->setText(i18n("Upcoming Events"));
- QFont bold = font();
- bold.setBold(true);
- title->setFont(bold);
+ title->setText("<b>" + i18n("Upcoming Events") + "</b>");
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *generalWidget = new QWidget();
m_generalConfig.setupUi(generalWidget);
HeaderDelegate *hd = new HeaderDelegate();
m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
m_generalConfig.setupConnections();
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(generalWidget, i18n("General"), "view-list-tree");
parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
for (int i = 0; i < m_headerItemsList.size(); i += 3) {
QStringList itemText;
itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
- QTreeWidgetItem *headerItem = new QTreeWidgetItem(itemText);
+ TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_generalConfig.headerWidget->addTopLevelItem(headerItem);
}
+ m_generalConfig.headerWidget->sortByColumn(2, Qt::AscendingOrder);
m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QStringList oldHeaderList = m_headerItemsList;
m_headerItemsList.clear();
QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
while (*hi) {
m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
++hi;
}
cg.writeEntry("HeaderItems", m_headerItemsList);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_generalConfig.periodBox->value();
cg.writeEntry("Period", m_period);
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldHeaderList != m_headerItemsList) {
m_model->setHeaderItems(m_headerItemsList);
m_model->resetModel();
} else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventappletgeneralconfig.ui b/src/applet/eventappletgeneralconfig.ui
index 3606e10..3ad7bed 100644
--- a/src/applet/eventappletgeneralconfig.ui
+++ b/src/applet/eventappletgeneralconfig.ui
@@ -1,140 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletGeneralConfig</class>
<widget class="QWidget" name="EventAppletGeneralConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>422</width>
<height>518</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Header sections</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="headerWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
<property name="columnCount">
<number>3</number>
</property>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string>Tooltip</string>
</property>
</column>
<column>
<property name="text">
<string>Begin</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="addHeaderButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeHeaderButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Miscellenous options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Period to show incidences (in days):</string>
</property>
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="periodBox">
<property name="toolTip">
<string>The time frame to show incidences.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>365</number>
</property>
<property name="value">
<number>365</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>113</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>186</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/generalconfig.cpp b/src/applet/generalconfig.cpp
index 56db794..7f15d7e 100644
--- a/src/applet/generalconfig.cpp
+++ b/src/applet/generalconfig.cpp
@@ -1,100 +1,99 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2011 by gerdfleischer <[email protected]>
*/
#include "generalconfig.h"
-#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
#include <KDebug>
GeneralConfig::GeneralConfig(QWidget *parent)
: QWidget(parent)
{
}
GeneralConfig::~GeneralConfig()
{
}
void GeneralConfig::setupConnections()
{
connect(addHeaderButton, SIGNAL(clicked()), this, SLOT(slotAddHeader()));
connect(removeHeaderButton, SIGNAL(clicked()), this, SLOT(slotRemoveHeader()));
connect(headerWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(checkItem(QTreeWidgetItem *, int)));
}
void GeneralConfig::slotAddHeader()
{
QList<int> used = usedDays();
int begin = 32;
while (used.contains(begin)) {
++begin;
}
QStringList itemText;
itemText << i18n("Title") << QString("Your tooltip") << QString::number(begin);
- QTreeWidgetItem *headerItem = new QTreeWidgetItem(itemText);
+ TreeWidgetItem *headerItem = new TreeWidgetItem(itemText);
headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
headerWidget->addTopLevelItem(headerItem);
}
void GeneralConfig::slotRemoveHeader()
{
if (headerWidget->currentItem()->text(2) == QString::number(0))
return;
int index = headerWidget->indexOfTopLevelItem(headerWidget->currentItem());
headerWidget->takeTopLevelItem(index);
}
QList<int> GeneralConfig::usedDays()
{
QList<int> usedDays;
QTreeWidgetItemIterator it(headerWidget);
while (*it) {
usedDays << (*it)->text(2).toInt();
++it;
}
return usedDays;
}
void GeneralConfig::checkItem(QTreeWidgetItem *item, int column)
{
if (column != 2)
return;
QList<int> usedDays;
QTreeWidgetItemIterator it(headerWidget);
while (*it) {
if (*it != item) {
usedDays << (*it)->text(2).toInt();
}
++it;
}
int begin = item->text(2).toInt();
if (usedDays.contains(begin)) {
while (usedDays.contains(begin)) {
++begin;
}
item->setText(2, QString::number(begin));
}
}
diff --git a/src/applet/generalconfig.h b/src/applet/generalconfig.h
index 8d755ee..5b06709 100644
--- a/src/applet/generalconfig.h
+++ b/src/applet/generalconfig.h
@@ -1,42 +1,60 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2011 by gerdfleischer <[email protected]>
*/
#ifndef GENERALCONFIG_H
#define GENERALCONFIG_H
+#include <QTreeWidgetItem>
+
#include "ui_eventappletgeneralconfig.h"
+class TreeWidgetItem : public QTreeWidgetItem
+{
+public:
+ TreeWidgetItem(QTreeWidget *tree) : QTreeWidgetItem(tree) {}
+ TreeWidgetItem(const QStringList &strings) :QTreeWidgetItem (strings) {}
+ bool operator< (const QTreeWidgetItem &other) const
+ {
+ int sortCol = treeWidget()->sortColumn();
+ if (sortCol != 2)
+ return QTreeWidgetItem::operator<(other);
+ int myNumber = text(sortCol).toInt();
+ int otherNumber = other.text(sortCol).toInt();
+ return myNumber < otherNumber;
+ }
+};
+
class GeneralConfig : public QWidget, public Ui::EventAppletGeneralConfig
{
Q_OBJECT
public:
GeneralConfig(QWidget *parent = 0);
~GeneralConfig();
void setupConnections();
private slots:
void slotAddHeader();
void slotRemoveHeader();
void checkItem(QTreeWidgetItem *item, int column);
private:
QList<int> usedDays();
};
#endif
|
geflei/plasmoid-eventlist | a0caa9c49f843f0add2e58def4c6fb199e2864e1 | large update, add ability to define your own header may have regressions | diff --git a/src/applet/CMakeLists.txt b/src/applet/CMakeLists.txt
index e32d2fd..2a9aec6 100644
--- a/src/applet/CMakeLists.txt
+++ b/src/applet/CMakeLists.txt
@@ -1,31 +1,33 @@
project(EVENTAPPLET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(eventapplet_SRCS
eventapplet.cpp
eventmodel.cpp
eventfiltermodel.cpp
eventtreeview.cpp
eventitemdelegate.cpp
korganizerappletutil.cpp
+ generalconfig.cpp
formatconfig.cpp
+ headerdelegate.cpp
)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.korganizer.Korganizer.xml korganizer_interface)
qt4_add_dbus_interface(eventapplet_SRCS org.kde.Korganizer.Calendar.xml calendar_interface)
-kde4_add_ui_files(eventapplet_SRCS eventappletformatconfig.ui eventappletcolorconfig.ui)
+kde4_add_ui_files(eventapplet_SRCS eventappletgeneralconfig.ui eventappletformatconfig.ui eventappletcolorconfig.ui)
kde4_add_plugin(plasma_applet_events ${eventapplet_SRCS})
target_link_libraries(plasma_applet_events
${KDE4_PLASMA_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_AKONADI_LIBS}
${KDE4_KCAL_LIBS}
${KDE4_KABC_LIBS}
${KDEPIMLIBS_AKONADI_KCAL_LIBS})
install(TARGETS plasma_applet_events DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-events.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 2fcf8ee..923455a 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,627 +1,669 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
+#include "headerdelegate.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
#include <KStandardDirs>
#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
m_categoryColorWatch = new KDirWatch(this);
m_categoryColorWatch->addFile(koConfigPath);
connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
+ QStringList headerList;
+ headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
+ headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
+ headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
+ headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
+ headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
+ m_headerItemsList = cg.readEntry("HeaderItems", headerList);
+
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
+ m_model->setHeaderItems(m_headerItemsList);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
+ QString currentStyle = Plasma::Theme::defaultTheme()->styleSheet();
+ title->setStyleSheet(currentStyle);
+ QFont bold = title->font();
+ bold.setBold(true);
+ title->setFont(bold);
colorizeModel(FALSE);
}
void EventApplet::koConfigChanged()
{
KConfigGroup cg = config();
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
m_model->setCategoryColors(m_categoryColors);
colorizeModel(FALSE);
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
- Plasma::Label *title = new Plasma::Label();
+ title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
+ QWidget *generalWidget = new QWidget();
+ m_generalConfig.setupUi(generalWidget);
+ HeaderDelegate *hd = new HeaderDelegate();
+ m_generalConfig.headerWidget->setItemDelegateForColumn(2, hd);
+ m_generalConfig.setupConnections();
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
- parent->addPage(formatWidget, i18n("Text Format"), icon());
+ parent->addPage(generalWidget, i18n("General"), "view-list-tree");
+ parent->addPage(formatWidget, i18n("Text Format"), "format-text-code");
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
+ for (int i = 0; i < m_headerItemsList.size(); i += 3) {
+ QStringList itemText;
+ itemText << m_headerItemsList.value(i) << m_headerItemsList.value(i + 1) << m_headerItemsList.value(i + 2);
+ QTreeWidgetItem *headerItem = new QTreeWidgetItem(itemText);
+ headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
+ m_generalConfig.headerWidget->addTopLevelItem(headerItem);
+ }
+ m_generalConfig.periodBox->setValue(cg.readEntry("Period", 365));
+
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
- m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
+ QStringList oldHeaderList = m_headerItemsList;
+ m_headerItemsList.clear();
+ QTreeWidgetItemIterator hi(m_generalConfig.headerWidget);
+ while (*hi) {
+ m_headerItemsList << (*hi)->text(0) << (*hi)->text(1) << (*hi)->text(2);
+ ++hi;
+ }
+ cg.writeEntry("HeaderItems", m_headerItemsList);
+
+ int oldPeriod = cg.readEntry("Period", 365);
+ m_period = m_generalConfig.periodBox->value();
+ cg.writeEntry("Period", m_period);
+
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
- int oldPeriod = cg.readEntry("Period", 365);
- m_period = m_formatConfig.periodBox->value();
- cg.writeEntry("Period", m_period);
-
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
- if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
+ if (oldHeaderList != m_headerItemsList) {
+ m_model->setHeaderItems(m_headerItemsList);
+ m_model->resetModel();
+ } else if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
+ QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
+ m_model->setData(headerIndex, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
- QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index 1bd0ba5..f73073a 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,116 +1,119 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
+#include "generalconfig.h"
#include "formatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
class KDirWatch;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
void plasmaThemeChanged();
void koConfigChanged();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
KDirWatch *m_categoryColorWatch;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
+ Plasma::Label *title;
EventItemDelegate *m_delegate;
+ GeneralConfig m_generalConfig;
FormatConfig m_formatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
- QStringList disabledResources;
+ QStringList disabledResources, m_headerItemsList;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
};
#endif
diff --git a/src/applet/eventappletformatconfig.ui b/src/applet/eventappletformatconfig.ui
index 92c1b9e..935164f 100644
--- a/src/applet/eventappletformatconfig.ui
+++ b/src/applet/eventappletformatconfig.ui
@@ -1,293 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletFormatConfig</class>
<widget class="QWidget" name="EventAppletFormatConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>476</width>
- <height>937</height>
+ <width>363</width>
+ <height>837</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Event text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="4">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>The format for the displayed text for events.
-Substitutions are:
-%{startDate} - start date, %{endDate} - end date,
-%{startTime} - start time, %{endTime} - end time,
-%{summary} - summary, %{description} - description,
-%{location} - location, %{duration} - duration in hours,
-%{yearsSince} - years since the first time (useful for birthdays),
-%{resourceName} - the i18n name of the Akonadi resource,
-%{tab} - a tabulator</string>
- </property>
- </widget>
- </item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format for normal events:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KLineEdit" name="normalEventEdit">
<property name="toolTip">
<string>The text displayed for common events.</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="4">
<widget class="QTreeWidget" name="categoryFormatWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
- <attribute name="headerStretchLastSection">
- <bool>true</bool>
- </attribute>
<column>
<property name="text">
<string notr="true">Category</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">Format</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="addCategoryButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="copyCategoryButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="removeCategoryButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
+ <item row="0" column="0" colspan="4">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>The format for the displayed text for events.
+Substitutions are:
+%{startDate} - start date, %{endDate} - end date,
+%{startTime} - start time, %{endTime} - end time,
+%{summary} - summary, %{description} - description,
+%{location} - location, %{duration} - duration in hours,
+%{yearsSince} - years since the first time (useful for birthdays),
+%{resourceName} - the i18n name of the Akonadi resource,
+%{tab} - a tabulator</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Todo text formatting</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>The format fot the displayed text for todos.
Substutions are:
%{dueDate} - the date due, %{dueTime} - the time due,
%{startDate} - the start date, %{startTime} - the start time,
%{summary} - summary, %{description} - description,
%{percent} - percent completed, %{location} - location,
%{resourceName} - the i18n name of the Akonadi resource,
%{tab} - a tabulator</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Format for todos:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="todoEdit">
<property name="toolTip">
<string>The text displayed for common todos.</string>
</property>
<property name="statusTip">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Todos with no due date:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="noDueDateEdit">
<property name="toolTip">
<string>The text displayed for todos with no due date.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Date appearance settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Date format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="dateFormatBox">
<property name="toolTip">
<string>What date format to use.</string>
</property>
<item>
<property name="text">
<string>KDE ShortDate</string>
</property>
</item>
<item>
<property name="text">
<string>KDE LongDate</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Custom format:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="customFormatEdit">
<property name="toolTip">
<string>A string describing the custom format. It is using the QDate syntax.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Miscellenous options</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Period to show incidences (in days):</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntSpinBox" name="periodBox">
- <property name="toolTip">
- <string>The time frame to show incidences.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>365</number>
- </property>
- <property name="value">
- <number>365</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>113</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
- <customwidget>
- <class>KIntSpinBox</class>
- <extends>QSpinBox</extends>
- <header>knuminput.h</header>
- </customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/eventappletgeneralconfig.ui b/src/applet/eventappletgeneralconfig.ui
new file mode 100644
index 0000000..3606e10
--- /dev/null
+++ b/src/applet/eventappletgeneralconfig.ui
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EventAppletGeneralConfig</class>
+ <widget class="QWidget" name="EventAppletGeneralConfig">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>422</width>
+ <height>518</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="title">
+ <string>Header sections</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0" colspan="2">
+ <widget class="QTreeWidget" name="headerWidget">
+ <property name="indentation">
+ <number>0</number>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <property name="columnCount">
+ <number>3</number>
+ </property>
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Tooltip</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Begin</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="addHeaderButton">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="removeHeaderButton">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Miscellenous options</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Period to show incidences (in days):</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KIntSpinBox" name="periodBox">
+ <property name="toolTip">
+ <string>The time frame to show incidences.</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>365</number>
+ </property>
+ <property name="value">
+ <number>365</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>113</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>186</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KIntSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>knuminput.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 52734e2..4ca5d5d 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,573 +1,533 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
- olderItem(0),
- todayItem(0),
- tomorrowItem(0),
- weekItem(0),
- monthItem(0),
- laterItem(0),
- somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
- if (!olderItem) {
- olderItem = new QStandardItem();
- initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
- }
-
- if (!todayItem) {
- todayItem = new QStandardItem();
- initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
- }
-
- if (!tomorrowItem) {
- tomorrowItem = new QStandardItem();
- initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
- }
-
- if (!weekItem) {
- weekItem = new QStandardItem();
- initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
- }
-
- if (!monthItem) {
- monthItem = new QStandardItem();
- initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
- }
-
- if (!laterItem) {
- laterItem = new QStandardItem();
- initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
- }
-
- if (!somedayItem) {
- somedayItem = new QStandardItem();
- initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
- }
-
- // this list should always be sorted by date
- sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
+ createHeaderItems(m_headerPartsList);
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
- olderItem = 0;
- todayItem = 0;
- tomorrowItem = 0;
- weekItem = 0;
- monthItem = 0;
- laterItem = 0;
- somedayItem = 0;
- sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
+void EventModel::setHeaderItems(QStringList headerParts)
+{
+ m_headerPartsList = headerParts;
+}
+
+void EventModel::createHeaderItems(QStringList headerParts)
+{
+ m_sectionItemsMap.clear();
+
+ QStandardItem *olderItem = new QStandardItem();
+ initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
+ m_sectionItemsMap.insert(olderItem->data(SortRole).toDate(), olderItem);
+
+ QStandardItem *somedayItem = new QStandardItem();
+ initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
+ m_sectionItemsMap.insert(somedayItem->data(SortRole).toDate(), somedayItem);
+
+ for (int i = 0; i < headerParts.size(); i += 3) {
+ QStandardItem *item = new QStandardItem();
+ initHeaderItem(item, headerParts.value(i), headerParts.value(i + 1), headerParts.value(i + 2).toInt());
+ m_sectionItemsMap.insert(item->data(SortRole).toDate(), item);
+ }
+}
+
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
- foreach (QStandardItem *i, sectionItems) {
+ foreach (QStandardItem *i, m_sectionItemsMap) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else if (m_categoryColors.contains(category)) {
todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
- foreach (QStandardItem *item, sectionItems) {
+ foreach (QStandardItem *item, m_sectionItemsMap) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
- parentItem->insertRow(figureRow(headerItem), headerItem);
+ parentItem->appendRow(headerItem);
+ parentItem->sortChildren(0, Qt::AscendingOrder);
}
emit modelNeedsExpanding();
}
}
-int EventModel::figureRow(QStandardItem *headerItem)
-{
- int row = 0;
-
- foreach (QStandardItem *item, sectionItems) {
- if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
- break;
- if (item->row() != -1)
- row = item->row() + 1;
- }
-
- return row;
-}
-
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index c488d42..5df8e68 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,113 +1,115 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int todoColorPos = 2;
static const int finishedTodoColorPos = 3;
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(const QHash<QString, QColor>);
+ void setHeaderItems(QStringList headerParts);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
+ void createHeaderItems(QStringList headerParts);
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
- int figureRow(QStandardItem *headerItem);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
- QStandardItem *parentItem, *olderItem, *todayItem, *tomorrowItem, *weekItem, *monthItem, *laterItem, *somedayItem;
- QList<QStandardItem *> sectionItems;
+ QStandardItem *parentItem;
+ QStringList m_headerPartsList;
+ QMap<QDate, QStandardItem *> m_sectionItemsMap;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, todoBg, finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
diff --git a/src/applet/generalconfig.cpp b/src/applet/generalconfig.cpp
new file mode 100644
index 0000000..56db794
--- /dev/null
+++ b/src/applet/generalconfig.cpp
@@ -0,0 +1,100 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 2011 by gerdfleischer <[email protected]>
+ */
+
+#include "generalconfig.h"
+
+#include <QTreeWidgetItem>
+#include <QTreeWidgetItemIterator>
+
+#include <KDebug>
+
+GeneralConfig::GeneralConfig(QWidget *parent)
+ : QWidget(parent)
+{
+}
+
+GeneralConfig::~GeneralConfig()
+{
+}
+
+void GeneralConfig::setupConnections()
+{
+ connect(addHeaderButton, SIGNAL(clicked()), this, SLOT(slotAddHeader()));
+ connect(removeHeaderButton, SIGNAL(clicked()), this, SLOT(slotRemoveHeader()));
+ connect(headerWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(checkItem(QTreeWidgetItem *, int)));
+}
+
+void GeneralConfig::slotAddHeader()
+{
+ QList<int> used = usedDays();
+ int begin = 32;
+ while (used.contains(begin)) {
+ ++begin;
+ }
+
+ QStringList itemText;
+ itemText << i18n("Title") << QString("Your tooltip") << QString::number(begin);
+ QTreeWidgetItem *headerItem = new QTreeWidgetItem(itemText);
+ headerItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
+ headerWidget->addTopLevelItem(headerItem);
+}
+
+void GeneralConfig::slotRemoveHeader()
+{
+ if (headerWidget->currentItem()->text(2) == QString::number(0))
+ return;
+
+ int index = headerWidget->indexOfTopLevelItem(headerWidget->currentItem());
+ headerWidget->takeTopLevelItem(index);
+}
+
+QList<int> GeneralConfig::usedDays()
+{
+ QList<int> usedDays;
+ QTreeWidgetItemIterator it(headerWidget);
+ while (*it) {
+ usedDays << (*it)->text(2).toInt();
+ ++it;
+ }
+
+ return usedDays;
+}
+
+void GeneralConfig::checkItem(QTreeWidgetItem *item, int column)
+{
+ if (column != 2)
+ return;
+
+ QList<int> usedDays;
+ QTreeWidgetItemIterator it(headerWidget);
+ while (*it) {
+ if (*it != item) {
+ usedDays << (*it)->text(2).toInt();
+ }
+ ++it;
+ }
+
+ int begin = item->text(2).toInt();
+ if (usedDays.contains(begin)) {
+ while (usedDays.contains(begin)) {
+ ++begin;
+ }
+ item->setText(2, QString::number(begin));
+ }
+
+
+}
diff --git a/src/applet/generalconfig.h b/src/applet/generalconfig.h
new file mode 100644
index 0000000..8d755ee
--- /dev/null
+++ b/src/applet/generalconfig.h
@@ -0,0 +1,42 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 2011 by gerdfleischer <[email protected]>
+ */
+
+#ifndef GENERALCONFIG_H
+#define GENERALCONFIG_H
+
+#include "ui_eventappletgeneralconfig.h"
+
+class GeneralConfig : public QWidget, public Ui::EventAppletGeneralConfig
+{
+ Q_OBJECT
+
+public:
+ GeneralConfig(QWidget *parent = 0);
+ ~GeneralConfig();
+ void setupConnections();
+
+private slots:
+ void slotAddHeader();
+ void slotRemoveHeader();
+ void checkItem(QTreeWidgetItem *item, int column);
+
+private:
+ QList<int> usedDays();
+};
+
+#endif
+
diff --git a/src/applet/headerdelegate.cpp b/src/applet/headerdelegate.cpp
new file mode 100644
index 0000000..5e56051
--- /dev/null
+++ b/src/applet/headerdelegate.cpp
@@ -0,0 +1,67 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 2011 by gerdfleischer <[email protected]>
+ *
+ * almost copied from the spinbox delegate example
+ */
+
+#include "headerdelegate.h"
+
+#include <KNumInput>
+
+HeaderDelegate::HeaderDelegate(QObject* parent)
+ : QStyledItemDelegate(parent)
+{
+}
+
+HeaderDelegate::~HeaderDelegate()
+{
+}
+
+QWidget *HeaderDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &index) const
+{
+ int value = index.model()->data(index, Qt::EditRole).toString().toInt();
+ if (value == 0)
+ return 0;
+
+ KIntSpinBox *editor = new KIntSpinBox(parent);
+ editor->setMinimum(1);
+ editor->setMaximum(365);
+
+ return editor;
+}
+
+void HeaderDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+{
+ int value = index.model()->data(index, Qt::EditRole).toString().toInt();
+
+ KIntSpinBox *spinBox = static_cast<KIntSpinBox*>(editor);
+ spinBox->setValue(value);
+}
+
+void HeaderDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+{
+ KIntSpinBox *spinBox = static_cast<KIntSpinBox*>(editor);
+ spinBox->interpretText();
+ int value = spinBox->value();
+
+ model->setData(index, QString::number(value), Qt::EditRole);
+}
+
+void HeaderDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
+{
+ editor->setGeometry(option.rect);
+}
+
diff --git a/src/applet/headerdelegate.h b/src/applet/headerdelegate.h
new file mode 100644
index 0000000..2a97727
--- /dev/null
+++ b/src/applet/headerdelegate.h
@@ -0,0 +1,38 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 2011 by gerdfleischer <[email protected]>
+ */
+
+#ifndef HEADERDELEGATE_H
+#define HEADERDELEGATE_H
+
+#include <QStyledItemDelegate>
+
+class HeaderDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+
+public:
+ HeaderDelegate(QObject* parent = 0);
+ ~HeaderDelegate();
+
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+};
+
+#endif
+
|
geflei/plasmoid-eventlist | cfc41b4ccf09e1ffc919df7c7377590d614927fd | watch for category color changes | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index f04a23d..2fcf8ee 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,609 +1,627 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
+#include <KStandardDirs>
+#include <KDirWatch>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
+
+ QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
+ m_categoryColorWatch = new KDirWatch(this);
+ m_categoryColorWatch->addFile(koConfigPath);
+ connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
+ connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));
+
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::plasmaThemeChanged()
{
colorizeModel(FALSE);
}
+void EventApplet::koConfigChanged()
+{
+ KConfigGroup cg = config();
+ int opacity = cg.readEntry("KOOpacity", 10);
+ setupCategoryColors(opacity);
+ m_model->setCategoryColors(m_categoryColors);
+ colorizeModel(FALSE);
+}
+
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
Plasma::Label *title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(formatWidget, i18n("Text Format"), icon());
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_formatConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index f822671..1bd0ba5 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,114 +1,116 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
#include "formatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
+class KDirWatch;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
void plasmaThemeChanged();
+ void koConfigChanged();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
-// Plasma::TreeView *m_view;
+ KDirWatch *m_categoryColorWatch;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
EventItemDelegate *m_delegate;
FormatConfig m_formatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
QStringList disabledResources;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
};
#endif
|
geflei/plasmoid-eventlist | ee5602a206499e391f238adf2056b91554bbaab0 | avoid crash | diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index 7f144af..c488d42 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,115 +1,113 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
-static const int birthdayColorPos = 2;
-static const int anniversariesColorPos = 3;
-static const int todoColorPos = 4;
-static const int finishedTodoColorPos = 5;
+static const int todoColorPos = 2;
+static const int finishedTodoColorPos = 3;
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(const QHash<QString, QColor>);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
int figureRow(QStandardItem *headerItem);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
QStandardItem *parentItem, *olderItem, *todayItem, *tomorrowItem, *weekItem, *monthItem, *laterItem, *somedayItem;
QList<QStandardItem *> sectionItems;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, todoBg, finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | 2c67283e0685e9c33605c51238852903bc1999c5 | listen to themechanges | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 80a1c1d..f04a23d 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,603 +1,609 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
-
+ connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
+
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
+void EventApplet::plasmaThemeChanged()
+{
+ colorizeModel(FALSE);
+}
+
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
Plasma::Label *title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(formatWidget, i18n("Text Format"), icon());
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_formatConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index 3c89e15..f822671 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,113 +1,114 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
#include "formatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
+ void plasmaThemeChanged();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
// Plasma::TreeView *m_view;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
EventItemDelegate *m_delegate;
FormatConfig m_formatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
QStringList disabledResources;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
};
#endif
|
geflei/plasmoid-eventlist | 7c0f0a96ecc11a022defa92caaf20a28125c3139 | also todos can have a category | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index 78694d1..80a1c1d 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -79,525 +79,525 @@ EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
Plasma::Label *title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(formatWidget, i18n("Text Format"), icon());
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_formatConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
- const QVariant v = index.data(Qt::DisplayRole);
- QMap<QString, QVariant> values = v.toMap();
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
+ } else if (m_categoryColors.contains(category)) {
+ m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index e24f794..52734e2 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,567 +1,573 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday"))) {
b = i18n("Birthday");
}
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
+ QString category = values["mainCategory"].toString();
+
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
+ } else if (m_categoryColors.contains(category)) {
+ todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
+ } else if (m_categoryColors.contains(category)) {
+ todoItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = event->categoriesStr();
values["mainCategory"] = categories.first();
}
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
QStringList categories = todo->categories();
if (categories.isEmpty()) {
values["categories"] = i18n("Unspecified");
values["mainCategory"] = i18n("Unspecified");
} else {
values["categories"] = todo->categoriesStr();
values["mainCategory"] = categories.first();
}
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | c42edbcec240661ba288263c0d0d42ac2c90f479 | remove support for custom birthday colors | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index fc5b147..78694d1 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,643 +1,603 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
- m_birthdayBg = QColor(cg.readEntry("BirthdayColor", QString("#C0FFC0")));
- m_birthdayBg.setAlphaF(cg.readEntry("BirthdayOpacity", 10)/100.0);
- m_colors.insert(birthdayColorPos, m_birthdayBg);
- m_anniversaryBg = QColor(cg.readEntry("AnniversariesColor", QString("#ABFFEA")));
- m_anniversaryBg.setAlphaF(cg.readEntry("AnniversariesOpacity", 10)/100.0);
- m_colors.insert(anniversariesColorPos, m_anniversaryBg);
-
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
- m_useKoColors = cg.readEntry("UseKoColors", TRUE);
- int opacity = cg.readEntry("KOOpacity", 10);
+ int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
- QStringList keys, values;
- keys << i18n("Birthday") << i18n("Holiday");
- values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
- keys = cg.readEntry("CategoryFormatsKeys", keys);
- values = cg.readEntry("CategoryFormatsValues", values);
+ QStringList keys, values;
+ keys << i18n("Birthday") << i18n("Holiday");
+ values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
+ keys = cg.readEntry("CategoryFormatsKeys", keys);
+ values = cg.readEntry("CategoryFormatsValues", values);
- for (int i = 0; i < keys.size(); ++i) {
- m_categoryFormat.insert(keys.at(i), values.at(i));
- }
+ for (int i = 0; i < keys.size(); ++i) {
+ m_categoryFormat.insert(keys.at(i), values.at(i));
+ }
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
- m_delegate->setCategoryFormats(m_categoryFormat);
+ m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
- m_model->setCategoryColors(m_useKoColors, m_categoryColors);
- m_model->initModel();
- m_model->initMonitor();
+ m_model->setCategoryColors(m_categoryColors);
+ m_model->initModel();
+ m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
- cColor.setAlphaF(opacity/100.0);
- m_categoryColors.insert(category, cColor);
- }
+ cColor.setAlphaF(opacity/100.0);
+ m_categoryColors.insert(category, cColor);
+ }
}
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
Plasma::Label *title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
- m_formatConfig.setupConnections();
+ m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(formatWidget, i18n("Text Format"), icon());
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
- QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
+ QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
- itemText << i.key() << i.value();
- QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
- categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
- m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
+ itemText << i.key() << i.value();
+ QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
+ categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
+ m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
- m_colorConfigUi.birthdayColorButton->setColor(QColor(cg.readEntry("BirthdayColor", QString("#C0FFC0"))));
- m_colorConfigUi.birthdayOpacity->setValue(cg.readEntry("BirthdayOpacity", 10));
- m_colorConfigUi.anniversariesColorButton->setColor(QColor(cg.readEntry("AnniversariesColor", QString("#ABFFEA"))));
- m_colorConfigUi.anniversariesOpacity->setValue(cg.readEntry("AnniversariesOpacity", 10));
-
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
- m_colorConfigUi.useKOrganizerColors->setChecked(cg.readEntry("UseKoColors", TRUE));
- m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
+ m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_formatConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
- m_birthdayBg = m_colorConfigUi.birthdayColorButton->color();
- int birthdayOpacity = m_colorConfigUi.birthdayOpacity->value();
- cg.writeEntry("BirthdayColor", m_birthdayBg.name());
- cg.writeEntry("BirthdayOpacity", birthdayOpacity);
- m_birthdayBg.setAlphaF(birthdayOpacity/100.0);
- m_colors.insert(birthdayColorPos, m_birthdayBg);
-
- m_anniversaryBg = m_colorConfigUi.anniversariesColorButton->color();
- int anniversariesOpacity = m_colorConfigUi.anniversariesOpacity->value();
- cg.writeEntry("AnniversariesColor", m_anniversaryBg.name());
- cg.writeEntry("AnniversariesOpacity", anniversariesOpacity);
- m_anniversaryBg.setAlphaF(anniversariesOpacity/100.0);
- m_colors.insert(anniversariesColorPos, m_anniversaryBg);
-
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
- bool oldUseKoColors = m_useKoColors;
- m_useKoColors = m_colorConfigUi.useKOrganizerColors->isChecked();
- cg.writeEntry("UseKoColors", m_useKoColors);
- QHash<QString, QColor> oldColorHash = m_categoryColors;
- int opacity = m_colorConfigUi.korganizerOpacity->value();
- cg.writeEntry("KOOpacity", opacity);
- setupCategoryColors(opacity);
-
- m_categoryFormat.clear();
- QStringList keys, values;
- QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
+ QHash<QString, QColor> oldColorHash = m_categoryColors;
+ int opacity = m_colorConfigUi.korganizerOpacity->value();
+ cg.writeEntry("KOOpacity", opacity);
+ setupCategoryColors(opacity);
+
+ m_categoryFormat.clear();
+ QStringList keys, values;
+ QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
- keys << (*it)->text(0);
- values << (*it)->text(1);
+ keys << (*it)->text(0);
+ values << (*it)->text(1);
++it;
}
- cg.writeEntry("CategoryFormatsKeys", keys);
- cg.writeEntry("CategoryFormatsValues", values);
- m_delegate->setCategoryFormats(m_categoryFormat);
+ cg.writeEntry("CategoryFormatsKeys", keys);
+ cg.writeEntry("CategoryFormatsValues", values);
+ m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
- m_model->setCategoryColors(m_useKoColors, m_categoryColors);
+ m_model->setCategoryColors(m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
- oldUseKoColors != m_useKoColors || oldColorHash != m_categoryColors) {
+ oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
+ const QVariant v = index.data(Qt::DisplayRole);
+ QMap<QString, QVariant> values = v.toMap();
+ QString category = values["mainCategory"].toString();
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
+
+ QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
+ m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
+
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
- } else if (itemRole == EventModel::BirthdayItem) {
+ } else if (itemRole == EventModel::BirthdayItem || itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
+ } else if (m_categoryColors.contains(category)) {
+ m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
- m_model->setData(index, QVariant(QBrush(m_birthdayBg)), Qt::BackgroundRole);
- }
- } else if (itemRole == EventModel::AnniversaryItem) {
- if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
- m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
- } else {
- m_model->setData(index, QVariant(QBrush(m_anniversaryBg)), Qt::BackgroundRole);
+ m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
+ } else if (m_categoryColors.contains(category)) {
+ m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
} else {
- if (m_useKoColors) {
- const QVariant v = index.data(Qt::DisplayRole);
- QMap<QString, QVariant> values = v.toMap();
- if (!values["categories"].toStringList().isEmpty()) {
- QString category = values["categories"].toStringList().first();
- if (m_categoryColors.contains(category)) {
- m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
- }
- }
- } else {
- m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
- }
-
- QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
- m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
+ m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventapplet.h b/src/applet/eventapplet.h
index 604c9d7..3c89e15 100644
--- a/src/applet/eventapplet.h
+++ b/src/applet/eventapplet.h
@@ -1,114 +1,113 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTAPPLET_H
#define EVENTAPPLET_H
// kde ui autogenerated file
#include "formatconfig.h"
#include "ui_eventappletcolorconfig.h"
// Qt headers
#include <QHash>
#include <QGraphicsSceneHoverEvent>
// Plasma includes
#include <Plasma/PopupApplet>
#include <Plasma/TreeView>
#include <Plasma/Label>
#include <Plasma/BusyWidget>
#include <Plasma/ToolTipManager>
#include <akonadi/agentmanager.h>
class QDateTime;
class QTimer;
class QModelIndex;
class QAction;
class KConfigDialog;
class EventModel;
class EventFilterModel;
class EventItemDelegate;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTreeView;
class EventTreeView;
class EventApplet : public Plasma::PopupApplet
{
Q_OBJECT
public:
EventApplet(QObject *parent, const QVariantList &args);
~EventApplet();
void init();
QGraphicsWidget *graphicsWidget();
virtual QList<QAction *> contextualActions();
private slots:
void slotOpenEvent(const QModelIndex &index);
void slotUpdateTooltip(QString);
void openEventFromMenu();
void slotAddEvent();
void slotAddTodo();
void timerExpired();
void setShownResources();
void setupModel();
void akonadiStatusChanged();
protected slots:
void configAccepted();
protected:
void createConfigurationInterface(KConfigDialog *parent);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
void setupCategoryColors(int opacity);
void colorizeModel(bool timerTriggered);
void createToolTip();
private:
QGraphicsWidget *m_graphicsWidget;
QGraphicsLinearLayout *layout;
EventModel *m_model;
EventFilterModel *m_filterModel;
// Plasma::TreeView *m_view;
QGraphicsProxyWidget *proxyWidget;
EventTreeView *m_view;
Plasma::ToolTipContent tooltip;
Plasma::BusyWidget *busy;
EventItemDelegate *m_delegate;
FormatConfig m_formatConfig;
Ui::EventAppletColorConfig m_colorConfigUi;
int m_urgency, m_birthdayUrgency, m_checkInterval, m_period;
- QColor m_urgentBg, m_passedFg, m_birthdayBg, m_anniversaryBg, m_todoBg, m_finishedTodoBg;
+ QColor m_urgentBg, m_passedFg, m_todoBg, m_finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
- QMap<QString, QString> m_categoryFormat;
+ QMap<QString, QString> m_categoryFormat;
QList<QColor> m_colors;
QTimer *m_timer;
Akonadi::AgentManager *m_agentManager;
QStringList disabledResources;
QDateTime lastCheckTime;
bool m_showFinishedTodos;
- bool m_useKoColors;
};
#endif
diff --git a/src/applet/eventappletcolorconfig.ui b/src/applet/eventappletcolorconfig.ui
index edc3fb8..9bc4f54 100644
--- a/src/applet/eventappletcolorconfig.ui
+++ b/src/applet/eventappletcolorconfig.ui
@@ -1,419 +1,313 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EventAppletColorConfig</class>
<widget class="QWidget" name="EventAppletColorConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>687</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="timeBox">
<property name="title">
<string>Times</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Urgency for normal events:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="urgencyBox">
<property name="toolTip">
<string>The time left until an event is marked as soon beginning.</string>
</property>
<property name="suffix">
<string>min</string>
</property>
<property name="maximum">
<number>280</number>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>397</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Urgency for birthdays:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KIntSpinBox" name="birthdayUrgencyBox">
<property name="toolTip">
<string>The days left until a birthday or anniversary is marked as being soon.</string>
</property>
<property name="suffix">
<string>days</string>
</property>
<property name="maximum">
<number>30</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="normalEventsBox">
<property name="title">
<string>Colors for normal events</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Backgroundcolor for near events:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="urgentColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The backgroundcolor for soon beginning events.</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="KIntSpinBox" name="urgentOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Textcolor for started or passed events:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KColorButton" name="startedColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The textcolor for already started or passed events.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="recurringEventsBox">
- <property name="title">
- <string>Colors for recurring events</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Backgroundcolor for Birthdays:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KColorButton" name="birthdayColorButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>The backgroundcolor for birthdays.</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="KIntSpinBox" name="birthdayOpacity">
- <property name="suffix">
- <string>%</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Backgroundcolor for Anniversaries:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KColorButton" name="anniversariesColorButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>The backgroundcolor for anniversaries.</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="KIntSpinBox" name="anniversariesOpacity">
- <property name="suffix">
- <string>%</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Colors for todos</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Backgroundcolor for todos:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="todoColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The backgroundcolor for common todos.</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="KIntSpinBox" name="todoOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showFinishedTodos">
<property name="toolTip">
<string>Show or hide already finished todos.</string>
</property>
<property name="text">
<string>Show finished todos</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>371</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Background for finished todos:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KColorButton" name="finishedTodoButton">
<property name="toolTip">
<string>The backgroundcolor for already finished todos.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="KIntSpinBox" name="finishedTodoOpacity">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>KOrganizer colors</string>
</property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0" colspan="3">
- <widget class="QCheckBox" name="useKOrganizerColors">
- <property name="toolTip">
- <string>Use the colors defined in KOrganizer categories for events if available.</string>
- </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_14">
<property name="text">
- <string>Use colors of KOrganizer</string>
+ <string>Opacity:</string>
</property>
</widget>
</item>
- <item row="0" column="3" rowspan="2">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>380</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1" rowspan="2">
+ <item>
<widget class="KIntSpinBox" name="korganizerOpacity">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2" colspan="2">
+ <item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>93</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 3f6983e..e24f794 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,567 +1,567 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
- birthdayBg = itemColors.at(birthdayColorPos);
- anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
-void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
+void EventModel::setCategoryColors(QHash<QString, QColor> categoryColors)
{
- m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem = new QStandardItem();
eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
- if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
- QString b = "Birthday";
- if (m_categoryColors.contains(i18n("Birthday")))
- b = i18n("Birthday");
- eventItem->setBackground(QBrush(m_categoryColors.value(b)));
- } else {
- eventItem->setBackground(QBrush(birthdayBg));
- }
+ if (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday")) {
+ QString b = "Birthday";
+ if (m_categoryColors.contains(i18n("Birthday"))) {
+ b = i18n("Birthday");
+ }
+ eventItem->setBackground(QBrush(m_categoryColors.value(b)));
+ }
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
- if (m_useKoColors && m_categoryColors.contains(category)) {
- eventItem->setBackground(QBrush(m_categoryColors.value(category)));
- } else {
- eventItem->setBackground(QBrush(anniversariesBg));
- }
+ if (m_categoryColors.contains(category)) {
+ eventItem->setBackground(QBrush(m_categoryColors.value(category)));
+ }
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
- } else if (m_useKoColors) {
- if (m_categoryColors.contains(category)) {
- eventItem->setBackground(QBrush(m_categoryColors.value(category)));
- }
- }
- }
+ } else if (m_categoryColors.contains(category)) {
+ eventItem->setBackground(QBrush(m_categoryColors.value(category)));
+ }
+ }
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
- } else if (m_useKoColors) {
- if (m_categoryColors.contains(category)) {
- eventItem->setBackground(QBrush(m_categoryColors.value(category)));
- }
- }
+ } else if (m_categoryColors.contains(category)) {
+ eventItem->setBackground(QBrush(m_categoryColors.value(category)));
+ }
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
- QStringList categories = event->categories();
- values["categories"] = categories;
- if (categories.isEmpty())
- values["mainCategory"] = i18n("Unspecified");
- else
- values["mainCategory"] = categories.first();
-
- values["status"] = event->status();
+ QStringList categories = event->categories();
+ if (categories.isEmpty()) {
+ values["categories"] = i18n("Unspecified");
+ values["mainCategory"] = i18n("Unspecified");
+ } else {
+ values["categories"] = event->categoriesStr();
+ values["mainCategory"] = categories.first();
+ }
+
+ values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
- values["isBirthday"] = QVariant(TRUE);
- } else {
- values["isBirthday"] = QVariant(FALSE);
- }
+ values["isBirthday"] = QVariant(TRUE);
+ } else {
+ values["isBirthday"] = QVariant(FALSE);
+ }
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
- values["categories"] = todo->categoriesStr();
+ QStringList categories = todo->categories();
+ if (categories.isEmpty()) {
+ values["categories"] = i18n("Unspecified");
+ values["mainCategory"] = i18n("Unspecified");
+ } else {
+ values["categories"] = todo->categoriesStr();
+ values["mainCategory"] = categories.first();
+ }
+
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index 3bc2c96..7f144af 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,116 +1,115 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int birthdayColorPos = 2;
static const int anniversariesColorPos = 3;
static const int todoColorPos = 4;
static const int finishedTodoColorPos = 5;
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
- void setCategoryColors(bool useKoColors, const QHash<QString, QColor>);
+ void setCategoryColors(const QHash<QString, QColor>);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
int figureRow(QStandardItem *headerItem);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
QStandardItem *parentItem, *olderItem, *todayItem, *tomorrowItem, *weekItem, *monthItem, *laterItem, *somedayItem;
QList<QStandardItem *> sectionItems;
int urgency, birthdayUrgency;
- QColor urgentBg, passedFg, birthdayBg, anniversariesBg, todoBg, finishedTodoBg;
- bool m_useKoColors;
+ QColor urgentBg, passedFg, todoBg, finishedTodoBg;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | c1c4b15e69ad20c37cd033347aa95f43fd316362 | respect theme text color | diff --git a/src/applet/eventitemdelegate.cpp b/src/applet/eventitemdelegate.cpp
index d52c554..09e285c 100644
--- a/src/applet/eventitemdelegate.cpp
+++ b/src/applet/eventitemdelegate.cpp
@@ -1,197 +1,197 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventitemdelegate.h"
#include "eventmodel.h"
// #include <Plasma/Svg>
// #include <Plasma/Theme>
#include <KGlobal>
#include <KLocale>
#include <KMacroExpanderBase>
#include <QDateTime>
#include <QHash>
#include <QTextDocument>
#include <QPainter>
#include <QAbstractTextDocumentLayout>
// #include <QRectF>
// #include <QStyleOptionViewItem>
EventItemDelegate::EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString)
: QStyledItemDelegate(parent),
m_normal(normal),
m_todo(todo),
m_noDueDate(noDueDate),
m_dateString(dtString),
m_dateFormat(dtFormat)
{
}
EventItemDelegate::~EventItemDelegate()
{
}
QString EventItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
Q_UNUSED(locale);
QMap<QString, QVariant> data = value.toMap();
QString mainCategory = data["mainCategory"].toString();
int itemType = data["itemType"].toInt();
switch (itemType) {
case EventModel::HeaderItem:
- return "<b>" + data["title"].toString() + "</b>";
+ return data["title"].toString();
break;
case EventModel::NormalItem:
case EventModel::BirthdayItem:
case EventModel::AnniversaryItem:
if (m_categoryFormats.contains(mainCategory))
return KMacroExpander::expandMacros(m_categoryFormats.value(mainCategory), eventHash(data));
else
return KMacroExpander::expandMacros(m_normal, eventHash(data));
break;
case EventModel::TodoItem:
if (data["hasDueDate"].toBool() == FALSE)
return KMacroExpander::expandMacros(m_noDueDate, todoHash(data));
else
return KMacroExpander::expandMacros(m_todo, todoHash(data));
break;
default:
break;
}
return QString();
}
void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
painter->save();
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
QVariant value = index.data();
QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
QBrush fgBrush = qvariant_cast<QBrush>(index.data(Qt::ForegroundRole));
painter->setClipRect( opt.rect );
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setBackground(Qt::transparent);
painter->setBrush(bgBrush);
if (bgBrush.style() != Qt::NoBrush) {
QPen bgPen;
bgPen.setColor(bgBrush.color().darker(250));
bgPen.setStyle(Qt::SolidLine);
bgPen.setWidth(1);
painter->setPen(bgPen);
painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
}
QTextDocument doc;
doc.setDocumentMargin(3);
doc.setDefaultStyleSheet("* {color: " + fgBrush.color().name() + ";}");
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
QAbstractTextDocumentLayout::PaintContext context;
doc.setPageSize( opt.rect.size());
painter->translate(opt.rect.x(), opt.rect.y());
doc.documentLayout()->draw(painter, context);
painter->restore();
}
QSize EventItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QVariant value = index.data();
QTextDocument doc;
doc.setDocumentMargin(3);
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
doc.setTextWidth(option.rect.width());
return doc.size().toSize();
}
QHash<QString, QString> EventItemDelegate::eventHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
ulong s;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("endDate", formattedDate(data["endDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("endTime", KGlobal::locale()->formatTime(data["endDate"].toTime()));
s = data["startDate"].toDateTime().secsTo(data["endDate"].toDateTime());
dataHash.insert("duration", KGlobal::locale()->prettyFormatDuration(s * 1000));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("yearsSince", data["yearsSince"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("mainCategory", data["mainCategory"].toString());
dataHash.insert("tab", "\t");
return dataHash;
}
QHash<QString, QString> EventItemDelegate::todoHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("dueDate", formattedDate(data["dueDate"]));
dataHash.insert("dueTime", KGlobal::locale()->formatTime(data["dueDate"].toTime()));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("percent", QString::number(data["percent"].toInt()));
dataHash.insert("tab", "\t");
return dataHash;
}
void EventItemDelegate::setCategoryFormats(QMap<QString, QString> formats)
{
m_categoryFormats = formats;
}
QString EventItemDelegate::formattedDate(const QVariant &dtTime) const
{
QString date;
if (dtTime.toDateTime().isValid()) {
switch (m_dateFormat) {
case ShortDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::ShortDate);
break;
case LongDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::LongDate);
break;
case CustomDateFormat:
date = dtTime.toDate().toString(m_dateString);
break;
}
}
return date;
}
void EventItemDelegate::settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString)
{
m_normal = normal;
m_todo= todo;
m_noDueDate = noDueDate;
m_dateFormat = format;
m_dateString = customString;
}
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 559f946..3f6983e 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,563 +1,567 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
- data["title"] = title;
+ data["title"] = "<b>" + title + "</b>";
item->setData(data, Qt::DisplayRole);
+ QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
+ item->setForeground(QBrush(textColor));
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
- QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
- bold.setBold(true);
- item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
- QString category = values["mainCategory"].toString();
+ QString category = values["mainCategory"].toString();
+ QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
- QStandardItem *eventItem;
- eventItem = new QStandardItem();
+ QStandardItem *eventItem = new QStandardItem();
+ eventItem->setForeground(QBrush(textColor));
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
+ eventItem->setForeground(QBrush(textColor));
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
+ QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
+ todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
+ todoItem->setForeground(QBrush(textColor));
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 68345e922c7bc72f4eec6f1737205343fea0184a | set margin to 3 - compromise between readability and place | diff --git a/src/applet/eventitemdelegate.cpp b/src/applet/eventitemdelegate.cpp
index e45b0d0..d52c554 100644
--- a/src/applet/eventitemdelegate.cpp
+++ b/src/applet/eventitemdelegate.cpp
@@ -1,195 +1,197 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventitemdelegate.h"
#include "eventmodel.h"
// #include <Plasma/Svg>
// #include <Plasma/Theme>
#include <KGlobal>
#include <KLocale>
#include <KMacroExpanderBase>
#include <QDateTime>
#include <QHash>
#include <QTextDocument>
#include <QPainter>
#include <QAbstractTextDocumentLayout>
// #include <QRectF>
// #include <QStyleOptionViewItem>
EventItemDelegate::EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString)
: QStyledItemDelegate(parent),
m_normal(normal),
m_todo(todo),
m_noDueDate(noDueDate),
m_dateString(dtString),
m_dateFormat(dtFormat)
{
}
EventItemDelegate::~EventItemDelegate()
{
}
QString EventItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
Q_UNUSED(locale);
QMap<QString, QVariant> data = value.toMap();
QString mainCategory = data["mainCategory"].toString();
int itemType = data["itemType"].toInt();
switch (itemType) {
case EventModel::HeaderItem:
return "<b>" + data["title"].toString() + "</b>";
break;
case EventModel::NormalItem:
case EventModel::BirthdayItem:
case EventModel::AnniversaryItem:
if (m_categoryFormats.contains(mainCategory))
return KMacroExpander::expandMacros(m_categoryFormats.value(mainCategory), eventHash(data));
else
return KMacroExpander::expandMacros(m_normal, eventHash(data));
break;
case EventModel::TodoItem:
if (data["hasDueDate"].toBool() == FALSE)
return KMacroExpander::expandMacros(m_noDueDate, todoHash(data));
else
return KMacroExpander::expandMacros(m_todo, todoHash(data));
break;
default:
break;
}
return QString();
}
void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
painter->save();
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
QVariant value = index.data();
QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
QBrush fgBrush = qvariant_cast<QBrush>(index.data(Qt::ForegroundRole));
painter->setClipRect( opt.rect );
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setBackground(Qt::transparent);
painter->setBrush(bgBrush);
if (bgBrush.style() != Qt::NoBrush) {
QPen bgPen;
bgPen.setColor(bgBrush.color().darker(250));
bgPen.setStyle(Qt::SolidLine);
bgPen.setWidth(1);
painter->setPen(bgPen);
painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
}
QTextDocument doc;
+ doc.setDocumentMargin(3);
doc.setDefaultStyleSheet("* {color: " + fgBrush.color().name() + ";}");
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
QAbstractTextDocumentLayout::PaintContext context;
doc.setPageSize( opt.rect.size());
painter->translate(opt.rect.x(), opt.rect.y());
doc.documentLayout()->draw(painter, context);
painter->restore();
}
QSize EventItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QVariant value = index.data();
QTextDocument doc;
+ doc.setDocumentMargin(3);
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
doc.setTextWidth(option.rect.width());
return doc.size().toSize();
}
QHash<QString, QString> EventItemDelegate::eventHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
ulong s;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("endDate", formattedDate(data["endDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("endTime", KGlobal::locale()->formatTime(data["endDate"].toTime()));
s = data["startDate"].toDateTime().secsTo(data["endDate"].toDateTime());
dataHash.insert("duration", KGlobal::locale()->prettyFormatDuration(s * 1000));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("yearsSince", data["yearsSince"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("mainCategory", data["mainCategory"].toString());
dataHash.insert("tab", "\t");
return dataHash;
}
QHash<QString, QString> EventItemDelegate::todoHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("dueDate", formattedDate(data["dueDate"]));
dataHash.insert("dueTime", KGlobal::locale()->formatTime(data["dueDate"].toTime()));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("percent", QString::number(data["percent"].toInt()));
dataHash.insert("tab", "\t");
return dataHash;
}
void EventItemDelegate::setCategoryFormats(QMap<QString, QString> formats)
{
m_categoryFormats = formats;
}
QString EventItemDelegate::formattedDate(const QVariant &dtTime) const
{
QString date;
if (dtTime.toDateTime().isValid()) {
switch (m_dateFormat) {
case ShortDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::ShortDate);
break;
case LongDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::LongDate);
break;
case CustomDateFormat:
date = dtTime.toDate().toString(m_dateString);
break;
}
}
return date;
}
void EventItemDelegate::settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString)
{
m_normal = normal;
m_todo= todo;
m_noDueDate = noDueDate;
m_dateFormat = format;
m_dateString = customString;
}
|
geflei/plasmoid-eventlist | 47071bd25bf3009ef8925f60e36f56d242d64949 | use defined foreground color for painting text | diff --git a/src/applet/eventitemdelegate.cpp b/src/applet/eventitemdelegate.cpp
index 3d1ea25..e45b0d0 100644
--- a/src/applet/eventitemdelegate.cpp
+++ b/src/applet/eventitemdelegate.cpp
@@ -1,195 +1,195 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventitemdelegate.h"
#include "eventmodel.h"
// #include <Plasma/Svg>
// #include <Plasma/Theme>
#include <KGlobal>
#include <KLocale>
#include <KMacroExpanderBase>
#include <QDateTime>
#include <QHash>
#include <QTextDocument>
#include <QPainter>
#include <QAbstractTextDocumentLayout>
// #include <QRectF>
// #include <QStyleOptionViewItem>
EventItemDelegate::EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString)
: QStyledItemDelegate(parent),
m_normal(normal),
m_todo(todo),
m_noDueDate(noDueDate),
m_dateString(dtString),
m_dateFormat(dtFormat)
{
}
EventItemDelegate::~EventItemDelegate()
{
}
QString EventItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
Q_UNUSED(locale);
QMap<QString, QVariant> data = value.toMap();
QString mainCategory = data["mainCategory"].toString();
int itemType = data["itemType"].toInt();
switch (itemType) {
case EventModel::HeaderItem:
return "<b>" + data["title"].toString() + "</b>";
break;
case EventModel::NormalItem:
case EventModel::BirthdayItem:
case EventModel::AnniversaryItem:
if (m_categoryFormats.contains(mainCategory))
return KMacroExpander::expandMacros(m_categoryFormats.value(mainCategory), eventHash(data));
else
return KMacroExpander::expandMacros(m_normal, eventHash(data));
break;
case EventModel::TodoItem:
if (data["hasDueDate"].toBool() == FALSE)
return KMacroExpander::expandMacros(m_noDueDate, todoHash(data));
else
return KMacroExpander::expandMacros(m_todo, todoHash(data));
break;
default:
break;
}
return QString();
}
void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
painter->save();
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
QVariant value = index.data();
- QTextDocument doc;
QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
-
+ QBrush fgBrush = qvariant_cast<QBrush>(index.data(Qt::ForegroundRole));
painter->setClipRect( opt.rect );
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setBackground(Qt::transparent);
painter->setBrush(bgBrush);
if (bgBrush.style() != Qt::NoBrush) {
QPen bgPen;
bgPen.setColor(bgBrush.color().darker(250));
bgPen.setStyle(Qt::SolidLine);
bgPen.setWidth(1);
painter->setPen(bgPen);
painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
}
+ QTextDocument doc;
+ doc.setDefaultStyleSheet("* {color: " + fgBrush.color().name() + ";}");
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
QAbstractTextDocumentLayout::PaintContext context;
doc.setPageSize( opt.rect.size());
painter->translate(opt.rect.x(), opt.rect.y());
doc.documentLayout()->draw(painter, context);
-
painter->restore();
}
QSize EventItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QVariant value = index.data();
QTextDocument doc;
doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
doc.setTextWidth(option.rect.width());
return doc.size().toSize();
}
QHash<QString, QString> EventItemDelegate::eventHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
ulong s;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("endDate", formattedDate(data["endDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("endTime", KGlobal::locale()->formatTime(data["endDate"].toTime()));
s = data["startDate"].toDateTime().secsTo(data["endDate"].toDateTime());
dataHash.insert("duration", KGlobal::locale()->prettyFormatDuration(s * 1000));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("yearsSince", data["yearsSince"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("mainCategory", data["mainCategory"].toString());
dataHash.insert("tab", "\t");
return dataHash;
}
QHash<QString, QString> EventItemDelegate::todoHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("dueDate", formattedDate(data["dueDate"]));
dataHash.insert("dueTime", KGlobal::locale()->formatTime(data["dueDate"].toTime()));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("percent", QString::number(data["percent"].toInt()));
dataHash.insert("tab", "\t");
return dataHash;
}
void EventItemDelegate::setCategoryFormats(QMap<QString, QString> formats)
{
m_categoryFormats = formats;
}
QString EventItemDelegate::formattedDate(const QVariant &dtTime) const
{
QString date;
if (dtTime.toDateTime().isValid()) {
switch (m_dateFormat) {
case ShortDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::ShortDate);
break;
case LongDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::LongDate);
break;
case CustomDateFormat:
date = dtTime.toDate().toString(m_dateString);
break;
}
}
return date;
}
void EventItemDelegate::settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString)
{
m_normal = normal;
m_todo= todo;
m_noDueDate = noDueDate;
m_dateFormat = format;
m_dateString = customString;
}
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 9aab75b..559f946 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,568 +1,563 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
- eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
- eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(anniversariesBg));
- eventItem->setData(QBrush(anniversariesBg), Qt::BackgroundRole);
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
- eventItem->setData(QBrush(urgentBg), Qt::BackgroundRole);
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
- eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 954f98583c2b388cb4f9eb3dc2bc75395c09a9b1 | make it compile | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 3e96c35..9aab75b 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,568 +1,568 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(anniversariesBg));
eventItem->setData(QBrush(anniversariesBg), Qt::BackgroundRole);
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
eventItem->setData(QBrush(urgentBg), Qt::BackgroundRole);
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
}
}
-eventItem->setData(urgentBg.name(), EventModel::BgRole);
+
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 70290235c2f443c6cff3b180275d3418450cf9bb | add paint method to allow richtext subset | diff --git a/src/applet/eventitemdelegate.cpp b/src/applet/eventitemdelegate.cpp
index 86570ce..3d1ea25 100644
--- a/src/applet/eventitemdelegate.cpp
+++ b/src/applet/eventitemdelegate.cpp
@@ -1,149 +1,195 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventitemdelegate.h"
#include "eventmodel.h"
// #include <Plasma/Svg>
// #include <Plasma/Theme>
#include <KGlobal>
#include <KLocale>
#include <KMacroExpanderBase>
#include <QDateTime>
#include <QHash>
+#include <QTextDocument>
+#include <QPainter>
+#include <QAbstractTextDocumentLayout>
// #include <QRectF>
// #include <QStyleOptionViewItem>
EventItemDelegate::EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString)
: QStyledItemDelegate(parent),
m_normal(normal),
m_todo(todo),
m_noDueDate(noDueDate),
m_dateString(dtString),
m_dateFormat(dtFormat)
{
}
EventItemDelegate::~EventItemDelegate()
{
}
QString EventItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
Q_UNUSED(locale);
QMap<QString, QVariant> data = value.toMap();
QString mainCategory = data["mainCategory"].toString();
int itemType = data["itemType"].toInt();
switch (itemType) {
case EventModel::HeaderItem:
- return data["title"].toString();
+ return "<b>" + data["title"].toString() + "</b>";
break;
case EventModel::NormalItem:
case EventModel::BirthdayItem:
case EventModel::AnniversaryItem:
if (m_categoryFormats.contains(mainCategory))
return KMacroExpander::expandMacros(m_categoryFormats.value(mainCategory), eventHash(data));
else
return KMacroExpander::expandMacros(m_normal, eventHash(data));
break;
case EventModel::TodoItem:
if (data["hasDueDate"].toBool() == FALSE)
return KMacroExpander::expandMacros(m_noDueDate, todoHash(data));
else
return KMacroExpander::expandMacros(m_todo, todoHash(data));
break;
default:
break;
}
return QString();
}
+void EventItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
+{
+ painter->save();
+
+ QStyleOptionViewItemV4 opt = option;
+ initStyleOption(&opt, index);
+
+ QVariant value = index.data();
+ QTextDocument doc;
+ QBrush bgBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
+
+ painter->setClipRect( opt.rect );
+ painter->setBackgroundMode(Qt::OpaqueMode);
+ painter->setBackground(Qt::transparent);
+ painter->setBrush(bgBrush);
+
+ if (bgBrush.style() != Qt::NoBrush) {
+ QPen bgPen;
+ bgPen.setColor(bgBrush.color().darker(250));
+ bgPen.setStyle(Qt::SolidLine);
+ bgPen.setWidth(1);
+ painter->setPen(bgPen);
+ painter->drawRoundedRect(opt.rect.x(), opt.rect.y(), opt.rect.width() - bgPen.width(), opt.rect.height() - bgPen.width(), 3.0, 3.0);
+ }
+
+ doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
+ QAbstractTextDocumentLayout::PaintContext context;
+ doc.setPageSize( opt.rect.size());
+ painter->translate(opt.rect.x(), opt.rect.y());
+ doc.documentLayout()->draw(painter, context);
+
+ painter->restore();
+}
+
+QSize EventItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ QVariant value = index.data();
+ QTextDocument doc;
+ doc.setHtml("<html><qt></head><meta name=\"qrichtext\" content=\"1\" />" + displayText(value, QLocale::system()) + "</qt></html>");
+ doc.setTextWidth(option.rect.width());
+ return doc.size().toSize();
+}
+
QHash<QString, QString> EventItemDelegate::eventHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
ulong s;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("endDate", formattedDate(data["endDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("endTime", KGlobal::locale()->formatTime(data["endDate"].toTime()));
s = data["startDate"].toDateTime().secsTo(data["endDate"].toDateTime());
dataHash.insert("duration", KGlobal::locale()->prettyFormatDuration(s * 1000));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("yearsSince", data["yearsSince"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("mainCategory", data["mainCategory"].toString());
dataHash.insert("tab", "\t");
return dataHash;
}
QHash<QString, QString> EventItemDelegate::todoHash(QMap<QString, QVariant> data) const
{
QHash<QString,QString> dataHash;
dataHash.insert("startDate", formattedDate(data["startDate"]));
dataHash.insert("startTime", KGlobal::locale()->formatTime(data["startDate"].toTime()));
dataHash.insert("dueDate", formattedDate(data["dueDate"]));
dataHash.insert("dueTime", KGlobal::locale()->formatTime(data["dueDate"].toTime()));
dataHash.insert("summary", data["summary"].toString());
dataHash.insert("description", data["description"].toString());
dataHash.insert("location", data["location"].toString());
dataHash.insert("resourceName", data["resourceName"].toString());
dataHash.insert("percent", QString::number(data["percent"].toInt()));
dataHash.insert("tab", "\t");
return dataHash;
}
void EventItemDelegate::setCategoryFormats(QMap<QString, QString> formats)
{
m_categoryFormats = formats;
}
QString EventItemDelegate::formattedDate(const QVariant &dtTime) const
{
QString date;
if (dtTime.toDateTime().isValid()) {
switch (m_dateFormat) {
case ShortDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::ShortDate);
break;
case LongDateFormat:
date = KGlobal::locale()->formatDate(dtTime.toDate(), KLocale::LongDate);
break;
case CustomDateFormat:
date = dtTime.toDate().toString(m_dateString);
break;
}
}
return date;
}
void EventItemDelegate::settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString)
{
m_normal = normal;
m_todo= todo;
m_noDueDate = noDueDate;
m_dateFormat = format;
m_dateString = customString;
}
diff --git a/src/applet/eventitemdelegate.h b/src/applet/eventitemdelegate.h
index f18e307..7e5ca1b 100644
--- a/src/applet/eventitemdelegate.h
+++ b/src/applet/eventitemdelegate.h
@@ -1,46 +1,48 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTITEMDELEGATE_H
#define EVENTITEMDELEGATE_H
#include <QStyledItemDelegate>
class EventItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
EventItemDelegate(QObject* parent, QString normal, QString todo, QString noDueDate, int dtFormat, QString dtString);
~EventItemDelegate();
QString displayText(const QVariant &value, const QLocale &locale) const;
- void settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString);
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void settingsChanged(QString normal, QString todo, QString noDueDate, int format, QString customString);
void setCategoryFormats(QMap<QString, QString>);
private:
QHash<QString, QString> eventHash(QMap<QString, QVariant>) const;
QHash<QString, QString> todoHash(QMap<QString, QVariant>) const;
QMap<QString, QString> m_categoryFormats;
QString formattedDate(const QVariant &dtTime) const;
QString m_normal, m_todo, m_noDueDate, m_dateString;
int m_dateFormat;
};
#endif
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 559f946..3e96c35 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,563 +1,568 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
+ eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
+ eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
} else {
eventItem->setBackground(QBrush(anniversariesBg));
+ eventItem->setData(QBrush(anniversariesBg), Qt::BackgroundRole);
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
+ eventItem->setData(QBrush(urgentBg), Qt::BackgroundRole);
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
+ eventItem->setData(QBrush(m_categoryColors.value(category)), Qt::BackgroundRole);
}
}
-
+eventItem->setData(urgentBg.name(), EventModel::BgRole);
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index fe53aaa..3bc2c96 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,116 +1,116 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int birthdayColorPos = 2;
static const int anniversariesColorPos = 3;
static const int todoColorPos = 4;
static const int finishedTodoColorPos = 5;
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
- };
+ };
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(bool useKoColors, const QHash<QString, QColor>);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
int figureRow(QStandardItem *headerItem);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
QStandardItem *parentItem, *olderItem, *todayItem, *tomorrowItem, *weekItem, *monthItem, *laterItem, *somedayItem;
QList<QStandardItem *> sectionItems;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, birthdayBg, anniversariesBg, todoBg, finishedTodoBg;
bool m_useKoColors;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | d3b6bf387c2fe637b62b80e84ce40cc0b44e114f | try to make open an incidence work with 4.6 | diff --git a/src/applet/eventapplet.cpp b/src/applet/eventapplet.cpp
index bbbffaf..fc5b147 100644
--- a/src/applet/eventapplet.cpp
+++ b/src/applet/eventapplet.cpp
@@ -1,639 +1,643 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventapplet.h"
#include "eventmodel.h"
#include "eventfiltermodel.h"
#include "eventitemdelegate.h"
#include "korganizerappletutil.h"
#include "eventtreeview.h"
// qt headers
#include <QComboBox>
#include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
#include <QTreeView>
#include <QModelIndex>
#include <QTimer>
#include <QAction>
#include <QCheckBox>
#include <QDateTime>
#include <QPoint>
#include <QCursor>
#include <QMap>
#include <QVariant>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
// kde headers
#include <KColorScheme>
#include <KConfigDialog>
#include <KIcon>
#include <KIconLoader>
// plasma headers
#include <Plasma/Theme>
#include <akonadi/control.h>
#include <akonadi/agentinstance.h>
#include <akonadi/servermanager.h>
K_EXPORT_PLASMA_APPLET(events, EventApplet)
static const int MAX_RETRIES = 12;
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
Plasma::PopupApplet(parent, args),
m_graphicsWidget(0),
m_view(0),
m_delegate(0),
m_formatConfig(),
m_colorConfigUi(),
m_timer(0),
m_agentManager(0)
{
KGlobal::locale()->insertCatalog("libkcal");
KGlobal::locale()->insertCatalog("eventapplet");
setBackgroundHints(DefaultBackground);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setHasConfigurationInterface(true);
setPopupIcon("view-pim-tasks");
Akonadi::ServerManager::start();
}
EventApplet::~EventApplet()
{
delete m_view;
}
void EventApplet::init()
{
KConfigGroup cg = config();
disabledResources = cg.readEntry("DisabledResources", QStringList());
QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
m_period = cg.readEntry("Period", 365);
m_urgency = cg.readEntry("UrgencyTime", 15);
m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);
m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
m_colors.insert(passedColorPos, m_passedFg);
m_birthdayBg = QColor(cg.readEntry("BirthdayColor", QString("#C0FFC0")));
m_birthdayBg.setAlphaF(cg.readEntry("BirthdayOpacity", 10)/100.0);
m_colors.insert(birthdayColorPos, m_birthdayBg);
m_anniversaryBg = QColor(cg.readEntry("AnniversariesColor", QString("#ABFFEA")));
m_anniversaryBg.setAlphaF(cg.readEntry("AnniversariesOpacity", 10)/100.0);
m_colors.insert(anniversariesColorPos, m_anniversaryBg);
m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
m_colors.insert(todoColorPos, m_todoBg);
m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
m_useKoColors = cg.readEntry("UseKoColors", TRUE);
int opacity = cg.readEntry("KOOpacity", 10);
setupCategoryColors(opacity);
QStringList keys, values;
keys << i18n("Birthday") << i18n("Holiday");
values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
keys = cg.readEntry("CategoryFormatsKeys", keys);
values = cg.readEntry("CategoryFormatsValues", values);
for (int i = 0; i < keys.size(); ++i) {
m_categoryFormat.insert(keys.at(i), values.at(i));
}
m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
m_delegate->setCategoryFormats(m_categoryFormat);
graphicsWidget();
Plasma::ToolTipManager::self()->registerWidget(this);
createToolTip();
lastCheckTime = QDateTime::currentDateTime();
m_timer = new QTimer();
connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
QTimer::singleShot(0, this, SLOT(setupModel()));
}
void EventApplet::setupModel()
{
Akonadi::Control::widgetNeedsAkonadi(m_view);
Akonadi::Control::start();
m_agentManager = Akonadi::AgentManager::self();
m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_useKoColors, m_categoryColors);
m_model->initModel();
m_model->initMonitor();
m_model->setSortRole(EventModel::SortRole);
m_model->sort(0, Qt::AscendingOrder);
m_filterModel = new EventFilterModel(this);
m_filterModel->setPeriod(m_period);
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
m_filterModel->setExcludedResources(disabledResources);
m_filterModel->setDynamicSortFilter(TRUE);
m_filterModel->setSourceModel(m_model);
m_view->setModel(m_filterModel);
m_view->expandAll();
connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));
m_timer->start(2 * 60 * 1000);
connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
void EventApplet::setupCategoryColors(int opacity)
{
m_categoryColors.clear();
KConfig *koConfig = new KConfig("korganizerrc");
KConfigGroup general(koConfig, "General");
QStringList categories = general.readEntry("Custom Categories", QStringList());
KConfigGroup categoryColors(koConfig, "Category Colors2");
foreach(const QString &category, categories) {
QColor cColor = categoryColors.readEntry(category, QColor());
if (cColor.isValid()) {
cColor.setAlphaF(opacity/100.0);
m_categoryColors.insert(category, cColor);
}
}
}
void EventApplet::akonadiStatusChanged()
{
m_model->resetModel();
}
QGraphicsWidget *EventApplet::graphicsWidget()
{
if (!m_graphicsWidget) {
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setMinimumSize(200, 125);
m_graphicsWidget->setPreferredSize(350, 200);
// Get colors
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor baseColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor altBaseColor = baseColor.darker(150);
QColor buttonColor = altBaseColor;
baseColor.setAlpha(50);
altBaseColor.setAlpha(50);
buttonColor.setAlpha(150);
// Set colors
QPalette p = palette();
p.setColor( QPalette::Base, baseColor );
p.setColor( QPalette::AlternateBase, altBaseColor );
p.setColor( QPalette::Button, buttonColor );
p.setColor( QPalette::Foreground, textColor );
p.setColor( QPalette::Text, textColor );
proxyWidget = new QGraphicsProxyWidget();
m_view = new EventTreeView();
proxyWidget->setWidget(m_view);
proxyWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_view->setItemDelegate(m_delegate);
m_view->setPalette(p);
m_view->viewport()->setAutoFillBackground(false);
m_view->viewport()->setPalette( p );
connect(m_view, SIGNAL(tooltipUpdated(QString)),
SLOT(slotUpdateTooltip(QString)));
Plasma::Label *title = new Plasma::Label();
title->setText(i18n("Upcoming Events"));
QFont bold = font();
bold.setBold(true);
title->setFont(bold);
layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(title);
layout->addItem(proxyWidget);
m_graphicsWidget->setLayout(layout);
registerAsDragHandle(m_graphicsWidget);
}
return m_graphicsWidget;
}
void EventApplet::slotOpenEvent(const QModelIndex &index)
{
+#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
+ QString uid = m_filterModel->data(index, EventModel::ItemIDRole).toString();
+#else
QString uid = m_filterModel->data(index, EventModel::UIDRole).toString();
+#endif
if (!uid.isEmpty())
KOrganizerAppletUtil::showEvent(uid);
}
void EventApplet::openEventFromMenu()
{
slotOpenEvent(m_view->indexAtCursor());
}
void EventApplet::slotAddEvent()
{
KOrganizerAppletUtil::showAddEvent();
}
void EventApplet::slotAddTodo()
{
KOrganizerAppletUtil::showAddTodo();
}
void EventApplet::timerExpired()
{
if (lastCheckTime.date() != QDate::currentDate()) {
m_model->resetModel();
} else {
colorizeModel(TRUE);
}
lastCheckTime = QDateTime::currentDateTime();
m_timer->start(2 * 60 * 1000);
}
void EventApplet::setShownResources()
{
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Select Resources"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
QVBoxLayout *layout = new QVBoxLayout();
Akonadi::AgentInstance::List instList = m_agentManager->instances();
foreach (const Akonadi::AgentInstance &inst, instList) {
QStringList agentMimeTypes = inst.type().mimeTypes();
if (agentMimeTypes.contains("application/x-vnd.akonadi.calendar.event")) {
QCheckBox *resBox = new QCheckBox(inst.name());
resBox->setChecked(!disabledResources.contains(inst.identifier()));
resBox->setProperty("identifier", inst.identifier());
layout->addWidget(resBox);
}
}
widget->setLayout(layout);
dialog->setMainWidget(widget);
if (dialog->exec() == QDialog::Accepted) {
disabledResources.clear();
QList<QCheckBox *> resList = widget->findChildren<QCheckBox *>();
foreach (QCheckBox *box, resList) {
if (box->isChecked() == FALSE) {
disabledResources.append(box->property("identifier").toString());
}
}
KConfigGroup cg = config();
cg.writeEntry("DisabledResources", disabledResources);
emit configNeedsSaving();
m_filterModel->setExcludedResources(disabledResources);
m_view->expandAll();
}
}
QList<QAction *> EventApplet::contextualActions()
{
QList<QAction *> currentActions;
QModelIndex idx = m_view->indexAtCursor();
if (idx.isValid()) {
QVariant type = idx.data(EventModel::ItemTypeRole);
if (type.toInt() == EventModel::NormalItem || type.toInt() == EventModel::TodoItem) {
QString actionTitle = m_view->summaryAtCursor();
if (actionTitle.length() > 24) {
actionTitle.truncate(24);
actionTitle.append("...");
}
QAction *openEvent = new QAction(i18n("Open \"%1\"").arg(actionTitle), this);
openEvent->setIcon(KIcon("document-edit"));
connect(openEvent, SIGNAL(triggered()), this, SLOT(openEventFromMenu()));
currentActions.append(openEvent);
}
}
QAction *newEvent = new QAction(i18n("Add new event"), this);
newEvent->setIcon(KIcon("appointment-new"));
connect(newEvent, SIGNAL(triggered()), this, SLOT(slotAddEvent()));
currentActions.append(newEvent);
QAction *newTodo = new QAction(i18n("Add new todo"), this);
newTodo->setIcon(KIcon("view-task-add"));
connect(newTodo, SIGNAL(triggered()), this, SLOT(slotAddTodo()));
currentActions.append(newTodo);
QAction *selectResources = new QAction(i18n("Select shown resources"), this);
selectResources->setIcon(KIcon("view-calendar-tasks"));
connect(selectResources, SIGNAL(triggered()), this, SLOT(setShownResources()));
currentActions.append(selectResources);
return currentActions;
}
void EventApplet::slotUpdateTooltip(QString text)
{
tooltip.setSubText(text);
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createToolTip()
{
tooltip = Plasma::ToolTipContent(i18n("Upcoming Events"), "", KIcon("view-pim-tasks"));
tooltip.setMainText(i18n("Upcoming events from Akonadi resources"));
tooltip.setAutohide(FALSE);
}
void EventApplet::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
createToolTip();
Plasma::ToolTipManager::self()->setContent(this, tooltip);
}
void EventApplet::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *formatWidget = new QWidget();
m_formatConfig.setupUi(formatWidget);
m_formatConfig.setupConnections();
QWidget *colorWidget = new QWidget();
m_colorConfigUi.setupUi(colorWidget);
parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
parent->addPage(formatWidget, i18n("Text Format"), icon());
parent->addPage(colorWidget, i18n("Colors"), "fill-color");
KConfigGroup cg = config();
m_formatConfig.normalEventEdit->setText(cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")));
m_formatConfig.todoEdit->setText(cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")));
m_formatConfig.noDueDateEdit->setText(cg.readEntry("NoDueDateFormat", QString("%{summary}")));
m_formatConfig.dateFormatBox->setCurrentIndex(cg.readEntry("DateFormat", ShortDateFormat));
m_formatConfig.customFormatEdit->setText(cg.readEntry("CustomDateFormat", QString("dd.MM.")));
m_formatConfig.periodBox->setValue(cg.readEntry("Period", 365));
QMap<QString, QString>::const_iterator i = m_categoryFormat.constBegin();
while (i != m_categoryFormat.constEnd()) {
QStringList itemText;
itemText << i.key() << i.value();
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(itemText);
categoryItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
m_formatConfig.categoryFormatWidget->addTopLevelItem(categoryItem);
++i;
}
m_colorConfigUi.urgencyBox->setValue(cg.readEntry("UrgencyTime", 15));
m_colorConfigUi.birthdayUrgencyBox->setValue(cg.readEntry("BirthdayUrgencyTime", 14));
m_colorConfigUi.startedColorButton->setColor(QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))));
m_colorConfigUi.urgentColorButton->setColor(QColor(cg.readEntry("UrgentColor", QString("#FF0000"))));
m_colorConfigUi.urgentOpacity->setValue(cg.readEntry("UrgentOpacity", 10));
m_colorConfigUi.birthdayColorButton->setColor(QColor(cg.readEntry("BirthdayColor", QString("#C0FFC0"))));
m_colorConfigUi.birthdayOpacity->setValue(cg.readEntry("BirthdayOpacity", 10));
m_colorConfigUi.anniversariesColorButton->setColor(QColor(cg.readEntry("AnniversariesColor", QString("#ABFFEA"))));
m_colorConfigUi.anniversariesOpacity->setValue(cg.readEntry("AnniversariesOpacity", 10));
m_colorConfigUi.todoColorButton->setColor(QColor(cg.readEntry("TodoColor", QString("#FFD235"))));
m_colorConfigUi.todoOpacity->setValue(cg.readEntry("TodoOpacity", 10));
m_colorConfigUi.showFinishedTodos->setChecked(cg.readEntry("ShowFinishedTodos", FALSE));
m_colorConfigUi.finishedTodoButton->setColor(QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))));
m_colorConfigUi.finishedTodoOpacity->setValue(cg.readEntry("FinishedTodoOpacity", 10));
m_colorConfigUi.useKOrganizerColors->setChecked(cg.readEntry("UseKoColors", TRUE));
m_colorConfigUi.korganizerOpacity->setValue(cg.readEntry("KOOpacity", 10));
}
void EventApplet::configAccepted()
{
KConfigGroup cg = config();
QString normalEventFormat = m_formatConfig.normalEventEdit->text();
cg.writeEntry("NormalEventFormat", normalEventFormat);
QString todoFormat = m_formatConfig.todoEdit->text();
cg.writeEntry("TodoFormat", todoFormat);
QString noDueDateFormat = m_formatConfig.noDueDateEdit->text();
cg.writeEntry("NoDueDateFormat", noDueDateFormat);
int dateFormat = m_formatConfig.dateFormatBox->currentIndex();
cg.writeEntry("DateFormat", dateFormat);
QString customString = m_formatConfig.customFormatEdit->text();
cg.writeEntry("CustomDateFormat", customString);
m_delegate->settingsChanged(normalEventFormat, todoFormat, noDueDateFormat, dateFormat, customString);
int oldPeriod = cg.readEntry("Period", 365);
m_period = m_formatConfig.periodBox->value();
cg.writeEntry("Period", m_period);
int oldUrgency = m_urgency;
m_urgency = m_colorConfigUi.urgencyBox->value();
cg.writeEntry("UrgencyTime", m_urgency);
int oldBirthdayUrgency = m_birthdayUrgency;
m_birthdayUrgency = m_colorConfigUi.birthdayUrgencyBox->value();
cg.writeEntry("BirthdayUrgencyTime", m_birthdayUrgency);
QList<QColor> oldColors = m_colors;
m_colors.clear();
m_urgentBg = m_colorConfigUi.urgentColorButton->color();
int urgentOpacity = m_colorConfigUi.urgentOpacity->value();
cg.writeEntry("UrgentColor", m_urgentBg.name());
cg.writeEntry("UrgentOpacity", urgentOpacity);
m_urgentBg.setAlphaF(urgentOpacity/100.0);
m_colors.insert(urgentColorPos, m_urgentBg);
m_passedFg = m_colorConfigUi.startedColorButton->color();
cg.writeEntry("PassedColor", m_passedFg.name());
m_colors.insert(passedColorPos, m_passedFg);
m_birthdayBg = m_colorConfigUi.birthdayColorButton->color();
int birthdayOpacity = m_colorConfigUi.birthdayOpacity->value();
cg.writeEntry("BirthdayColor", m_birthdayBg.name());
cg.writeEntry("BirthdayOpacity", birthdayOpacity);
m_birthdayBg.setAlphaF(birthdayOpacity/100.0);
m_colors.insert(birthdayColorPos, m_birthdayBg);
m_anniversaryBg = m_colorConfigUi.anniversariesColorButton->color();
int anniversariesOpacity = m_colorConfigUi.anniversariesOpacity->value();
cg.writeEntry("AnniversariesColor", m_anniversaryBg.name());
cg.writeEntry("AnniversariesOpacity", anniversariesOpacity);
m_anniversaryBg.setAlphaF(anniversariesOpacity/100.0);
m_colors.insert(anniversariesColorPos, m_anniversaryBg);
m_todoBg = m_colorConfigUi.todoColorButton->color();
int todoOpacity = m_colorConfigUi.todoOpacity->value();
cg.writeEntry("TodoColor", m_todoBg.name());
cg.writeEntry("TodoOpacity", todoOpacity);
m_todoBg.setAlphaF(todoOpacity/100.0);
m_colors.insert(todoColorPos, m_todoBg);
bool oldShowFinishedTodos = m_showFinishedTodos;
m_showFinishedTodos = m_colorConfigUi.showFinishedTodos->isChecked();
cg.writeEntry("ShowFinishedTodos", m_showFinishedTodos);
m_finishedTodoBg = m_colorConfigUi.finishedTodoButton->color();
int finishedTodoOpacity = m_colorConfigUi.finishedTodoOpacity->value();
cg.writeEntry("FinishedTodoColor", m_finishedTodoBg.name());
cg.writeEntry("FinishedTodoOpacity", finishedTodoOpacity);
m_finishedTodoBg.setAlphaF(finishedTodoOpacity/100.0);
m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);
bool oldUseKoColors = m_useKoColors;
m_useKoColors = m_colorConfigUi.useKOrganizerColors->isChecked();
cg.writeEntry("UseKoColors", m_useKoColors);
QHash<QString, QColor> oldColorHash = m_categoryColors;
int opacity = m_colorConfigUi.korganizerOpacity->value();
cg.writeEntry("KOOpacity", opacity);
setupCategoryColors(opacity);
m_categoryFormat.clear();
QStringList keys, values;
QTreeWidgetItemIterator it(m_formatConfig.categoryFormatWidget);
while (*it) {
m_categoryFormat[(*it)->text(0)] = (*it)->text(1);
keys << (*it)->text(0);
values << (*it)->text(1);
++it;
}
cg.writeEntry("CategoryFormatsKeys", keys);
cg.writeEntry("CategoryFormatsValues", values);
m_delegate->setCategoryFormats(m_categoryFormat);
m_model->settingsChanged(m_urgency, m_birthdayUrgency, m_colors);
m_model->setCategoryColors(m_useKoColors, m_categoryColors);
if (oldPeriod != m_period) {
m_filterModel->setPeriod(m_period);
}
if (oldShowFinishedTodos != m_showFinishedTodos) {
m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
}
if (oldUrgency != m_urgency || oldBirthdayUrgency != m_birthdayUrgency || oldColors != m_colors ||
oldUseKoColors != m_useKoColors || oldColorHash != m_categoryColors) {
colorizeModel(FALSE);
}
m_view->expandAll();
emit configNeedsSaving();
}
void EventApplet::colorizeModel(bool timerTriggered)
{
QDateTime now = QDateTime::currentDateTime();
int headerRows = m_model->rowCount(QModelIndex());
for (int r = 0; r < headerRows; ++r) {
QModelIndex headerIndex = m_model->index(r, 0, QModelIndex());
QDateTime headerDtTime = m_model->data(headerIndex, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(headerDtTime) > m_birthdayUrgency) {
break;
}
int childRows = m_model->rowCount(headerIndex);
for (int c = 0; c < childRows; ++c) {
QModelIndex index = m_model->index(c, 0, headerIndex);
int itemRole = m_model->data(index, EventModel::ItemTypeRole).toInt();
QDateTime itemDtTime = m_model->data(index, EventModel::SortRole).toDateTime();
if (timerTriggered && now.daysTo(itemDtTime) > m_birthdayUrgency) {
break;
} else if (itemRole == EventModel::BirthdayItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_birthdayBg)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::AnniversaryItem) {
if (itemDtTime.date() >= now.date() && now.daysTo(itemDtTime) < m_birthdayUrgency) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_anniversaryBg)), Qt::BackgroundRole);
}
} else if (itemRole == EventModel::NormalItem) {
if (itemDtTime > now && now.secsTo(itemDtTime) < m_urgency * 60) {
m_model->setData(index, QVariant(QBrush(m_urgentBg)), Qt::BackgroundRole);
} else if (now > itemDtTime) {
m_model->setData(index, QVariant(QBrush(m_passedFg)), Qt::ForegroundRole);
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
} else {
if (m_useKoColors) {
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
if (!values["categories"].toStringList().isEmpty()) {
QString category = values["categories"].toStringList().first();
if (m_categoryColors.contains(category)) {
m_model->setData(index, QVariant(QBrush(m_categoryColors.value(category))), Qt::BackgroundRole);
}
}
} else {
m_model->setData(index, QVariant(QBrush(Qt::transparent)), Qt::BackgroundRole);
}
QColor defaultTextColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_model->setData(index, QVariant(QBrush(defaultTextColor)), Qt::ForegroundRole);
}
} else if (itemRole == EventModel::TodoItem) {
const QVariant v = index.data(Qt::DisplayRole);
QMap<QString, QVariant> values = v.toMap();
if (values["completed"].toBool() == TRUE) {
m_model->setData(index, QVariant(QBrush(m_finishedTodoBg)), Qt::BackgroundRole);
} else {
m_model->setData(index, QVariant(QBrush(m_todoBg)), Qt::BackgroundRole);
}
}
}
}
}
#include "eventapplet.moc"
diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 49b33fb..559f946 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,564 +1,560 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
-#define HAS_REAL_AKONADI_PIM_MAJOR 4
-#define HAS_REAL_AKONADI_PIM_MINOR 6
-#define HAS_REAL_AKONADI_PIM_PATCH 1
-
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
diff --git a/src/applet/eventmodel.h b/src/applet/eventmodel.h
index ef138fd..fe53aaa 100644
--- a/src/applet/eventmodel.h
+++ b/src/applet/eventmodel.h
@@ -1,112 +1,116 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <akonadi/monitor.h>
#include <akonadi/collection.h>
#include <kcal/event.h>
#include <kcal/todo.h>
// qt headers
#include <QStandardItemModel>
#include <QColor>
#include <QHash>
#include <QString>
class QStandardItem;
static const int ShortDateFormat = 0;
static const int LongDateFormat = 1;
static const int CustomDateFormat = 2;
static const int urgentColorPos = 0;
static const int passedColorPos = 1;
static const int birthdayColorPos = 2;
static const int anniversariesColorPos = 3;
static const int todoColorPos = 4;
static const int finishedTodoColorPos = 5;
+#define HAS_REAL_AKONADI_PIM_MAJOR 4
+#define HAS_REAL_AKONADI_PIM_MINOR 6
+#define HAS_REAL_AKONADI_PIM_PATCH 1
+
/**
* Model of the view
* Categorizes the events using the startDate property
*/
class EventModel : public QStandardItemModel
{
Q_OBJECT
public:
enum EventRole {
SortRole = Qt::UserRole + 1,
UIDRole,
ItemTypeRole,
TooltipRole,
ItemIDRole,
ResourceRole
};
enum ItemType {
HeaderItem = 0,
NormalItem,
BirthdayItem,
AnniversaryItem,
TodoItem
};
EventModel(QObject *parent = 0, int urgencyTime = 15, int birthdayTime = 14, QList<QColor> colorList = QList<QColor>());
~EventModel();
public:
void setDateFormat(int format, QString string);
void setCategoryColors(bool useKoColors, const QHash<QString, QColor>);
void initModel();
void initMonitor();
void resetModel();
void settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors);
private slots:
void addEventItem(const QMap <QString, QVariant> &values);
void addTodoItem(const QMap <QString, QVariant> &values);
void itemAdded(const Akonadi::Item &, const Akonadi::Collection &);
void removeItem(const Akonadi::Item &);
void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &);
void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
private:
void initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days);
void addItem(const Akonadi::Item &item, const Akonadi::Collection &collection);
void addItemRow(QDate eventDate, QStandardItem *items);
int figureRow(QStandardItem *headerItem);
QMap<QString, QVariant> eventDetails(const Akonadi::Item &, KCal::Event *, const Akonadi::Collection &);
QMap<QString, QVariant> todoDetails(const Akonadi::Item &, KCal::Todo *, const Akonadi::Collection &);
private:
QStandardItem *parentItem, *olderItem, *todayItem, *tomorrowItem, *weekItem, *monthItem, *laterItem, *somedayItem;
QList<QStandardItem *> sectionItems;
int urgency, birthdayUrgency;
QColor urgentBg, passedFg, birthdayBg, anniversariesBg, todoBg, finishedTodoBg;
bool m_useKoColors;
QHash<QString, QColor> m_categoryColors;
Akonadi::Monitor *m_monitor;
signals:
void modelNeedsExpanding();
};
#endif
|
geflei/plasmoid-eventlist | 8d4feb8130283153345868d528dd3ab8df384dd5 | Revert "for your changes. Lines starting" | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index fb0917f..49b33fb 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,569 +1,567 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
addItem(item, collection);
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
- values["itemUrl"] = item.url().url();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
- values["itemUrl"] = item.url().url();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | d913270b9684109165b1c104dc39798369444202 | not neede with pim 4.6 anymore | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index b518cb2..fb0917f 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,573 +1,569 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
#define HAS_REAL_AKONADI_PIM_MAJOR 4
#define HAS_REAL_AKONADI_PIM_MINOR 6
#define HAS_REAL_AKONADI_PIM_PATCH 1
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
-#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
- kDebug() << "item added" << item.remoteId();
-#else
addItem(item, collection);
-#endif
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["itemUrl"] = item.url().url();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["itemUrl"] = item.url().url();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 1bdadfbc5a3220815795efe01a83a20ed573b2e4 | use a define to ease changing pim if | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 6a77193..b518cb2 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,569 +1,573 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
+#define HAS_REAL_AKONADI_PIM_MAJOR 4
+#define HAS_REAL_AKONADI_PIM_MINOR 6
+#define HAS_REAL_AKONADI_PIM_PATCH 1
+
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
-#if KDE_IS_VERSION(4,6,1)
+#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
kDebug() << "item added" << item.remoteId();
#else
addItem(item, collection);
#endif
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
-#if KDE_IS_VERSION(4,6,1)
+#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
-#if KDE_IS_VERSION(4,6,1)
+#if KDE_IS_VERSION(HAS_REAL_AKONADI_PIM_MAJOR,HAS_REAL_AKONADI_PIM_MINOR,HAS_REAL_AKONADI_PIM_PATCH)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["itemUrl"] = item.url().url();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
values["itemUrl"] = item.url().url();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
geflei/plasmoid-eventlist | 0f0ffa7dea164207995a539b9f4c99e477fe56ed | for your changes. Lines starting | diff --git a/src/applet/eventmodel.cpp b/src/applet/eventmodel.cpp
index 0afb9b0..6a77193 100644
--- a/src/applet/eventmodel.cpp
+++ b/src/applet/eventmodel.cpp
@@ -1,567 +1,569 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Copyright (C) 2008 by Javier Goday <[email protected]>
* Copyright (C) 2009 by gerdfleischer <[email protected]>
*/
#include "eventmodel.h"
// kdepim headers
#include <kcal/incidenceformatter.h>
#include <kcal/recurrence.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/item.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/entitydisplayattribute.h>
#include <akonadi/servermanager.h>
#include <akonadi/kcal/incidencemimetypevisitor.h>
// qt headers
#include <QDate>
#include <QStandardItem>
// kde headers
#include <KIcon>
#include <KGlobal>
#include <KLocale>
#include <KGlobalSettings>
#include <KDateTime>
#include <Plasma/Theme>
#include <KDebug>
EventModel::EventModel(QObject *parent, int urgencyTime, int birthdayTime, QList<QColor> colorList) : QStandardItemModel(parent),
parentItem(0),
olderItem(0),
todayItem(0),
tomorrowItem(0),
weekItem(0),
monthItem(0),
laterItem(0),
somedayItem(0),
m_monitor(0)
{
parentItem = invisibleRootItem();
settingsChanged(urgencyTime, birthdayTime, colorList);
// initModel();
// initMonitor();
}
EventModel::~EventModel()
{
}
void EventModel::initModel()
{
if (!olderItem) {
olderItem = new QStandardItem();
initHeaderItem(olderItem, i18n("Earlier stuff"), i18n("Unfinished todos, still ongoing earlier events etc."), -28);
}
if (!todayItem) {
todayItem = new QStandardItem();
initHeaderItem(todayItem, i18n("Today"), i18n("Events of today"), 0);
}
if (!tomorrowItem) {
tomorrowItem = new QStandardItem();
initHeaderItem(tomorrowItem, i18n("Tomorrow"), i18n("Events for tomorrow"), 1);
}
if (!weekItem) {
weekItem = new QStandardItem();
initHeaderItem(weekItem, i18n("Week"), i18n("Events of the next week"), 2);
}
if (!monthItem) {
monthItem = new QStandardItem();
initHeaderItem(monthItem, i18n("Next 4 weeks"), i18n("Events for the next 4 weeks"), 8);
}
if (!laterItem) {
laterItem = new QStandardItem();
initHeaderItem(laterItem, i18n("Later"), i18n("Events later than 4 weeks"), 29);
}
if (!somedayItem) {
somedayItem = new QStandardItem();
initHeaderItem(somedayItem, i18n("Some day"), i18n("Todos with no due date"), 366);
}
// this list should always be sorted by date
sectionItems << olderItem << todayItem << tomorrowItem << weekItem << monthItem << laterItem << somedayItem;
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
if (job->exec()) {
Akonadi::Collection::List collections = job->collections();
foreach (const Akonadi::Collection &collection, collections) {
Akonadi::ItemFetchJob *ijob = new Akonadi::ItemFetchJob(collection);
ijob->fetchScope().fetchFullPayload();
if (ijob->exec()) {
Akonadi::Item::List items = ijob->items();
foreach (const Akonadi::Item &item, items) {
if (item.hasPayload <KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
} // if hasPayload
} // foreach
}
}
}
}
void EventModel::initMonitor()
{
m_monitor = new Akonadi::Monitor(this);
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAllAttributes(true);
m_monitor->fetchCollection(true);
m_monitor->setItemFetchScope(scope);
m_monitor->setCollectionMonitored(Akonadi::Collection::root());
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::eventMimeType(), true);
m_monitor->setMimeTypeMonitored(Akonadi::IncidenceMimeTypeVisitor::todoMimeType(), true);
connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)),
SLOT(itemAdded(const Akonadi::Item &, const Akonadi::Collection &)));
connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)),
SLOT(removeItem(const Akonadi::Item &)));
connect(m_monitor, SIGNAL(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)),
SLOT(itemChanged(const Akonadi::Item &, const QSet<QByteArray> &)));
connect(m_monitor, SIGNAL(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)),
SLOT(itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &)));
}
void EventModel::initHeaderItem(QStandardItem *item, QString title, QString toolTip, int days)
{
QMap<QString, QVariant> data;
data["itemType"] = HeaderItem;
data["title"] = title;
item->setData(data, Qt::DisplayRole);
item->setData(QVariant(QDateTime(QDate::currentDate().addDays(days))), SortRole);
item->setData(QVariant(HeaderItem), ItemTypeRole);
item->setData(QVariant(QString()), ResourceRole);
item->setData(QVariant(QString()), UIDRole);
item->setData(QVariant("<qt><b>" + toolTip + "</b></qt>"), TooltipRole);
QFont bold = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
bold.setBold(true);
item->setFont(bold);
}
void EventModel::resetModel()
{
clear();
parentItem = invisibleRootItem();
olderItem = 0;
todayItem = 0;
tomorrowItem = 0;
weekItem = 0;
monthItem = 0;
laterItem = 0;
somedayItem = 0;
sectionItems.clear();
delete m_monitor;
m_monitor = 0;
if (!Akonadi::ServerManager::isRunning()) {
QStandardItem *errorItem = new QStandardItem();
errorItem->setData(QVariant(i18n("The Akonadi server is not running!")), Qt::DisplayRole);
parentItem->appendRow(errorItem);
} else {
initModel();
initMonitor();
}
}
void EventModel::settingsChanged(int urgencyTime, int birthdayTime, QList<QColor> itemColors)
{
urgency = urgencyTime;
birthdayUrgency = birthdayTime;
urgentBg = itemColors.at(urgentColorPos);
passedFg = itemColors.at(passedColorPos);
birthdayBg = itemColors.at(birthdayColorPos);
anniversariesBg = itemColors.at(anniversariesColorPos);
todoBg = itemColors.at(todoColorPos);
finishedTodoBg = itemColors.at(finishedTodoColorPos);
}
void EventModel::setCategoryColors(bool useKoColors, QHash<QString, QColor> categoryColors)
{
m_useKoColors = useKoColors;
m_categoryColors = categoryColors;
}
void EventModel::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
#if KDE_IS_VERSION(4,6,1)
kDebug() << "item added" << item.remoteId();
#else
addItem(item, collection);
#endif
}
void EventModel::removeItem(const Akonadi::Item &item)
{
foreach (QStandardItem *i, sectionItems) {
QModelIndexList l;
if (i->hasChildren())
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
while (!l.isEmpty()) {
i->removeRow(l[0].row());
if (!i->hasChildren()) break;
l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
}
int r = i->row();
if (r != -1 && !i->hasChildren()) {
takeItem(r);
removeRow(r);
emit modelNeedsExpanding();
}
}
}
void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{
kDebug() << "item changed";
#if KDE_IS_VERSION(4,6,1)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::itemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &)
{
kDebug() << "item moved";
#if KDE_IS_VERSION(4,6,1)
removeItem(item);
addItem(item, item.parentCollection());
#else
Q_UNUSED(item);
#endif
}
void EventModel::addItem(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
if (item.hasPayload<KCal::Event::Ptr>()) {
KCal::Event *event = item.payload <KCal::Event::Ptr>().get();
if (event) {
addEventItem(eventDetails(item, event, collection));
} // if event
} else if (item.hasPayload <KCal::Todo::Ptr>()) {
KCal::Todo *todo = item.payload<KCal::Todo::Ptr>().get();
if (todo) {
addTodoItem(todoDetails(item, todo, collection));
}
}
}
void EventModel::addEventItem(const QMap<QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
QString category = values["mainCategory"].toString();
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["startDate"] = eventDtTime;
int d = values["startDate"].toDateTime().daysTo(values["endDate"].toDateTime());
data["endDate"] = eventDtTime.toDateTime().addDays(d);
QDate itemDt = eventDtTime.toDate();
if (values["isBirthday"].toBool()) {
data["itemType"] = BirthdayItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && (m_categoryColors.contains(i18n("Birthday")) || m_categoryColors.contains("Birthday"))) {
QString b = "Birthday";
if (m_categoryColors.contains(i18n("Birthday")))
b = i18n("Birthday");
eventItem->setBackground(QBrush(m_categoryColors.value(b)));
} else {
eventItem->setBackground(QBrush(birthdayBg));
}
}
eventItem->setData(QVariant(BirthdayItem), ItemTypeRole);
} else if (values["isAnniversary"].toBool()) {
data["itemType"] = AnniversaryItem;
int n = eventDtTime.toDate().year() - values["startDate"].toDate().year();
data["yearsSince"] = QString::number(n);
if (itemDt >= QDate::currentDate() && QDate::currentDate().daysTo(itemDt) < birthdayUrgency) {
eventItem->setBackground(QBrush(urgentBg));
} else {
if (m_useKoColors && m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
} else {
eventItem->setBackground(QBrush(anniversariesBg));
}
}
eventItem->setData(QVariant(AnniversaryItem), ItemTypeRole);
} else {
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
QDateTime itemDtTime = data["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
}
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(eventDtTime, SortRole);
eventItem->setData(values["uid"], UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
addItemRow(eventDtTime.toDate(), eventItem);
}
} else {
QStandardItem *eventItem;
eventItem = new QStandardItem();
data["itemType"] = NormalItem;
eventItem->setData(QVariant(NormalItem), ItemTypeRole);
eventItem->setData(data, Qt::DisplayRole);
eventItem->setData(values["startDate"], SortRole);
eventItem->setData(values["uid"], EventModel::UIDRole);
eventItem->setData(values["itemid"], ItemIDRole);
eventItem->setData(values["resource"], ResourceRole);
eventItem->setData(values["tooltip"], TooltipRole);
QDateTime itemDtTime = values["startDate"].toDateTime();
if (itemDtTime > QDateTime::currentDateTime() && QDateTime::currentDateTime().secsTo(itemDtTime) < urgency * 60) {
eventItem->setBackground(QBrush(urgentBg));
} else if (QDateTime::currentDateTime() > itemDtTime) {
eventItem->setForeground(QBrush(passedFg));
} else if (m_useKoColors) {
if (m_categoryColors.contains(category)) {
eventItem->setBackground(QBrush(m_categoryColors.value(category)));
}
}
addItemRow(values["startDate"].toDate(), eventItem);
}
}
void EventModel::addTodoItem(const QMap <QString, QVariant> &values)
{
QMap<QString, QVariant> data = values;
if (values["recurs"].toBool()) {
QList<QVariant> dtTimes = values["recurDates"].toList();
foreach (QVariant eventDtTime, dtTimes) {
QStandardItem *todoItem = new QStandardItem();
data["dueDate"] = eventDtTime;
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(eventDtTime, SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(eventDtTime.toDate(), todoItem);
}
} else {
QStandardItem *todoItem = new QStandardItem();
data["itemType"] = TodoItem;
todoItem->setData(QVariant(TodoItem), ItemTypeRole);
todoItem->setData(data, Qt::DisplayRole);
todoItem->setData(values["dueDate"], SortRole);
todoItem->setData(values["uid"], EventModel::UIDRole);
todoItem->setData(values["itemid"], ItemIDRole);
todoItem->setData(values["resource"], ResourceRole);
todoItem->setData(values["tooltip"], TooltipRole);
if (values["completed"].toBool() == TRUE) {
todoItem->setBackground(QBrush(finishedTodoBg));
} else {
todoItem->setBackground(QBrush(todoBg));
}
addItemRow(values["dueDate"].toDate(), todoItem);
}
}
void EventModel::addItemRow(QDate eventDate, QStandardItem *incidenceItem)
{
QStandardItem *headerItem = 0;
foreach (QStandardItem *item, sectionItems) {
if (eventDate < item->data(SortRole).toDate())
break;
else
headerItem = item;
}
if (headerItem) {
headerItem->appendRow(incidenceItem);
headerItem->sortChildren(0, Qt::AscendingOrder);
if (headerItem->row() == -1) {
parentItem->insertRow(figureRow(headerItem), headerItem);
}
emit modelNeedsExpanding();
}
}
int EventModel::figureRow(QStandardItem *headerItem)
{
int row = 0;
foreach (QStandardItem *item, sectionItems) {
if (item->data(SortRole).toDateTime() >= headerItem->data(SortRole).toDateTime())
break;
if (item->row() != -1)
row = item->row() + 1;
}
return row;
}
QMap<QString, QVariant> EventModel::eventDetails(const Akonadi::Item &item, KCal::Event *event, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = event->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
+ values["itemUrl"] = item.url().url();
values["summary"] = event->summary();
values["description"] = event->description();
values["location"] = event->location();
QStringList categories = event->categories();
values["categories"] = categories;
if (categories.isEmpty())
values["mainCategory"] = i18n("Unspecified");
else
values["mainCategory"] = categories.first();
values["status"] = event->status();
values["startDate"] = event->dtStart().dateTime().toLocalTime();
values["endDate"] = event->dtEnd().dateTime().toLocalTime();
bool recurs = event->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = event->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
if (event->customProperty("KABC", "BIRTHDAY") == QString("YES") || categories.contains(i18n("Birthday")) || categories.contains("Birthday")) {
values["isBirthday"] = QVariant(TRUE);
} else {
values["isBirthday"] = QVariant(FALSE);
}
event->customProperty("KABC", "ANNIVERSARY") == QString("YES") ? values ["isAnniversary"] = QVariant(TRUE) : QVariant(FALSE);
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), event, event->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(event, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
QMap<QString, QVariant> EventModel::todoDetails(const Akonadi::Item &item, KCal::Todo *todo, const Akonadi::Collection &collection)
{
QMap <QString, QVariant> values;
values["resource"] = collection.resource();
values["resourceName"] = collection.name();
values["uid"] = todo->uid();
values["itemid"] = item.id();
values["remoteid"] = item.remoteId();
+ values["itemUrl"] = item.url().url();
values["summary"] = todo->summary();
values["description"] = todo->description();
values["location"] = todo->location();
values["categories"] = todo->categoriesStr();
values["completed"] = todo->isCompleted();
values["percent"] = todo->percentComplete();
if (todo->hasStartDate()) {
values["startDate"] = todo->dtStart(FALSE).dateTime().toLocalTime();
values["hasStartDate"] = TRUE;
} else {
values["startDate"] = QDateTime();
values["hasStartDate"] = FALSE;
}
values["completedDate"] = todo->completed().dateTime().toLocalTime();
values["inProgress"] = todo->isInProgress(FALSE);
values["isOverdue"] = todo->isOverdue();
if (todo->hasDueDate()) {
values["dueDate"] = todo->dtDue().dateTime().toLocalTime();
values["hasDueDate"] = TRUE;
} else {
values["dueDate"] = QDateTime::currentDateTime().addDays(366);
values["hasDueDate"] = FALSE;
}
bool recurs = todo->recurs();
values["recurs"] = recurs;
QList<QVariant> recurDates;
if (recurs) {
KCal::Recurrence *r = todo->recurrence();
KCal::DateTimeList dtTimes = r->timesInInterval(KDateTime(QDate::currentDate()), KDateTime(QDate::currentDate()).addDays(365));
dtTimes.sortUnique();
foreach (KDateTime t, dtTimes) {
recurDates << QVariant(t.dateTime().toLocalTime());
}
}
values["recurDates"] = recurDates;
#if KDE_IS_VERSION(4,4,60)
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(collection.resource(), todo, todo->dtStart().date(), TRUE, KDateTime::Spec::LocalZone());
#else
values["tooltip"] = KCal::IncidenceFormatter::toolTipStr(todo, TRUE, KDateTime::Spec::LocalZone());
#endif
return values;
}
#include "eventmodel.moc"
|
jamis/dnd-writetem | 733004f628a886fc6f861740b3631e3b773d98e4 | gitignore | diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4b81f43
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+src/*.o
+src/*.a
|
jamis/dnd-writetem | 88b0559bc21d948df16a61dc5615b0d196429cbd | expand the README | diff --git a/README b/README
index ec6da49..7bd158a 100644
--- a/README
+++ b/README
@@ -1,7 +1,19 @@
+This library includes two features: writetem, a C library for parsing and
+processing text templates, and wtstream, a C library for providing a
+destination-agnostic stream-writing wrapper.
+
+The writetem system eventually fell out of favor, with the more powerful
+"templates" library (available in this same site) becoming preferred.
+
+Neither of these libraries is really recommended for general use. They are
+only being made available so that interested parties may build older systems
+that depend on these libraries (such as the Non-Player Character generator for
+D&D, also available from this site).
+
BUILDING
--------
This library was written well before I knew anything about autoconf and
friends. Thus, the makefile should be considered to be only a guideline, and
you're expected to actually MUCK WITH IT. Yes, I know. How deliciously
primitive.
\ No newline at end of file
|
jamis/dnd-writetem | dea81d72dbeb23b722419221cee7e241b1ac0b3a | Rename library | diff --git a/Makefile b/Makefile
index ebb82a9..1b359d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,15 @@
-all: libtemplates.a
+all: libwritetem.a
clean:
rm -f src/*.o src/*.a
-libtemplates.a: src/writetem.o src/wtstream.o
- ar -rc src/libtemplates.a src/writetem.o src/wtstream.o
- ranlib src/libtemplates.a
+libwritetem.a: src/writetem.o src/wtstream.o
+ ar -rc src/libwritetem.a src/writetem.o src/wtstream.o
+ ranlib src/libwritetem.a
src/writetem.o: src/writetem.c include/*.h
gcc -c -Iinclude -o src/writetem.o src/writetem.c
src/wtstream.o: src/wtstream.c include/wtstream.h
gcc -c -Iinclude -o src/wtstream.o src/wtstream.c
|
tissak/js_meta_dependency | 1ea9965c2bd242a62631c4cee1ad3dec397d3a36 | new readme | diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..0171b16
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,101 @@
+JS Meta Dependency
+==================
+
+Overview
+--------
+
+This is a prototype framework for Auto resolving and loading javascript.
+
+Inspired by dojo.require / dojo.provide the you can embed the dependencies of a JS file inside the top of the file and as the system is loading the JS it will determine what else it must load to satisfy that files dependencies.
+
+The key difference between this method and dojo's is that code does not execute until dependencies are satisfied and hence all JS can be loaded asynchronously as order is not important.
+
+This makes for a slightly different way of coding as code loading is an event and standalone from the rest of the page and other JS loading steps. To make things a little more traditional a DOM dependency is provided tied to when the page loads. With it you can make a block of code dependent on the page loading along with other code dependencies.
+
+Quick look
+----------
+
+Setting what a file provides and what it requires
+
+in module/file1.js
+
+ //**module.file1**
+ //--module.file2--
+ //--module.submodule.file3--
+
+ module.something = {
+ done: function(){
+ console.log("done")
+ }
+ }
+
+Here we can see that in the opening lines of the file we note what the file is providing with:
+ //**<module name>**
+And we can note the requirements with the next lines of
+ //--<dependency>--
+
+Just as with dojo and many other languages, the module name uses '.' style notation to represent paths. The first item in the module name is tied to a base path and then the following parts are a subdirectory till the last part of the module name which represents the file name.
+
+Now in the html page you can say:
+
+ $d.codeDomReady("module.level1",function(){
+ module.something.done();
+ });
+
+This will load the module.level1 and it's dependencies in the background and then execute the code block once code and dom are ready. If you were only waiting on the code and not the DOM you can say the same thing as:
+
+ $d.codeReady("module.level1",function(){
+ module.something.done();
+ });
+
+Reasoning
+---------
+
+Script tags are:
+
+* Annoying to maintain
+* Annoying to get in the right order
+* Annoying when it's another persons code and you aren't sure what it requires
+
+dojo.require:
+
+* Automatically resolves dependencies in an elegant way.
+* Removes concerns about 'reloading' as repeat dojo.require requests to the same files are skipped.
+* Is slow if you rely on it as it synchronously loads code and has to pull down and eval the code to determine what to load next.
+* Blocks the page loading as it's synchronous.
+
+js meta dep:
+
+* Does not stop you from loading your code with script tags..the meta information is commented out.
+* Can concurrently load code as it is ansynchronous
+* Can make code dependent on other code loading, not the whole page.
+* Does not block the page and other resource loading
+* Is still slower than using script tags if the client is resolving all the dependencies.
+* As with dojo.require removes concern about repeat requests to the same files.
+
+There's more
+------------
+
+The last point of the js meta dep list points out that if the client is resolving the dependencies then the process will still be slower than plain script tags as there's no way to know dep's until the first file is loaded. So to overcome this we can make the server do some work.
+
+In the prototype there is 'ruby_loader.rb'. This file contains a dependency resolver that does with the JS loader does only at the server. Inside the preview directory is main.rb, a sinatra server that implements this.
+
+The ruby loader takes a module name and at the server will run through all the dependencies, merging the files into a single JS file. This file is ordered in a way that meets all the requirements in a single execution. The outcome is that a require with the loader pulls in a single JS file that meets all dependencies. This outperforms both the client side resolving and the script tag approach as there's only a single server request.
+
+The one problem with this approach is that we don't want to reload deps but the server doesn't know what we have loaded. Hence the "requireWithLoader" js method not only makes a request to the server for the module but sends through what it currently has loaded. That way when the loader starts resolving deps it knows what it can skip over because it's already in the page.
+
+The Heart of the Process
+------------------------
+
+The heart of the system is the Dependency JS class. The idea from this came in a roundabout way from dojo.Deferred. dojo.Deferred for me was a conceptual revolution. The idea behind dojo.Deferred is that you can perform a task and queue up actions to occur in response to that task. But rather than only allow queuing up of actions before the task as run, it will allow you to add tasks after the task is run and immediately execute them. This removes the actions from knowing time wise anything about the triggering task.
+
+I wanted something similar only instead of one task triggering many actions I wanted many task results triggering one action. It's a bit of a tangled web as dependencies are both firing their own code and calling out to clear off other dependencies at the same time. But it makes for an interesting event driven landscape.
+
+Warnings and Disclaimers
+------------------------
+
+This code is the product of an idea. Not a well thought out idea. It's a prototype to give implementation to an idea with the thought that it could be taken further given time and resources.
+
+It currently has little in the way of robust coding and does not stop you from doing things like cyclic dependency issues. It's also in the pretest phase.
+
+Use this at your own risk.
\ No newline at end of file
|
tissak/js_meta_dependency | c86823333b0100caa6b094e8976f8bc1388f52d8 | new readme | diff --git a/README b/README
new file mode 100644
index 0000000..0171b16
--- /dev/null
+++ b/README
@@ -0,0 +1,101 @@
+JS Meta Dependency
+==================
+
+Overview
+--------
+
+This is a prototype framework for Auto resolving and loading javascript.
+
+Inspired by dojo.require / dojo.provide the you can embed the dependencies of a JS file inside the top of the file and as the system is loading the JS it will determine what else it must load to satisfy that files dependencies.
+
+The key difference between this method and dojo's is that code does not execute until dependencies are satisfied and hence all JS can be loaded asynchronously as order is not important.
+
+This makes for a slightly different way of coding as code loading is an event and standalone from the rest of the page and other JS loading steps. To make things a little more traditional a DOM dependency is provided tied to when the page loads. With it you can make a block of code dependent on the page loading along with other code dependencies.
+
+Quick look
+----------
+
+Setting what a file provides and what it requires
+
+in module/file1.js
+
+ //**module.file1**
+ //--module.file2--
+ //--module.submodule.file3--
+
+ module.something = {
+ done: function(){
+ console.log("done")
+ }
+ }
+
+Here we can see that in the opening lines of the file we note what the file is providing with:
+ //**<module name>**
+And we can note the requirements with the next lines of
+ //--<dependency>--
+
+Just as with dojo and many other languages, the module name uses '.' style notation to represent paths. The first item in the module name is tied to a base path and then the following parts are a subdirectory till the last part of the module name which represents the file name.
+
+Now in the html page you can say:
+
+ $d.codeDomReady("module.level1",function(){
+ module.something.done();
+ });
+
+This will load the module.level1 and it's dependencies in the background and then execute the code block once code and dom are ready. If you were only waiting on the code and not the DOM you can say the same thing as:
+
+ $d.codeReady("module.level1",function(){
+ module.something.done();
+ });
+
+Reasoning
+---------
+
+Script tags are:
+
+* Annoying to maintain
+* Annoying to get in the right order
+* Annoying when it's another persons code and you aren't sure what it requires
+
+dojo.require:
+
+* Automatically resolves dependencies in an elegant way.
+* Removes concerns about 'reloading' as repeat dojo.require requests to the same files are skipped.
+* Is slow if you rely on it as it synchronously loads code and has to pull down and eval the code to determine what to load next.
+* Blocks the page loading as it's synchronous.
+
+js meta dep:
+
+* Does not stop you from loading your code with script tags..the meta information is commented out.
+* Can concurrently load code as it is ansynchronous
+* Can make code dependent on other code loading, not the whole page.
+* Does not block the page and other resource loading
+* Is still slower than using script tags if the client is resolving all the dependencies.
+* As with dojo.require removes concern about repeat requests to the same files.
+
+There's more
+------------
+
+The last point of the js meta dep list points out that if the client is resolving the dependencies then the process will still be slower than plain script tags as there's no way to know dep's until the first file is loaded. So to overcome this we can make the server do some work.
+
+In the prototype there is 'ruby_loader.rb'. This file contains a dependency resolver that does with the JS loader does only at the server. Inside the preview directory is main.rb, a sinatra server that implements this.
+
+The ruby loader takes a module name and at the server will run through all the dependencies, merging the files into a single JS file. This file is ordered in a way that meets all the requirements in a single execution. The outcome is that a require with the loader pulls in a single JS file that meets all dependencies. This outperforms both the client side resolving and the script tag approach as there's only a single server request.
+
+The one problem with this approach is that we don't want to reload deps but the server doesn't know what we have loaded. Hence the "requireWithLoader" js method not only makes a request to the server for the module but sends through what it currently has loaded. That way when the loader starts resolving deps it knows what it can skip over because it's already in the page.
+
+The Heart of the Process
+------------------------
+
+The heart of the system is the Dependency JS class. The idea from this came in a roundabout way from dojo.Deferred. dojo.Deferred for me was a conceptual revolution. The idea behind dojo.Deferred is that you can perform a task and queue up actions to occur in response to that task. But rather than only allow queuing up of actions before the task as run, it will allow you to add tasks after the task is run and immediately execute them. This removes the actions from knowing time wise anything about the triggering task.
+
+I wanted something similar only instead of one task triggering many actions I wanted many task results triggering one action. It's a bit of a tangled web as dependencies are both firing their own code and calling out to clear off other dependencies at the same time. But it makes for an interesting event driven landscape.
+
+Warnings and Disclaimers
+------------------------
+
+This code is the product of an idea. Not a well thought out idea. It's a prototype to give implementation to an idea with the thought that it could be taken further given time and resources.
+
+It currently has little in the way of robust coding and does not stop you from doing things like cyclic dependency issues. It's also in the pretest phase.
+
+Use this at your own risk.
\ No newline at end of file
|
tissak/js_meta_dependency | e5901683f26d932b23ef09208571f9d6175fc038 | first cut of dependency system | diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..5e0cd35
Binary files /dev/null and b/.DS_Store differ
diff --git a/lib/.DS_Store b/lib/.DS_Store
new file mode 100644
index 0000000..5858bb5
Binary files /dev/null and b/lib/.DS_Store differ
diff --git a/lib/dependency.js b/lib/dependency.js
new file mode 100644
index 0000000..115ed0c
--- /dev/null
+++ b/lib/dependency.js
@@ -0,0 +1,304 @@
+(function(window){
+ // no op quick def
+ var noop = function(){};
+ // if no firebug like console, log out to no op. Create local console reference
+ var console = (typeof(console)=="undefined") ? {log:noop,warn:noop,error:noop} : console;
+
+ /**
+ * Deferred - Allows delayed processing by queueing callback methods that get fired when callback is triggered.
+ * Modelled on the dojo.Deferred class but simplified.
+ * @author tissak
+ */
+ /** @constructor */
+ var Deferred = function(){
+ this.chain = [];
+ this.err = [];
+ this.fired = -1;
+ this.result = null;
+ this.isFiring = false;
+ this.check = function(){
+ if(this.fired != -1){
+ throw "Already fired!";
+ }
+ if(this.fired == 1){
+ console.log("Error was fired");
+ }
+ }
+ /**
+ * Add a callback to fire on success of the Deferred. Note it will immediately fire if Deferred already successful.
+ * @param {Function} func Code to fire.
+ * @returns nothing
+ * @type Null
+ */
+ this.addCallback = function(func){
+ if(this.fired === 0){
+ //if we have already succeeded, immediately fire
+ func.apply(window, this.result);
+ }else{
+ this.chain.push(func);
+ }
+ };
+
+ /**
+ * Add a callback to fire in the case of an error / exception
+ * @param {String|Object|Array|Boolean|Number} paramName Describe this parameter
+ * @returns Describe what it returns
+ * @type String|Object|Array|Boolean|Number
+ */
+ this.addErrback = function(func){
+ this.check();
+ this.err.push(func);
+ };
+
+ /**
+ * Add both a success and fail callback in one move
+ * @param {Function} success Success callback
+ * @param {Function} fail Fail callback
+ * @returns Describe what it returns
+ * @type String|Object|Array|Boolean|Number
+ */
+ this.addBoth = function(success, fail){
+ this.check();
+ this.chain.push(success);
+ this.err.push(fail);
+ };
+
+ /**
+ * Trigger the fail state. Calls all errBack callbacks and sets the internal flag to failed.
+ * @returns Nothing
+ * @type Null
+ */
+ this.errback = function(){
+ this.check();
+ console.error("Error from deferred");
+ this.fired = 1;
+ jQuery.each(this.err, function(index,item){
+ item.call();
+ });
+ };
+ /**
+ * Triggers the callback state. If param is true, trigger all the success states else fire the fail states.
+ * @param {Boolean} val The success / fail value
+ * @returns nothing
+ * @type Null
+ */
+ this.callback = function(val){
+ if(this.isFiring){
+ return null;
+ }
+ this.check();
+ try{
+ if(val){
+ this.isFiring = true;
+ this.result = arguments;
+ var args = arguments;
+ jQuery.each(this.chain, function(index,item){
+ item.apply(window, args);
+ });
+ this.fired = 0;
+ this.isFiring = false;
+ }
+ } catch(e){
+ console.error("Error executing deferred callbacks");
+ this.error();
+ }
+ };
+ };
+
+ var _dependenciesResolvedArray = [];
+
+ $d = {
+ basePath:"/javascript/",
+ _dependenciesList: {},
+ _dependenciesResolved: {},
+ _dependencyInProgress:{},
+ _codeLoadedQueue: (new Deferred()),
+ isCodeLoaded: false,
+ /**
+ * Remove an item from an array by it's identity
+ * @param {Array} array The array set to work on
+ * @param {Object} name The object to to remove
+ * @returns
+ * @type
+ */
+ arrayRemove: function(array, name) {
+ if(array == null){ return; }
+ var pos = array.indexOf(name);
+ var rest = array.slice((pos) + 1 || array.length);
+ array.length = pos;
+ return array.push.apply(array, rest);
+ },
+ codeReady: function(requiredModules, func){
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ var dep = new $d.Dependency("inlineCode",requiredModules,func);
+ jQuery.each(requiredModules, function(index, module){
+ $d.dependencyRegister(module, dep, true)
+ })
+ },
+ codeDomReady: function(requiredModules, func){
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ requiredModules = requiredModules.concat(["DOM"]);
+ this.codeReady(requiredModules, func);
+ },
+ codeLoaded: function(func){
+ if(this.isCodeLoaded){
+ func.apply(window, []);
+ } else {
+ this._codeLoadedQueue.addCallback(func);
+ }
+ },
+ _codeLoaded:function(){
+ this.isCodeLoaded = true;
+ this._codeLoadedQueue.callback(true);
+ },
+ dependencyRegister: function(requiredModules, dependency){
+ console.log(this);
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ var self = this;
+ jQuery.each(requiredModules, function(index, moduleName){
+ if($d._dependenciesResolved[moduleName]){
+ dependency.executeCode();
+ }
+ if(!self._dependenciesList[moduleName])
+ self._dependenciesList[moduleName] = [];
+ self._dependenciesList[moduleName].push(dependency);
+ })
+ },
+ dependencySatisfied: function(moduleName){
+ $d._dependenciesResolved[moduleName] = true;
+ _dependenciesResolvedArray.push(moduleName);
+ var items = this._dependenciesList[moduleName];
+ if(items && items.length>0){
+ jQuery.each(items, function(index,item){
+ item.satisfied(moduleName);
+ });
+ }
+ if(!this.isCodeLoaded && (this._dependenciesList.length == this._dependenciesResolved.length)){
+ this._codeLoaded();
+ }
+ },
+ _moduleToPath: function(module){
+ var path = $d.basePath + module.replace(".","/") + ".js";
+ if(this.cacheBust){ path += "?rand="+(new Date()-1); }
+ return path;
+ },
+ preLoad: function(module){
+ $d._dependencyInProgress[module] = true;
+ $d.dependencySatisfied(module);
+ },
+ requireWithLoader: function(module){
+ if($d._dependencyInProgress[module]){ return true; }
+ $d._dependencyInProgress[module] = true;
+
+ var async = true;
+ var deps = {target_module: module, deps:_dependenciesResolvedArray};
+
+ /** success function */
+ var sfunc = function(data){ return $d._handleScriptFetch(module, data, async); };
+
+ /** fail function */
+ var efunc = function(data){ $d._dependencyInProgress[module] = false; console.log("Error loading "+module)};
+
+ jQuery.ajax({ url: "/loader", type:"get", data: deps, async: async, context:this, success: sfunc, error: efunc, dataType: "text"});
+ },
+ require: function(module, async){
+ async = true;
+ console.log("Require called: "+module)
+ /** setup async mode */
+ if(async==null){ async = $d.asyncMode; }
+
+ /** if we are already processing the requested dep, immediately return and let the existing processing complete */
+ if($d._dependencyInProgress[module]){ return true; }
+ $d._dependencyInProgress[module] = true;
+
+ /** convert a namespace to a path*/
+ var path = $d._moduleToPath(module);
+
+ /** success function */
+ var sfunc = function(data){ return $d._handleScriptFetch(module, data, async); };
+
+ /** fail function */
+ var efunc = function(data){ $d._dependencyInProgress[module] = false; console.log("Error loading "+module)};
+
+ jQuery.ajax({ url: path, type:"get", async: async, context:this, success: sfunc, error: efunc, dataType: "text"});
+ },
+ _handleScriptFetch: function(moduleName, data, async){
+ /** pull out the requires */
+ var requires = data.match(/\/\/\-\-(.*)\-\-/g);
+
+ if(requires && (requires.length>0)){
+ /** build up a list of cleaned up required elements */
+ var requiresSet = $d.collect(requires, function(index, item){
+ return item.match(/\/\/\-\-(.*)\-\-/)[1];
+ });
+ $d.dependencyRegister(requiresSet, (new $d.Dependency(moduleName, requiresSet, data)), async);
+ jQuery.each(requiresSet,function(index, item){
+ $d.require(item, async);
+ })
+ } else {
+ //do not require anything so execute the code and notify dependencies
+ jQuery.globalEval(data);
+ $d.dependencySatisfied(moduleName);
+ }
+ }
+ }
+
+ /**
+ * Collect uses an each iterator but collects the returns into a new array
+ * @public
+ * @param {Array} array array to loop over
+ * @param {Function} func function to appy
+ * @param {Object} scope scope to run the function within
+ * @returns Array of results
+ * @type Array
+ */
+ $d.collect = function(array, func, scope){
+ if(!scope){ scope = window; }
+ var arr = [];
+ jQuery.each(array, function(index, item){
+ arr.push(func.apply(scope, [index, item]));
+ });
+ return arr;
+ }
+
+
+ $d.Dependency = function(moduleName, requires, code){
+ this.constructor(moduleName, requires, code);
+ };
+ $d.Dependency.prototype = {
+ modName: "",
+ requires: null,
+ constructor:function(moduleName, requires, code){
+ this.modName = moduleName;
+ this.requires = requires;
+ this.waitingCode = code;
+ },
+ remove: function(name){
+ return $d.arrayRemove(this.requires, name);
+ },
+ satisfied: function(moduleName){
+ this.remove(moduleName);
+ if(this.requires.length==0){
+ this.executeCode();
+ }
+ },
+ executeCode: function(){
+ if(typeof(this.waitingCode) == "string"){ //ie xhr loaded
+ jQuery.globalEval(this.waitingCode);
+ this.waitingCode = null;
+ }
+ if(this.waitingCode){ //queued up function
+ this.waitingCode.apply(window, []);
+ }
+ // register back to the manager that we are now satisfied.
+ $d.dependencySatisfied(this.modName);
+ }
+ }
+
+
+ /** create a dependency against the dom. */
+ $(document).ready(function(){
+ $d.dependencySatisfied("DOM");
+ });
+
+})(window);
\ No newline at end of file
diff --git a/lib/dependency/level1.js b/lib/dependency/level1.js
new file mode 100644
index 0000000..2aa4f05
--- /dev/null
+++ b/lib/dependency/level1.js
@@ -0,0 +1,11 @@
+//**dep.level1**
+//--dep.level2--
+//--dep.level2_1--
+
+widgets.level1 = function(){
+
+}
+
+widgets.something.asd.a = function(){
+ document.body.innerHTML += "<br/>Dependency loaded: "+ $p.ping();
+};
diff --git a/lib/dependency/level1a.js b/lib/dependency/level1a.js
new file mode 100644
index 0000000..2e0d89f
--- /dev/null
+++ b/lib/dependency/level1a.js
@@ -0,0 +1,3 @@
+//**dep.level1a**
+//--dep.level2a--
+//--dep.level2_1a--
\ No newline at end of file
diff --git a/lib/dependency/level2.js b/lib/dependency/level2.js
new file mode 100644
index 0000000..18db054
--- /dev/null
+++ b/lib/dependency/level2.js
@@ -0,0 +1,6 @@
+//**dep.level2**
+//--dep.level3--
+widgets.level2 = function(){}
+
+
+widgets.something.asd = {};
\ No newline at end of file
diff --git a/lib/dependency/level2_1.js b/lib/dependency/level2_1.js
new file mode 100644
index 0000000..e5782c0
--- /dev/null
+++ b/lib/dependency/level2_1.js
@@ -0,0 +1,7 @@
+//**dep.level2_1**
+//--dep.level3--
+
+widgets.level21 = function(){}
+
+
+widgets.something.bsd = {};
\ No newline at end of file
diff --git a/lib/dependency/level2_1a.js b/lib/dependency/level2_1a.js
new file mode 100644
index 0000000..b5c1b31
--- /dev/null
+++ b/lib/dependency/level2_1a.js
@@ -0,0 +1,2 @@
+//**dep.level2_1a**
+//--dep.level3--
\ No newline at end of file
diff --git a/lib/dependency/level2a.js b/lib/dependency/level2a.js
new file mode 100644
index 0000000..208dd57
--- /dev/null
+++ b/lib/dependency/level2a.js
@@ -0,0 +1 @@
+//**dep.level2a**
\ No newline at end of file
diff --git a/lib/dependency/level3.js b/lib/dependency/level3.js
new file mode 100644
index 0000000..d4ce995
--- /dev/null
+++ b/lib/dependency/level3.js
@@ -0,0 +1,5 @@
+//**dep.level3**
+
+widgets.level3= function(){}
+
+widgets.something = {};
\ No newline at end of file
diff --git a/lib/dependency1.js b/lib/dependency1.js
new file mode 100644
index 0000000..c7411a6
--- /dev/null
+++ b/lib/dependency1.js
@@ -0,0 +1,57 @@
+/* dojo style simple sync load*/
+
+$e.mixin($e, {
+ _loaded: {},
+ _codeWaiting:[],
+ _addressing: [],
+ _moduleToPath: function(module){
+ return $e.basePath + module.replace(".","/") + ".js";
+ },
+ codeReady: function(moduleName, func){
+ if(this._loaded[moduleName]){
+ func()
+ } else {
+ $e._codeWaiting[moduleName] = ($e._codeWaiting[moduleName]) ? $e._codeWaiting[moduleName] : [];
+ $e._codeWaiting[moduleName].push(func);
+ }
+ },
+ require: function(moduleName){
+ if(this._loaded[moduleName]){return;}
+ var path = $e._moduleToPath(moduleName) + "?rand="+(new Date()-1);
+ var sfunc = function(data){
+ //tuck the module name into a scope for later usage
+ return $e._handleScriptFetch(moduleName, data);
+ };
+ jQuery.ajax({ url: path, tyep:"get", async: false, context:this, success: sfunc, dataType: "text"});
+ },
+ _handleScriptFetch: function(moduleName, data){
+ $e._addressing[moduleName] = true;
+ // this._depLoadedList[moduleName]=true;
+ // pull out provides and requires from commented space
+ var provides = data.match(/\/\/\*\*(.*)\*\*/g);
+ var requires = data.match(/\/\/\-\-(.*)\-\-/g);
+ if(provides && (provides.length > 0)){
+ // presume 1 provides line and clean off the commenting.
+ provides = provides[0].replace(/\/\//g,"").replace(/\*\*/g,"");
+ }
+ if(requires && (requires.length>0)){
+ var requiresSet = $e.collect(requires, function(index, item){
+ return item.replace(/\/\//g,"").replace(/\-\-/g,"");
+ });
+ jQuery.each(requiresSet, function(index, item){
+ if(!$e._addressing[item]){
+ $e.require(item)
+ }
+ })
+ }
+ console.log("Executing "+moduleName)
+ jQuery.globalEval(data);
+ this._loaded[moduleName] = true;
+ if($e._codeWaiting[moduleName]){
+ jQuery.each($e._codeWaiting[moduleName],function(index, item){
+ item.apply(this,[]);
+ })
+ }
+
+ }
+})
\ No newline at end of file
diff --git a/lib/dependency2.js b/lib/dependency2.js
new file mode 100644
index 0000000..115a788
--- /dev/null
+++ b/lib/dependency2.js
@@ -0,0 +1,99 @@
+// $e = ($e) ? $e : {};
+
+$e.declare(
+ "$e.Dependency",
+ null,
+ {
+ unsatisfiedModules: null,
+ satisfiedModules: null,
+ modName: "",
+ constructor:function(moduleName, requires, code){
+ this.modName = moduleName;
+ this.satisfiedModules = [];
+ this.unsatisfiedModules = requires;
+ this.waitingCode = code;
+ },
+ satisfied: function(moduleName){
+ this.satisfiedModules.push(moduleName);
+ if(this.satisfiedModules.length == this.unsatisfiedModules.length){
+ this.executeCode();
+ }
+ },
+ executeCode: function(){
+ if(typeof(this.waitingCode) == "string"){
+ jQuery.globalEval(this.waitingCode);
+ this.waitingCode = null;
+ } else {
+ this.waitingCode();
+ }
+ $e.dependencySatisfied(this.modName);
+ }
+ }
+);
+
+$e.mixin($e,{
+ _dependenciesList: {},
+ _depFetchedList: {},
+ _depResolved: {},
+ asyncMode: true,
+ _global: window,
+ provide: function(moduleName, requires, func){
+ console.log(arguments);
+ var dep = new $e.Dependency(moduleName, requires, func);
+ if((requires!=null)&&(requires.length > 0)){
+ console.log("has requires");
+ jQuery.each(requires, function(index, item){
+ $e.dependencyRegister(item, dep);
+ $e.require(item);
+ })
+ } else {
+ console.log("no requires");
+ func.apply(this._global, [])
+ $e.dependencySatisfied(moduleName);
+ }
+ },
+ codeReady: function(moduleName, func){
+ $e.dependencyRegister(moduleName, (new $e.Dependency("CODE", [moduleName], func)));
+ },
+ dependencyRegister: function(moduleName, dependency){
+ if($e._depResolved[moduleName]){
+ // if already resolved, immediately execute
+ dependency.executeCode();
+ }
+ if(this._dependenciesList[moduleName]==null){ this._dependenciesList[moduleName] = []; }
+ this._dependenciesList[moduleName].push(dependency);
+ },
+ dependencySatisfied: function(moduleName){
+ $e._depResolved[moduleName] = true;
+ if(this._dependenciesList[moduleName] && this._dependenciesList[moduleName].length>0){
+ var items = this._dependenciesList[moduleName];
+ jQuery.each(items, function(index,item){
+ item.satisfied(moduleName);
+ });
+ }
+ },
+ _moduleToPath: function(module){
+ return $e.basePath + module.replace(".","/") + ".js";
+ },
+ require: function(module){
+ if($e._depFetchedList[module]){ return true; }
+ $e._depFetchedList[module] = true;
+ var path = $e._moduleToPath(module); // + "?rand="+(new Date()-1);
+ var sfunc = function(data){
+ //tuck the module name into a scope for later usage
+ var moduleName = module;
+ return $e._handleScriptFetch(moduleName, data);
+ };
+ var efunc = function(data){
+ //tuck the module name into a scope for later usage
+ var moduleName = module;
+ $e._depFetchedList[module] = false;
+ };
+ this._fetchScript(path);
+ },
+ _fetchScript: function(path){
+ var headScript = $("head script")[0];
+ var tag = $e.string.substitute('<script type="text/javascript" src="${src}"></script>',{src:path});
+ $(tag).insertBefore(headScript);
+ }
+});
\ No newline at end of file
diff --git a/lib/dependencyResolver.js b/lib/dependencyResolver.js
new file mode 100644
index 0000000..0ef5a3f
--- /dev/null
+++ b/lib/dependencyResolver.js
@@ -0,0 +1,153 @@
+$e.declare(
+ "$e.Dependency",
+ null,
+ {
+ modName: "",
+ requires: null,
+ constructor:function(moduleName, requires, code){
+ this.modName = moduleName;
+ this.requires = requires;
+ this.waitingCode = code;
+ },
+ remove: function(name){
+ return $e.arrayRemove(this.requires, name);
+ },
+ satisfied: function(moduleName){
+ this.remove(moduleName);
+ if(this.requires.length==0){
+ this.executeCode();
+ }
+ },
+ executeCode: function(){
+ if(typeof(this.waitingCode) == "string"){ //ie xhr loaded
+ jQuery.globalEval(this.waitingCode);
+ $e.accumulate(this.waitingCode);
+ this.waitingCode = null;
+ } else { //queued up function
+ this.waitingCode.apply(window, []);
+ }
+ // register back to the manager that we are now satisfied.
+ $e.dependencySatisfied(this.modName);
+ }
+ }
+);
+
+$e.mixin($e,{
+ _dependenciesList: {},
+ _dependenciesResolved: {},
+ _dependencyInProgress:{},
+ _codeLoadedQueue: (new $e.Deferred()),
+ isCodeLoaded: false,
+ codeReady: function(requiredModules, func){
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ var dep = new $e.Dependency("inlineCode",requiredModules,func);
+ jQuery.each(requiredModules, function(index, module){
+ $e.dependencyRegister(module, dep, true)
+ })
+ },
+ codeDomReady: function(requiredModules, func){
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ requiredModules = requiredModules.concat(["DOM"]);
+ this.codeReady(requiredModules, func);
+ },
+ codeLoaded: function(func){
+ if(this.isCodeLoaded){
+ func.apply(window, []);
+ } else {
+ this._codeLoadedQueue.addCallback(func);
+ }
+ },
+ _codeLoaded:function(){
+ this.isCodeLoaded = true;
+ this._codeLoadedQueue.callback(true);
+ },
+ dependencyRegister: function(requiredModules, dependency){
+ console.log(this);
+ if(!jQuery.isArray(requiredModules)){ requiredModules = [requiredModules]; }
+ var self = this;
+ jQuery.each(requiredModules, function(index, moduleName){
+ if($e._dependenciesResolved[moduleName]){
+ dependency.executeCode();
+ }
+ if(!self._dependenciesList[moduleName])
+ self._dependenciesList[moduleName] = [];
+ self._dependenciesList[moduleName].push(dependency);
+ })
+ },
+ dependencySatisfied: function(moduleName){
+ $e._dependenciesResolved[moduleName] = true;
+ var items = this._dependenciesList[moduleName];
+ if(items && items.length>0){
+ jQuery.each(items, function(index,item){
+ item.satisfied(moduleName);
+ });
+ }
+ if(!this.isCodeLoaded && (this._dependenciesList.length == this._dependenciesResolved.length)){
+ this._codeLoaded();
+ }
+ },
+ _moduleToPath: function(module){
+ var path = $e.basePath + module.replace(".","/") + ".js";
+ if(this.cacheBust){ path += "?rand="+(new Date()-1); }
+ return path;
+ },
+ require: function(module, async){
+ console.log("Require called: "+module)
+ /** setup async mode */
+ if(async==null){ async = $e.asyncMode; }
+
+ /** if we are already processing the requested dep, immediately return and let the existing processing complete */
+ if($e._dependencyInProgress[module]){ return true; }
+ $e._dependencyInProgress[module] = true;
+
+ /** convert a namespace to a path*/
+ var path = $e._moduleToPath(module);
+
+ /** success function */
+ var sfunc = function(data){ return $e._handleScriptFetch(module, data, async); };
+
+ /** fail function */
+ var efunc = function(data){ $e._dependencyInProgress[module] = false; console.log("Error loading "+module)};
+
+ jQuery.ajax({ url: path, tyep:"get", async: async, context:this, success: sfunc, error: efunc, dataType: "text"});
+ },
+ _handleScriptFetch: function(moduleName, data, async){
+ /** pull out the requires */
+ var requires = data.match(/\/\/\-\-(.*)\-\-/g);
+
+ if(requires && (requires.length>0)){
+ /** build up a list of cleaned up required elements */
+ var requiresSet = $e.collect(requires, function(index, item){
+ return item.match(/\/\/\-\-(.*)\-\-/)[1];
+ });
+ $e.dependencyRegister(requiresSet, (new $e.Dependency(moduleName, requiresSet, data)), async);
+ jQuery.each(requiresSet,function(index, item){
+ $e.require(item, async);
+ })
+ } else {
+ //do not require anything so execute the code and notify dependencies
+ //console.log("Executing for " + moduleName+ " (No Deps)");
+ jQuery.globalEval(data);
+ $e.accumulate(data);
+ $e.dependencySatisfied(moduleName);
+ }
+ },
+ _dataStore: [],
+ accumulate:function(data){
+ /** pull out the provides */
+ var provides = data.match(/\/\/\*\*(.*)\*\*/);
+ var call = $e.string.substitute("$e.preLoad('${name}')",{name:provides[1]})
+ data = data.replace(/\/\/\*\*(.*)\*\*/, call);
+ data = data.replace(/\/\/\-\-(.*)\-\-/g, "");
+ this._dataStore.push(data);
+ },
+ reportCodeAccumulation: function(){
+ $("body").append($("<textarea>"+this._dataStore.join("\n\n")+"</textarea>"));
+
+ }
+});
+
+/** create a dependency against the dom. */
+$(document).ready(function(){
+ $e.dependencySatisfied("DOM");
+});
\ No newline at end of file
diff --git a/lib/jquery.js b/lib/jquery.js
new file mode 100644
index 0000000..bb4cdec
--- /dev/null
+++ b/lib/jquery.js
@@ -0,0 +1,5987 @@
+/*!
+ * jQuery JavaScript Library v1.4
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://docs.jquery.com/License
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Tue Jan 12 21:54:06 2010 -0500
+ */
+(function( window, undefined ) {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
+
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // Has the ready events already been bound?
+ readyBound = false,
+
+ // The functions to execute on DOM ready
+ readyList = [],
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwnProperty = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ indexOf = Array.prototype.indexOf;
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ doc = (context ? context.ownerDocument || context : document);
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = buildFragment( [ match[1] ], [ doc ] );
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
+ }
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ if ( elem ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $("TAG")
+ } else if ( !context && /^\w+$/.test( selector ) ) {
+ this.selector = selector;
+ this.context = document;
+ selector = document.getElementsByTagName( selector );
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return (context || rootjQuery).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return jQuery( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if (selector.selector !== undefined) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.isArray( selector ) ?
+ this.setArray( selector ) :
+ jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.4",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery( elems || null );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Force the current matched set of elements to become
+ // the specified array of elements (destroying the stack in the process)
+ // You should use pushStack() in order to do this, but maintain the stack
+ setArray: function( elems ) {
+ // Resetting the length to 0, then using the native Array push
+ // is a super-fast way to populate an object with array-like properties
+ this.length = 0;
+ push.apply( this, elems );
+
+ return this;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady ) {
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ } else if ( readyList ) {
+ // Add the function to the wait list
+ readyList.push( fn );
+ }
+
+ return this;
+ },
+
+ eq: function( i ) {
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, +i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || jQuery(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging object literal values or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
+ var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
+ : jQuery.isArray(copy) ? [] : {};
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 13 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( readyList ) {
+ // Execute all of them
+ var fn, i = 0;
+ while ( (fn = readyList[ i++ ]) ) {
+ fn.call( document, jQuery );
+ }
+
+ // Reset the list of functions
+ readyList = null;
+ }
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.triggerHandler ) {
+ jQuery( document ).triggerHandler( "ready" );
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyBound ) {
+ return;
+ }
+
+ readyBound = true;
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ return jQuery.ready();
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", DOMContentLoaded);
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return toString.call(obj) === "[object Function]";
+ },
+
+ isArray: function( obj ) {
+ return toString.call(obj) === "[object Array]";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
+ return false;
+ }
+
+ // Not own constructor property must be Object
+ if ( obj.constructor
+ && !hasOwnProperty.call(obj, "constructor")
+ && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwnProperty.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ noop: function() {},
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+
+ if ( jQuery.support.scriptEval ) {
+ script.appendChild( document.createTextNode( data ) );
+ } else {
+ script.text = data;
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction(object);
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ }
+ }
+
+ return object;
+ },
+
+ trim: function( text ) {
+ return (text || "").replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
+
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // The extra typeof function check is to prevent crashes
+ // in Safari 2 (See: #3039)
+ if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ if ( array.indexOf ) {
+ return array.indexOf( elem );
+ }
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ if ( array[ i ] === elem ) {
+ return i;
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var i = first.length, j = 0;
+
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [];
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ if ( !inv !== !callback( elems[ i ], i ) ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var ret = [], value;
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ proxy: function( fn, proxy, thisObject ) {
+ if ( arguments.length === 2 ) {
+ if ( typeof proxy === "string" ) {
+ thisObject = fn;
+ fn = thisObject[ proxy ];
+ proxy = undefined;
+
+ } else if ( proxy && !jQuery.isFunction( proxy ) ) {
+ thisObject = proxy;
+ proxy = undefined;
+ }
+ }
+
+ if ( !proxy && fn ) {
+ proxy = function() {
+ return fn.apply( thisObject || this, arguments );
+ };
+ }
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ if ( fn ) {
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+ }
+
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ var ret = { browser: "" };
+
+ ua = ua.toLowerCase();
+
+ if ( /webkit/.test( ua ) ) {
+ ret = { browser: "webkit", version: /webkit[\/ ]([\w.]+)/ };
+
+ } else if ( /opera/.test( ua ) ) {
+ ret = { browser: "opera", version: /version/.test( ua ) ? /version[\/ ]([\w.]+)/ : /opera[\/ ]([\w.]+)/ };
+
+ } else if ( /msie/.test( ua ) ) {
+ ret = { browser: "msie", version: /msie ([\w.]+)/ };
+
+ } else if ( /mozilla/.test( ua ) && !/compatible/.test( ua ) ) {
+ ret = { browser: "mozilla", version: /rv:([\w.]+)/ };
+ }
+
+ ret.version = (ret.version && ret.version.exec( ua ) || [0, "0"])[1];
+
+ return ret;
+ },
+
+ browser: {}
+});
+
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
+
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
+
+if ( indexOf ) {
+ jQuery.inArray = function( elem, array ) {
+ return indexOf.call( array, elem );
+ };
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+}
+
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( doScrollCheck, 1 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+}
+
+if ( indexOf ) {
+ jQuery.inArray = function( elem, array ) {
+ return indexOf.call( array, elem );
+ };
+}
+
+function evalScript( i, elem ) {
+ if ( elem.src ) {
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+ } else {
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+}
+
+// Mutifunctional method to get and set values to a collection
+// The value/s can be optionally by executed if its a function
+function access( elems, key, value, exec, fn, pass ) {
+ var length = elems.length;
+
+ // Setting many attributes
+ if ( typeof key === "object" ) {
+ for ( var k in key ) {
+ access( elems, k, key[k], exec, fn, value );
+ }
+ return elems;
+ }
+
+ // Setting one attribute
+ if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = !pass && exec && jQuery.isFunction(value);
+
+ for ( var i = 0; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+
+ return elems;
+ }
+
+ // Getting an attribute
+ return length ? fn( elems[0], key ) : null;
+}
+
+function now() {
+ return (new Date).getTime();
+}
+(function() {
+
+ jQuery.support = {};
+
+ var root = document.documentElement,
+ script = document.createElement("script"),
+ div = document.createElement("div"),
+ id = "script" + now();
+
+ div.style.display = "none";
+ div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ var all = div.getElementsByTagName("*"),
+ a = div.getElementsByTagName("a")[0];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return;
+ }
+
+ jQuery.support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText insted)
+ style: /red/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55$/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: div.getElementsByTagName("input")[0].value === "on",
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
+
+ // Will be defined later
+ scriptEval: false,
+ noCloneEvent: true,
+ boxModel: null
+ };
+
+ script.type = "text/javascript";
+ try {
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+ } catch(e) {}
+
+ root.insertBefore( script, root.firstChild );
+
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
+ if ( window[ id ] ) {
+ jQuery.support.scriptEval = true;
+ delete window[ id ];
+ }
+
+ root.removeChild( script );
+
+ if ( div.attachEvent && div.fireEvent ) {
+ div.attachEvent("onclick", function click() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ jQuery.support.noCloneEvent = false;
+ div.detachEvent("onclick", click);
+ });
+ div.cloneNode(true).fireEvent("onclick");
+ }
+
+ // Figure out if the W3C box model works as expected
+ // document.body must exist before we can do this
+ // TODO: This timeout is temporary until I move ready into core.js.
+ jQuery(function() {
+ var div = document.createElement("div");
+ div.style.width = div.style.paddingLeft = "1px";
+
+ document.body.appendChild( div );
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+ document.body.removeChild( div ).style.display = 'none';
+ div = null;
+ });
+
+ // Technique from Juriy Zaytsev
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
+
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
+
+ return isSupported;
+ };
+
+ jQuery.support.submitBubbles = eventSupported("submit");
+ jQuery.support.changeBubbles = eventSupported("change");
+
+ // release memory in IE
+ root = script = div = all = a = null;
+})();
+
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ tabindex: "tabIndex",
+ usemap: "useMap",
+ frameborder: "frameBorder"
+};
+var expando = "jQuery" + now(), uuid = 0, windowData = {};
+var emptyObject = {};
+
+jQuery.extend({
+ cache: {},
+
+ expando:expando,
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ "object": true,
+ "applet": true
+ },
+
+ data: function( elem, name, data ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ return;
+ }
+
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ], cache = jQuery.cache, thisCache;
+
+ // Handle the case where there's no name immediately
+ if ( !name && !id ) {
+ return null;
+ }
+
+ // Compute a unique ID for the element
+ if ( !id ) {
+ id = ++uuid;
+ }
+
+ // Avoid generating a new cache unless none exists and we
+ // want to manipulate it.
+ if ( typeof name === "object" ) {
+ elem[ expando ] = id;
+ thisCache = cache[ id ] = jQuery.extend(true, {}, name);
+ } else if ( cache[ id ] ) {
+ thisCache = cache[ id ];
+ } else if ( typeof data === "undefined" ) {
+ thisCache = emptyObject;
+ } else {
+ thisCache = cache[ id ] = {};
+ }
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined ) {
+ elem[ expando ] = id;
+ thisCache[ name ] = data;
+ }
+
+ return typeof name === "string" ? thisCache[ name ] : thisCache;
+ },
+
+ removeData: function( elem, name ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ return;
+ }
+
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( thisCache ) {
+ // Remove the section of cache data
+ delete thisCache[ name ];
+
+ // If we've removed all the data, remove the element's cache
+ if ( jQuery.isEmptyObject(thisCache) ) {
+ jQuery.removeData( elem );
+ }
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ // Clean up the element expando
+ try {
+ delete elem[ expando ];
+ } catch( e ) {
+ // IE has trouble directly removing the expando
+ // but it's ok with using removeAttribute
+ if ( elem.removeAttribute ) {
+ elem.removeAttribute( expando );
+ }
+ }
+
+ // Completely remove the data cache
+ delete cache[ id ];
+ }
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ if ( typeof key === "undefined" && this.length ) {
+ return jQuery.data( this[0] );
+
+ } else if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length ) {
+ data = jQuery.data( this[0], key );
+ }
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else {
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
+ jQuery.data( this, key, value );
+ });
+ }
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ if ( !elem ) {
+ return;
+ }
+
+ type = (type || "fx") + "queue";
+ var q = jQuery.data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( !data ) {
+ return q || [];
+ }
+
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
+
+ } else {
+ q.push( data );
+ }
+
+ return q;
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ), fn = queue.shift();
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
+
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift("inprogress");
+ }
+
+ fn.call(elem, function() {
+ jQuery.dequeue(elem, type);
+ });
+ }
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ }
+
+ if ( data === undefined ) {
+ return jQuery.queue( this[0], type );
+ }
+ return this.each(function( i, elem ) {
+ var queue = jQuery.queue( this, type, data );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function() {
+ var elem = this;
+ setTimeout(function() {
+ jQuery.dequeue( elem, type );
+ }, time );
+ });
+ },
+
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ }
+});
+var rclass = /[\n\t]/g,
+ rspace = /\s+/,
+ rreturn = /\r/g,
+ rspecialurl = /href|src|style/,
+ rtype = /(button|input)/i,
+ rfocusable = /(button|input|object|select|textarea)/i,
+ rclickable = /^(a|area)$/i,
+ rradiocheck = /radio|checkbox/;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return access( this, name, value, true, jQuery.attr );
+ },
+
+ removeAttr: function( name, fn ) {
+ return this.each(function(){
+ jQuery.attr( this, name, "" );
+ if ( this.nodeType === 1 ) {
+ this.removeAttribute( name );
+ }
+ });
+ },
+
+ addClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.addClass( value.call(this, i, self.attr("class")) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ var classNames = (value || "").split( rspace );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className ) {
+ elem.className = value;
+
+ } else {
+ var className = " " + elem.className + " ";
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
+ elem.className += " " + classNames[c];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.removeClass( value.call(this, i, self.attr("class")) );
+ });
+ }
+
+ if ( (value && typeof value === "string") || value === undefined ) {
+ var classNames = (value || "").split(rspace);
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
+
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ var className = (" " + elem.className + " ").replace(rclass, " ");
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[c] + " ", " ");
+ }
+ elem.className = className.substring(1, className.length - 1);
+
+ } else {
+ elem.className = "";
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value, isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className, i = 0, self = jQuery(this),
+ state = stateVal,
+ classNames = value.split( rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery.data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ";
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ if ( value === undefined ) {
+ var elem = this[0];
+
+ if ( elem ) {
+ if ( jQuery.nodeName( elem, "option" ) ) {
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+ }
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery(option).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ }
+
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+
+
+ // Everything else, we just grab the value
+ return (elem.value || "").replace(rreturn, "");
+
+ }
+
+ return undefined;
+ }
+
+ var isFunction = jQuery.isFunction(value);
+
+ return this.each(function(i) {
+ var self = jQuery(this), val = value;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call(this, i, self.val());
+ }
+
+ // Typecast each time if the value is a Function and the appended
+ // value is therefore different each time.
+ if ( typeof val === "number" ) {
+ val += "";
+ }
+
+ if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
+ this.checked = jQuery.inArray( self.val(), val ) >= 0;
+
+ } else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(val);
+
+ jQuery( "option", this ).each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ this.selectedIndex = -1;
+ }
+
+ } else {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
+ attr: function( elem, name, value, pass ) {
+ // don't set attributes on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery(elem)[name](value);
+ }
+
+ var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // Only do all the following if this is a node (faster for style)
+ if ( elem.nodeType === 1 ) {
+ // These attributes require special treatment
+ var special = rspecialurl.test( name );
+
+ // Safari mis-reports the default selected property of an option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name === "selected" && !jQuery.support.optSelected ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ }
+
+ // If applicable, access the attribute via the DOM 0 way
+ if ( name in elem && notxml && !special ) {
+ if ( set ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
+ throw "type property can't be changed";
+ }
+
+ elem[ name ] = value;
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
+ return elem.getAttributeNode( name ).nodeValue;
+ }
+
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ if ( name === "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
+
+ return attributeNode && attributeNode.specified ?
+ attributeNode.value :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+
+ return elem[ name ];
+ }
+
+ if ( !jQuery.support.style && notxml && name === "style" ) {
+ if ( set ) {
+ elem.style.cssText = "" + value;
+ }
+
+ return elem.style.cssText;
+ }
+
+ if ( set ) {
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+ }
+
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
+ // Some attributes require a special call on IE
+ elem.getAttribute( name, 2 ) :
+ elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+
+ // elem is actually elem.style ... set the style
+ // Using attr for specific style information is now deprecated. Use style insead.
+ return jQuery.style( elem, name, value );
+ }
+});
+var fcleanup = function( nm ) {
+ return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
+ return "\\" + ch;
+ });
+};
+
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function( elem, types, handler, data ) {
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
+ elem = window;
+ }
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // if data is passed, bind to handler
+ if ( data !== undefined ) {
+ // Create temporary function pointer to original handler
+ var fn = handler;
+
+ // Create unique handler function, wrapped around original handler
+ handler = jQuery.proxy( fn );
+
+ // Store data in unique handler
+ handler.data = data;
+ }
+
+ // Init the element's event structure
+ var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ),
+ handle = jQuery.data( elem, "handle" ), eventHandle;
+
+ if ( !handle ) {
+ eventHandle = function() {
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+ jQuery.event.handle.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+
+ handle = jQuery.data( elem, "handle", eventHandle );
+ }
+
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native
+ // event in IE.
+ handle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = types.split( /\s+/ );
+ var type, i=0;
+ while ( (type = types[ i++ ]) ) {
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ handler.type = namespaces.slice(0).sort().join(".");
+
+ // Get the current list of functions bound to this event
+ var handlers = events[ type ],
+ special = this.special[ type ] || {};
+
+
+
+ // Init the event handler queue
+ if ( !handlers ) {
+ handlers = events[ type ] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, handle, false );
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, handle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers );
+ if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) {
+ modifiedHandler.guid = modifiedHandler.guid || handler.guid;
+ handler = modifiedHandler;
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers[ handler.guid ] = handler;
+
+ // Keep track of which events have been used, for global triggering
+ this.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler ) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ var events = jQuery.data( elem, "events" ), ret, type, fn;
+
+ if ( events ) {
+ // Unbind all events for the element
+ if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) {
+ for ( type in events ) {
+ this.remove( elem, type + (types || "") );
+ }
+ } else {
+ // types is actually an event object here
+ if ( types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ types = types.split(/\s+/);
+ var i = 0;
+ while ( (type = types[ i++ ]) ) {
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ var all = !namespaces.length,
+ cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ),
+ namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"),
+ special = this.special[ type ] || {};
+
+ if ( events[ type ] ) {
+ // remove the given handler for the given type
+ if ( handler ) {
+ fn = events[ type ][ handler.guid ];
+ delete events[ type ][ handler.guid ];
+
+ // remove all handlers for the given type
+ } else {
+ for ( var handle in events[ type ] ) {
+ // Handle the removal of namespaced events
+ if ( all || namespace.test( events[ type ][ handle ].type ) ) {
+ delete events[ type ][ handle ];
+ }
+ }
+ }
+
+ if ( special.remove ) {
+ special.remove.call( elem, namespaces, fn);
+ }
+
+ // remove generic event handler if no more handlers exist
+ for ( ret in events[ type ] ) {
+ break;
+ }
+ if ( !ret ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, jQuery.data( elem, "handle" ), false );
+ } else if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) );
+ }
+ }
+ ret = null;
+ delete events[ type ];
+ }
+ }
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ for ( ret in events ) {
+ break;
+ }
+ if ( !ret ) {
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) {
+ handle.elem = null;
+ }
+ jQuery.removeData( elem, "events" );
+ jQuery.removeData( elem, "handle" );
+ }
+ }
+ },
+
+ // bubbling is internal
+ trigger: function( event, data, elem /*, bubbling */ ) {
+ // Event object or event type
+ var type = event.type || event,
+ bubbling = arguments[3];
+
+ if ( !bubbling ) {
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[expando] ? event :
+ // Object literal
+ jQuery.extend( jQuery.Event(type), event ) :
+ // Just the event type (string)
+ jQuery.Event(type);
+
+ if ( type.indexOf("!") >= 0 ) {
+ event.type = type = type.slice(0, -1);
+ event.exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Don't bubble custom events when global (to avoid too much overhead)
+ event.stopPropagation();
+
+ // Only trigger if we've ever bound an event for it
+ if ( this.global[ type ] ) {
+ jQuery.each( jQuery.cache, function() {
+ if ( this.events && this.events[type] ) {
+ jQuery.event.trigger( event, data, this.handle.elem );
+ }
+ });
+ }
+ }
+
+ // Handle triggering a single element
+
+ // don't do events on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ // Clean up in case it is reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone the incoming data, if any
+ data = jQuery.makeArray( data );
+ data.unshift( event );
+ }
+
+ event.currentTarget = elem;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) {
+ handle.apply( elem, data );
+ }
+
+ var nativeFn, nativeHandler;
+ try {
+ if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
+ nativeFn = elem[ type ];
+ nativeHandler = elem[ "on" + type ];
+ }
+ // prevent IE from throwing an error for some elements with some event types, see #3533
+ } catch (e) {}
+
+ var isClick = jQuery.nodeName(elem, "a") && type === "click";
+
+ // Trigger the native events (except for clicks on links)
+ if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !isClick ) {
+ this.triggered = true;
+ try {
+ elem[ type ]();
+ // prevent IE from throwing an error for some hidden elements
+ } catch (e) {}
+
+ // Handle triggering native .onfoo handlers
+ } else if ( nativeHandler && elem[ "on" + type ].apply( elem, data ) === false ) {
+ event.result = false;
+ }
+
+ this.triggered = false;
+
+ if ( !event.isPropagationStopped() ) {
+ var parent = elem.parentNode || elem.ownerDocument;
+ if ( parent ) {
+ jQuery.event.trigger( event, data, parent, true );
+ }
+ }
+ },
+
+ handle: function( event ) {
+ // returned undefined or false
+ var all, handlers;
+
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+ event.currentTarget = this;
+
+ // Namespaced event handlers
+ var namespaces = event.type.split(".");
+ event.type = namespaces.shift();
+
+ // Cache this now, all = true means, any handler
+ all = !namespaces.length && !event.exclusive;
+
+ var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
+
+ handlers = ( jQuery.data(this, "events") || {} )[ event.type ];
+
+ for ( var j in handlers ) {
+ var handler = handlers[ j ];
+
+ // Filter the functions by class
+ if ( all || namespace.test(handler.type) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handler;
+ event.data = handler.data;
+
+ var ret = handler.apply( this, arguments );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+
+ }
+ }
+
+ return event.result;
+ },
+
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
+ fix: function( event ) {
+ if ( event[ expando ] ) {
+ return event;
+ }
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ) {
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary
+ if ( !event.target ) {
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+ }
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement ) {
+ event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
+ }
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
+ event.which = event.charCode || event.keyCode;
+ }
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey ) {
+ event.metaKey = event.ctrlKey;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button !== undefined ) {
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+ }
+
+ return event;
+ },
+
+ // Deprecated, use jQuery.guid instead
+ guid: 1E8,
+
+ // Deprecated, use jQuery.proxy instead
+ proxy: jQuery.proxy,
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady,
+ teardown: jQuery.noop
+ },
+
+ live: {
+ add: function( proxy, data, namespaces, live ) {
+ jQuery.extend( proxy, data || {} );
+
+ proxy.guid += data.selector + data.live;
+ jQuery.event.add( this, data.live, liveHandler, data );
+
+ },
+
+ remove: function( namespaces ) {
+ if ( namespaces.length ) {
+ var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
+
+ jQuery.each( (jQuery.data(this, "events").live || {}), function() {
+ if ( name.test(this.type) ) {
+ remove++;
+ }
+ });
+
+ if ( remove < 1 ) {
+ jQuery.event.remove( this, namespaces[0], liveHandler );
+ }
+ }
+ },
+ special: {}
+ },
+ beforeunload: {
+ setup: function( data, namespaces, fn ) {
+ // We only want to do this special case on windows
+ if ( this.setInterval ) {
+ this.onbeforeunload = fn;
+ }
+
+ return false;
+ },
+ teardown: function( namespaces, fn ) {
+ if ( this.onbeforeunload === fn ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ }
+};
+
+jQuery.Event = function( src ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !this.preventDefault ) {
+ return new jQuery.Event( src );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = now();
+
+ // Mark it as fixed
+ this[ expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+ }
+ // otherwise set the returnValue property of the original event to false (IE)
+ e.returnValue = false;
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function( event ) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+
+ // Traverse up the tree
+ while ( parent && parent !== this ) {
+ // Firefox sometimes assigns relatedTarget a XUL element
+ // which we cannot access the parentNode property of
+ try {
+ parent = parent.parentNode;
+
+ // assuming we've left the element since we most likely mousedover a xul element
+ } catch(e) {
+ break;
+ }
+ }
+
+ if ( parent !== this ) {
+ // set the correct event type
+ event.type = event.data;
+
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+
+},
+
+// In case of event delegation, we only need to rename the event.type,
+// liveHandler will take care of the rest.
+delegate = function( event ) {
+ event.type = event.data;
+ jQuery.event.handle.apply( this, arguments );
+};
+
+// Create mouseenter and mouseleave events
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ setup: function( data ) {
+ jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
+ },
+ teardown: function( data ) {
+ jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
+ }
+ };
+});
+
+// submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+jQuery.event.special.submit = {
+ setup: function( data, namespaces, fn ) {
+ if ( this.nodeName.toLowerCase() !== "form" ) {
+ jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ jQuery.event.add(this, "keypress.specialSubmit." + fn.guid, function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ } else {
+ return false;
+ }
+ },
+
+ remove: function( namespaces, fn ) {
+ jQuery.event.remove( this, "click.specialSubmit" + (fn ? "."+fn.guid : "") );
+ jQuery.event.remove( this, "keypress.specialSubmit" + (fn ? "."+fn.guid : "") );
+ }
+};
+
+}
+
+// change delegation, happens here so we have bind.
+if ( !jQuery.support.changeBubbles ) {
+
+var formElems = /textarea|input|select/i;
+
+function getVal( elem ) {
+ var type = elem.type, val = elem.value;
+
+ if ( type === "radio" || type === "checkbox" ) {
+ val = elem.checked;
+
+ } else if ( type === "select-multiple" ) {
+ val = elem.selectedIndex > -1 ?
+ jQuery.map( elem.options, function( elem ) {
+ return elem.selected;
+ }).join("-") :
+ "";
+
+ } else if ( elem.nodeName.toLowerCase() === "select" ) {
+ val = elem.selectedIndex;
+ }
+
+ return val;
+}
+
+function testChange( e ) {
+ var elem = e.target, data, val;
+
+ if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
+ return;
+ }
+
+ data = jQuery.data( elem, "_change_data" );
+ val = getVal(elem);
+
+ if ( val === data ) {
+ return;
+ }
+
+ // the current data will be also retrieved by beforeactivate
+ if ( e.type !== "focusout" || elem.type !== "radio" ) {
+ jQuery.data( elem, "_change_data", val );
+ }
+
+ if ( elem.type !== "select" && (data != null || val) ) {
+ e.type = "change";
+ return jQuery.event.trigger( e, arguments[1], this );
+ }
+}
+
+jQuery.event.special.change = {
+ filters: {
+ focusout: testChange,
+
+ click: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Change has to be called before submit
+ // Keydown will be called before keypress, which is used in submit-event delegation
+ keydown: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
+ (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
+ type === "select-multiple" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Beforeactivate happens also before the previous element is blurred
+ // with this event you can't trigger a change event, but you can store
+ // information/focus[in] is not needed anymore
+ beforeactivate: function( e ) {
+ var elem = e.target;
+
+ if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) {
+ jQuery.data( elem, "_change_data", getVal(elem) );
+ }
+ }
+ },
+ setup: function( data, namespaces, fn ) {
+ for ( var type in changeFilters ) {
+ jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] );
+ }
+
+ return formElems.test( this.nodeName );
+ },
+ remove: function( namespaces, fn ) {
+ for ( var type in changeFilters ) {
+ jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] );
+ }
+
+ return formElems.test( this.nodeName );
+ }
+};
+
+var changeFilters = jQuery.event.special.change.filters;
+
+}
+
+function trigger( type, elem, args ) {
+ args[0].type = type;
+ return jQuery.event.handle.apply( elem, args );
+}
+
+// Create "bubbling" focus and blur events
+if ( document.addEventListener ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ this.addEventListener( orig, handler, true );
+ },
+ teardown: function() {
+ this.removeEventListener( orig, handler, true );
+ }
+ };
+
+ function handler( e ) {
+ e = jQuery.event.fix( e );
+ e.type = fix;
+ return jQuery.event.handle.call( this, e );
+ }
+ });
+}
+
+jQuery.each(["bind", "one"], function( i, name ) {
+ jQuery.fn[ name ] = function( type, data, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this[ name ](key, data, type[key], fn);
+ }
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) ) {
+ thisObject = fn;
+ fn = data;
+ data = undefined;
+ }
+
+ var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
+ jQuery( this ).unbind( event, handler );
+ return fn.apply( this, arguments );
+ }) : fn;
+
+ return type === "unload" && name !== "one" ?
+ this.one( type, data, fn, thisObject ) :
+ this.each(function() {
+ jQuery.event.add( this, type, handler, data );
+ });
+ };
+});
+
+jQuery.fn.extend({
+ unbind: function( type, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" && !type.preventDefault ) {
+ for ( var key in type ) {
+ this.unbind(key, type[key]);
+ }
+ return this;
+ }
+
+ return this.each(function() {
+ jQuery.event.remove( this, type, fn );
+ });
+ },
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ var event = jQuery.Event( type );
+ event.preventDefault();
+ event.stopPropagation();
+ jQuery.event.trigger( event, data, this[0] );
+ return event.result;
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while ( i < args.length ) {
+ jQuery.proxy( fn, args[ i++ ] );
+ }
+
+ return this.click( jQuery.proxy( fn, function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ },
+
+ live: function( type, data, fn ) {
+ if ( jQuery.isFunction( data ) ) {
+ fn = data;
+ data = undefined;
+ }
+
+ jQuery( this.context ).bind( liveConvert( type, this.selector ), {
+ data: data, selector: this.selector, live: type
+ }, fn );
+
+ return this;
+ },
+
+ die: function( type, fn ) {
+ jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
+ return this;
+ }
+});
+
+function liveHandler( event ) {
+ var stop = true, elems = [], selectors = [], args = arguments,
+ related, match, fn, elem, j, i, data,
+ live = jQuery.extend({}, jQuery.data( this, "events" ).live);
+
+ for ( j in live ) {
+ fn = live[j];
+ if ( fn.live === event.type ||
+ fn.altLive && jQuery.inArray(event.type, fn.altLive) > -1 ) {
+
+ data = fn.data;
+ if ( !(data.beforeFilter && data.beforeFilter[event.type] &&
+ !data.beforeFilter[event.type](event)) ) {
+ selectors.push( fn.selector );
+ }
+ } else {
+ delete live[j];
+ }
+ }
+
+ match = jQuery( event.target ).closest( selectors, event.currentTarget );
+
+ for ( i = 0, l = match.length; i < l; i++ ) {
+ for ( j in live ) {
+ fn = live[j];
+ elem = match[i].elem;
+ related = null;
+
+ if ( match[i].selector === fn.selector ) {
+ // Those two events require additional checking
+ if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) {
+ related = jQuery( event.relatedTarget ).closest( fn.selector )[0];
+ }
+
+ if ( !related || related !== elem ) {
+ elems.push({ elem: elem, fn: fn });
+ }
+ }
+ }
+ }
+
+ for ( i = 0, l = elems.length; i < l; i++ ) {
+ match = elems[i];
+ event.currentTarget = match.elem;
+ event.data = match.fn.data;
+ if ( match.fn.apply( match.elem, args ) === false ) {
+ stop = false;
+ break;
+ }
+ }
+
+ return stop;
+}
+
+function liveConvert( type, selector ) {
+ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join(".");
+}
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( fn ) {
+ return fn ? this.bind( name, fn ) : this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+});
+
+// Prevent memory leaks in IE
+// Window isn't included so as not to unbind existing unload events
+// More info:
+// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
+if ( window.attachEvent && !window.addEventListener ) {
+ window.attachEvent("onunload", function() {
+ for ( var id in jQuery.cache ) {
+ if ( jQuery.cache[ id ].handle ) {
+ // Try/Catch is to handle iframes being unloaded, see #4280
+ try {
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+ } catch(e) {}
+ }
+ }
+ });
+}
+/*!
+ * Sizzle CSS Selector Engine - v1.0
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function(){
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function(selector, context, results, seed) {
+ results = results || [];
+ var origContext = context = context || document;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set );
+ }
+ }
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+ var ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+ }
+
+ if ( context ) {
+ var ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+ set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray(set);
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ var cur = parts.pop(), pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+ } else if ( context && context.nodeType === 1 ) {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+ } else {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function(results){
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort(sortOrder);
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[i-1] ) {
+ results.splice(i--, 1);
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function(expr, set){
+ return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+ var set, match;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var type = Expr.order[i], match;
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ var left = match[1];
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace(/\\/g, "");
+ set = Expr.find[ type ]( match, context, isXML );
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = context.getElementsByTagName("*");
+ }
+
+ return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+ var old = expr, result = [], curLoop = set, match, anyFound,
+ isXMLFilter = set && set[0] && isXML(set[0]);
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ var filter = Expr.filter[ type ], found, item, left = match[1];
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+ } else {
+ curLoop[i] = false;
+ }
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ throw "Syntax error, unrecognized expression: " + expr;
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+ leftMatch: {},
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+ attrHandle: {
+ href: function(elem){
+ return elem.getAttribute("href");
+ }
+ },
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !/\W/.test(part),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+ ">": function(checkSet, part){
+ var isPartStr = typeof part === "string";
+
+ if ( isPartStr && !/\W/.test(part) ) {
+ part = part.toLowerCase();
+
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+ } else {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+ "": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ var nodeCheck = part = part.toLowerCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+ },
+ "~": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ var nodeCheck = part = part.toLowerCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+ }
+ },
+ find: {
+ ID: function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? [m] : [];
+ }
+ },
+ NAME: function(match, context){
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [], results = context.getElementsByName(match[1]);
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+ TAG: function(match, context){
+ return context.getElementsByTagName(match[1]);
+ }
+ },
+ preFilter: {
+ CLASS: function(match, curLoop, inplace, result, not, isXML){
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+ ID: function(match){
+ return match[1].replace(/\\/g, "");
+ },
+ TAG: function(match, curLoop){
+ return match[1].toLowerCase();
+ },
+ CHILD: function(match){
+ if ( match[1] === "nth" ) {
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+ ATTR: function(match, curLoop, inplace, result, not, isXML){
+ var name = match[1].replace(/\\/g, "");
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+ PSEUDO: function(match, curLoop, inplace, result, not){
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+ return false;
+ }
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+ POS: function(match){
+ match.unshift( true );
+ return match;
+ }
+ },
+ filters: {
+ enabled: function(elem){
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+ disabled: function(elem){
+ return elem.disabled === true;
+ },
+ checked: function(elem){
+ return elem.checked === true;
+ },
+ selected: function(elem){
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ elem.parentNode.selectedIndex;
+ return elem.selected === true;
+ },
+ parent: function(elem){
+ return !!elem.firstChild;
+ },
+ empty: function(elem){
+ return !elem.firstChild;
+ },
+ has: function(elem, i, match){
+ return !!Sizzle( match[3], elem ).length;
+ },
+ header: function(elem){
+ return /h\d/i.test( elem.nodeName );
+ },
+ text: function(elem){
+ return "text" === elem.type;
+ },
+ radio: function(elem){
+ return "radio" === elem.type;
+ },
+ checkbox: function(elem){
+ return "checkbox" === elem.type;
+ },
+ file: function(elem){
+ return "file" === elem.type;
+ },
+ password: function(elem){
+ return "password" === elem.type;
+ },
+ submit: function(elem){
+ return "submit" === elem.type;
+ },
+ image: function(elem){
+ return "image" === elem.type;
+ },
+ reset: function(elem){
+ return "reset" === elem.type;
+ },
+ button: function(elem){
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
+ },
+ input: function(elem){
+ return /input|select|textarea|button/i.test(elem.nodeName);
+ }
+ },
+ setFilters: {
+ first: function(elem, i){
+ return i === 0;
+ },
+ last: function(elem, i, match, array){
+ return i === array.length - 1;
+ },
+ even: function(elem, i){
+ return i % 2 === 0;
+ },
+ odd: function(elem, i){
+ return i % 2 === 1;
+ },
+ lt: function(elem, i, match){
+ return i < match[3] - 0;
+ },
+ gt: function(elem, i, match){
+ return i > match[3] - 0;
+ },
+ nth: function(elem, i, match){
+ return match[3] - 0 === i;
+ },
+ eq: function(elem, i, match){
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function(elem, match, i, array){
+ var name = match[1], filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var i = 0, l = not.length; i < l; i++ ) {
+ if ( not[i] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+ } else {
+ throw "Syntax error, unrecognized expression: " + name;
+ }
+ },
+ CHILD: function(elem, match){
+ var type = match[1], node = elem;
+ switch (type) {
+ case 'only':
+ case 'first':
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ if ( type === "first" ) {
+ return true;
+ }
+ node = elem;
+ case 'last':
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ return true;
+ case 'nth':
+ var first = match[2], last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+ if ( first === 0 ) {
+ return diff === 0;
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+ ID: function(elem, match){
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+ TAG: function(elem, match){
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+ },
+ CLASS: function(elem, match){
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+ ATTR: function(elem, match){
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+ POS: function(elem, match, i, array){
+ var name = match[2], filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS;
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
+ return "\\" + (num - 0 + 1);
+ }));
+}
+
+var makeArray = function(array, results) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 );
+
+// Provide a fallback method if it does not work
+} catch(e){
+ makeArray = function(array, results) {
+ var ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var i = 0, l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+ } else {
+ for ( var i = 0; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( "sourceIndex" in document.documentElement ) {
+ sortOrder = function( a, b ) {
+ if ( !a.sourceIndex || !b.sourceIndex ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.sourceIndex ? -1 : 1;
+ }
+
+ var ret = a.sourceIndex - b.sourceIndex;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( document.createRange ) {
+ sortOrder = function( a, b ) {
+ if ( !a.ownerDocument || !b.ownerDocument ) {
+ if ( a == b ) {
+ hasDuplicate = true;
+ }
+ return a.ownerDocument ? -1 : 1;
+ }
+
+ var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+ aRange.setStart(a, 0);
+ aRange.setEnd(a, 0);
+ bRange.setStart(b, 0);
+ bRange.setEnd(b, 0);
+ var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+}
+
+// Utility function for retreiving the text value of an array of DOM nodes
+function getText( elems ) {
+ var ret = "", elem;
+
+ for ( var i = 0; elems[i]; i++ ) {
+ elem = elems[i];
+
+ // Get the text from text nodes and CDATA nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+ ret += elem.nodeValue;
+
+ // Traverse everything else, except comment nodes
+ } else if ( elem.nodeType !== 8 ) {
+ ret += getText( elem.childNodes );
+ }
+ }
+
+ return ret;
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date).getTime();
+ form.innerHTML = "<a name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ var root = document.documentElement;
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+ }
+ };
+
+ Expr.filter.ID = function(elem, match){
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+ root = form = null; // release memory in IE
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function(match, context){
+ var results = context.getElementsByTagName(match[1]);
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+ Expr.attrHandle.href = function(elem){
+ return elem.getAttribute("href", 2);
+ };
+ }
+
+ div = null; // release memory in IE
+})();
+
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle, div = document.createElement("div");
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function(query, context, extra, seed){
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(e){}
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
+
+ div = null; // release memory in IE
+ })();
+}
+
+(function(){
+ var div = document.createElement("div");
+
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+ return;
+ }
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 ) {
+ return;
+ }
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function(match, context, isXML) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+
+ div = null; // release memory in IE
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName.toLowerCase() === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+var contains = document.compareDocumentPosition ? function(a, b){
+ return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+ return a !== b && (a.contains ? a.contains(b) : true);
+};
+
+var isXML = function(elem){
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function(selector, context){
+ var tmpSet = [], later = "", match,
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.getText = getText;
+jQuery.isXMLDoc = isXML;
+jQuery.contains = contains;
+
+return;
+
+window.Sizzle = Sizzle;
+
+})();
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ slice = Array.prototype.slice;
+
+// Implement the identical functionality for filter and not
+var winnow = function( elements, qualifier, keep ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return !!qualifier.call( elem, i, elem ) === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return (elem === qualifier) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, elements );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
+ });
+};
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var ret = this.pushStack( "", "find", selector ), length = 0;
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( var n = length; n < ret.length; n++ ) {
+ for ( var r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.filter( selector, this ).length > 0;
+ },
+
+ closest: function( selectors, context ) {
+ if ( jQuery.isArray( selectors ) ) {
+ var ret = [], cur = this[0], match, matches = {}, selector;
+
+ if ( cur && selectors.length ) {
+ for ( var i = 0, l = selectors.length; i < l; i++ ) {
+ selector = selectors[i];
+
+ if ( !matches[selector] ) {
+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
+ jQuery( selector, context || this.context ) :
+ selector;
+ }
+ }
+
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( selector in matches ) {
+ match = matches[selector];
+
+ if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
+ ret.push({ selector: selector, elem: cur });
+ delete matches[selector];
+ }
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ return ret;
+ }
+
+ var pos = jQuery.expr.match.POS.test( selectors ) ?
+ jQuery( selectors, context || this.context ) : null;
+
+ return this.map(function( i, cur ) {
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
+ return cur;
+ }
+ cur = cur.parentNode;
+ }
+ return null;
+ });
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ if ( !elem || typeof elem === "string" ) {
+ return jQuery.inArray( this[0],
+ // If it receives a string, the selector is used
+ // If it receives nothing, the siblings are used
+ elem ? jQuery( elem ) : this.parent().children() );
+ }
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context || this.context ) :
+ jQuery.makeArray( selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( set[0] && (set[0].setInterval || set[0].nodeType === 9 || (set[0].parentNode && set[0].parentNode.nodeType !== 11)) ?
+ jQuery.unique( all ) :
+ all );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( elem.parentNode.firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 ? jQuery.unique( ret ) : ret;
+
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, slice.call(arguments).join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [], cur = elem[dir];
+ while ( cur && cur.nodeType !== 9 && (until === undefined || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
+ rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&\w+;/,
+ fcloseTag = function( all, front, tag ) {
+ return rselfClosing.test( tag ) ?
+ all :
+ front + "></" + tag + ">";
+ },
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ area: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ };
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE can't serialize <link> and <script> tags normally
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
+}
+
+jQuery.fn.extend({
+ text: function( text ) {
+ if ( jQuery.isFunction(text) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ return self.text( text.call(this, i, self.text()) );
+ });
+ }
+
+ if ( typeof text !== "object" && text !== undefined ) {
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+ }
+
+ return jQuery.getText( this );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append(this);
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ return this.each(function() {
+ var self = jQuery( this ), contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function() {
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ } else if ( arguments.length ) {
+ var set = jQuery(arguments[0]);
+ set.push.apply( set, this.toArray() );
+ return this.pushStack( set, "before", arguments );
+ }
+ },
+
+ after: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ } else if ( arguments.length ) {
+ var set = this.pushStack( this, "after", arguments );
+ set.push.apply( set, jQuery(arguments[0]).toArray() );
+ return set;
+ }
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function() {
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var html = this.outerHTML, ownerDocument = this.ownerDocument;
+ if ( !html ) {
+ var div = ownerDocument.createElement("div");
+ div.appendChild( this.cloneNode(true) );
+ html = div.innerHTML;
+ }
+
+ return jQuery.clean([html.replace(rinlinejQuery, "")
+ .replace(rleadingWhitespace, "")], ownerDocument)[0];
+ } else {
+ return this.cloneNode(true);
+ }
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true ) {
+ cloneCopyEvent( this, ret );
+ cloneCopyEvent( this.find("*"), ret.find("*") );
+ }
+
+ // Return the cloned set
+ return ret;
+ },
+
+ html: function( value ) {
+ if ( value === undefined ) {
+ return this[0] && this[0].nodeType === 1 ?
+ this[0].innerHTML.replace(rinlinejQuery, "") :
+ null;
+
+ // See if we can take a shortcut and just use innerHTML
+ } else if ( typeof value === "string" && !/<script/i.test( value ) &&
+ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
+ !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
+
+ try {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( this[i].nodeType === 1 ) {
+ cleanData( this[i].getElementsByTagName("*") );
+ this[i].innerHTML = value;
+ }
+ }
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {
+ this.empty().append( value );
+ }
+
+ } else if ( jQuery.isFunction( value ) ) {
+ this.each(function(i){
+ var self = jQuery(this), old = self.html();
+ self.empty().append(function(){
+ return value.call( this, i, old );
+ });
+ });
+
+ } else {
+ this.empty().append( value );
+ }
+
+ return this;
+ },
+
+ replaceWith: function( value ) {
+ if ( this[0] && this[0].parentNode ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( !jQuery.isFunction( value ) ) {
+ value = jQuery( value ).detach();
+ }
+
+ return this.each(function() {
+ var next = this.nextSibling, parent = this.parentNode;
+
+ jQuery(this).remove();
+
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ } else {
+ return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
+ }
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+ var results, first, value = args[0], scripts = [];
+
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call(this, i, table ? self.html() : undefined);
+ return self.domManip( args, table, callback );
+ });
+ }
+
+ if ( this[0] ) {
+ // If we're in a fragment, just use that instead of building a new one
+ if ( args[0] && args[0].parentNode && args[0].parentNode.nodeType === 11 ) {
+ results = { fragment: args[0].parentNode };
+ } else {
+ results = buildFragment( args, this, scripts );
+ }
+
+ first = results.fragment.firstChild;
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ callback.call(
+ table ?
+ root(this[i], first) :
+ this[i],
+ results.cacheable || this.length > 1 || i > 0 ?
+ results.fragment.cloneNode(true) :
+ results.fragment
+ );
+ }
+ }
+
+ if ( scripts ) {
+ jQuery.each( scripts, evalScript );
+ }
+ }
+
+ return this;
+
+ function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+ }
+ }
+});
+
+function cloneCopyEvent(orig, ret) {
+ var i = 0;
+
+ ret.each(function() {
+ if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
+ return;
+ }
+
+ var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( var type in events ) {
+ for ( var handler in events[ type ] ) {
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ }
+ }
+ }
+ });
+}
+
+function buildFragment( args, nodes, scripts ) {
+ var fragment, cacheable, cached, cacheresults, doc;
+
+ if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) {
+ cacheable = true;
+ cacheresults = jQuery.fragments[ args[0] ];
+ if ( cacheresults ) {
+ if ( cacheresults !== 1 ) {
+ fragment = cacheresults;
+ }
+ cached = true;
+ }
+ }
+
+ if ( !fragment ) {
+ doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
+ fragment = doc.createDocumentFragment();
+ jQuery.clean( args, doc, fragment, scripts );
+ }
+
+ if ( cacheable ) {
+ jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
+ }
+
+ return { fragment: fragment, cacheable: cacheable };
+}
+
+jQuery.fragments = {};
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [], insert = jQuery( selector );
+
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ ret = ret.concat( elems );
+ }
+ return this.pushStack( ret, name, insert.selector );
+ };
+});
+
+jQuery.each({
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
+ if ( !keepData && this.nodeType === 1 ) {
+ cleanData( this.getElementsByTagName("*") );
+ cleanData( [ this ] );
+ }
+
+ if ( this.parentNode ) {
+ this.parentNode.removeChild( this );
+ }
+ }
+ },
+
+ empty: function() {
+ // Remove element nodes and prevent memory leaks
+ if ( this.nodeType === 1 ) {
+ cleanData( this.getElementsByTagName("*") );
+ }
+
+ // Remove any remaining nodes
+ while ( this.firstChild ) {
+ this.removeChild( this.firstChild );
+ }
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function() {
+ return this.each( fn, arguments );
+ };
+});
+
+jQuery.extend({
+ clean: function( elems, context, fragment, scripts ) {
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" ) {
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+ }
+
+ var ret = [];
+
+ jQuery.each(elems, function( i, elem ) {
+ if ( typeof elem === "number" ) {
+ elem += "";
+ }
+
+ if ( !elem ) {
+ return;
+ }
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" && !rhtml.test( elem ) ) {
+ elem = context.createTextNode( elem );
+
+ } else if ( typeof elem === "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(rxhtmlTag, fcloseTag);
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
+ wrap = wrapMap[ tag ] || wrapMap._default,
+ depth = wrap[0],
+ div = context.createElement("div");
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( depth-- ) {
+ div = div.lastChild;
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = rtbody.test(elem),
+ tbody = tag === "table" && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j ) {
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ }
+ }
+
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+ }
+
+ elem = jQuery.makeArray( div.childNodes );
+ }
+
+ if ( elem.nodeType ) {
+ ret.push( elem );
+ } else {
+ ret = jQuery.merge( ret, elem );
+ }
+
+ });
+
+ if ( fragment ) {
+ for ( var i = 0; ret[i]; i++ ) {
+ if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+ } else {
+ if ( ret[i].nodeType === 1 ) {
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ }
+ fragment.appendChild( ret[i] );
+ }
+ }
+ }
+
+ return ret;
+ }
+});
+
+function cleanData( elems ) {
+ for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
+ if ( !jQuery.noData[elem.nodeName.toLowerCase()] && (id = elem[expando]) ) {
+ delete jQuery.cache[ id ];
+ }
+ }
+}
+// exclude the following css properties to add px
+var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ ralpha = /alpha\([^)]*\)/,
+ ropacity = /opacity=([^)]*)/,
+ rfloat = /float/i,
+ rdashAlpha = /-([a-z])/ig,
+ rupper = /([A-Z])/g,
+ rnumpx = /^-?\d+(?:px)?$/i,
+ rnum = /^-?\d/,
+
+ cssShow = { position: "absolute", visibility: "hidden", display:"block" },
+ cssWidth = [ "Left", "Right" ],
+ cssHeight = [ "Top", "Bottom" ],
+
+ // cache check for defaultView.getComputedStyle
+ getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
+ // normalize float css property
+ styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ };
+
+jQuery.fn.css = function( name, value ) {
+ return access( this, name, value, true, function( elem, name, value ) {
+ if ( value === undefined ) {
+ return jQuery.curCSS( elem, name );
+ }
+
+ if ( typeof value === "number" && !rexclude.test(name) ) {
+ value += "px";
+ }
+
+ jQuery.style( elem, name, value );
+ });
+};
+
+jQuery.extend({
+ style: function( elem, name, value ) {
+ // don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ // ignore negative width and height values #1599
+ if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
+ value = undefined;
+ }
+
+ var style = elem.style || elem, set = value !== undefined;
+
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name === "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
+ var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
+ style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
+ }
+
+ return style.filter && style.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
+ "";
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( rfloat.test( name ) ) {
+ name = styleFloat;
+ }
+
+ name = name.replace(rdashAlpha, fcamelCase);
+
+ if ( set ) {
+ style[ name ] = value;
+ }
+
+ return style[ name ];
+ },
+
+ css: function( elem, name, force, extra ) {
+ if ( name === "width" || name === "height" ) {
+ var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
+
+ function getWH() {
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" ) {
+ return;
+ }
+
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ }
+
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+ } else {
+ val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ }
+ });
+ }
+
+ if ( elem.offsetWidth !== 0 ) {
+ getWH();
+ } else {
+ jQuery.swap( elem, props, getWH );
+ }
+
+ return Math.max(0, Math.round(val));
+ }
+
+ return jQuery.curCSS( elem, name, force );
+ },
+
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style, filter;
+
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
+ ret = ropacity.test(elem.currentStyle.filter || "") ?
+ (parseFloat(RegExp.$1) / 100) + "" :
+ "";
+
+ return ret === "" ?
+ "1" :
+ ret;
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( rfloat.test( name ) ) {
+ name = styleFloat;
+ }
+
+ if ( !force && style && style[ name ] ) {
+ ret = style[ name ];
+
+ } else if ( getComputedStyle ) {
+
+ // Only "float" is needed here
+ if ( rfloat.test( name ) ) {
+ name = "float";
+ }
+
+ name = name.replace( rupper, "-$1" ).toLowerCase();
+
+ var defaultView = elem.ownerDocument.defaultView;
+
+ if ( !defaultView ) {
+ return null;
+ }
+
+ var computedStyle = defaultView.getComputedStyle( elem, null );
+
+ if ( computedStyle ) {
+ ret = computedStyle.getPropertyValue( name );
+ }
+
+ // We should always get a number back from opacity
+ if ( name === "opacity" && ret === "" ) {
+ ret = "1";
+ }
+
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(rdashAlpha, fcamelCase);
+
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret;
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ var width = elem.offsetWidth, height = elem.offsetHeight,
+ skip = elem.nodeName.toLowerCase() === "tr";
+
+ return width === 0 && height === 0 && !skip ?
+ true :
+ width > 0 && height > 0 && !skip ?
+ false :
+ jQuery.curCSS(elem, "display") === "none";
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+var jsc = now(),
+ rscript = /<script(.|\s)*?\/script>/gi,
+ rselectTextarea = /select|textarea/i,
+ rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
+ jsre = /=\?(&|$)/,
+ rquery = /\?/,
+ rts = /(\?|&)_=.*?(&|$)/,
+ rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ r20 = /%20/g;
+
+jQuery.fn.extend({
+ // Keep a copy of the old load
+ _load: jQuery.fn.load,
+
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" ) {
+ return this._load( url );
+
+ // Don't do a request if no elements are being requested
+ } else if ( !this.length ) {
+ return this;
+ }
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params ) {
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else if ( typeof params === "object" ) {
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
+ type = "POST";
+ }
+ }
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ context:this,
+ complete: function( res, status ) {
+ // If successful, inject the HTML into all the matched elements
+ if ( status === "success" || status === "notmodified" ) {
+ // See if a selector was specified
+ this.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div />")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(rscript, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+ }
+
+ if ( callback ) {
+ this.each( callback, [res.responseText, status, res] );
+ }
+ }
+ });
+
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+ serializeArray: function() {
+ return this.map(function() {
+ return this.elements ? jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function() {
+ return this.name && !this.disabled &&
+ (this.checked || rselectTextarea.test(this.nodeName) ||
+ rinput.test(this.type));
+ })
+ .map(function( i, elem ) {
+ var val = jQuery(this).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray(val) ?
+ jQuery.map( val, function( val, i ) {
+ return { name: elem.name, value: val };
+ }) :
+ { name: elem.name, value: val };
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
+ jQuery.fn[o] = function( f ) {
+ return this.bind(o, f);
+ };
+});
+
+jQuery.extend({
+
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was omited
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ // shift arguments if data argument was omited
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ username: null,
+ password: null,
+ traditional: false,
+ */
+ // Create the request object; Microsoft failed to properly
+ // implement the XMLHttpRequest in IE7 (can't request local files),
+ // so we use the ActiveXObject when it is available
+ // This function can be overriden by calling jQuery.ajaxSetup
+ xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
+ function() {
+ return new window.XMLHttpRequest();
+ } :
+ function() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch(e) {}
+ },
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajax: function( origSettings ) {
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
+
+ var jsonp, status, data,
+ callbackContext = s.context || s,
+ type = s.type.toUpperCase();
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType === "jsonp" ) {
+ if ( type === "GET" ) {
+ if ( !jsre.test( s.url ) ) {
+ s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ }
+ } else if ( !s.data || !jsre.test(s.data) ) {
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ }
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
+ jsonp = s.jsonpCallback || ("jsonp" + jsc++);
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data ) {
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ }
+
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ window[ jsonp ] = window[ jsonp ] || function( tmp ) {
+ data = tmp;
+ success();
+ complete();
+ // Garbage collect
+ window[ jsonp ] = undefined;
+
+ try {
+ delete window[ jsonp ];
+ } catch(e) {}
+
+ if ( head ) {
+ head.removeChild( script );
+ }
+ };
+ }
+
+ if ( s.dataType === "script" && s.cache === null ) {
+ s.cache = false;
+ }
+
+ if ( s.cache === false && type === "GET" ) {
+ var ts = now();
+
+ // try replacing _= if it is there
+ var ret = s.url.replace(rts, "$1_=" + ts + "$2");
+
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for get requests
+ if ( s.data && type === "GET" ) {
+ s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && ! jQuery.active++ ) {
+ jQuery.event.trigger( "ajaxStart" );
+ }
+
+ // Matches an absolute URL, and saves the domain
+ var parts = rurl.exec( s.url ),
+ remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType === "script" && type === "GET" && remote ) {
+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
+ var script = document.createElement("script");
+ script.src = s.url;
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function() {
+ if ( !done && (!this.readyState ||
+ this.readyState === "loaded" || this.readyState === "complete") ) {
+ done = true;
+ success();
+ complete();
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+ if ( head && script.parentNode ) {
+ head.removeChild( script );
+ }
+ }
+ };
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709 and #4378).
+ head.insertBefore( script, head.firstChild );
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object
+ var xhr = s.xhr();
+
+ if ( !xhr ) {
+ return;
+ }
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ } else {
+ xhr.open(type, s.url, s.async);
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set the correct header, if data is being sent
+ if ( s.data || origSettings && origSettings.contentType ) {
+ xhr.setRequestHeader("Content-Type", s.contentType);
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[s.url] ) {
+ xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
+ }
+
+ if ( jQuery.etag[s.url] ) {
+ xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
+ }
+ }
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ // Only send the header if it's not a remote XHR
+ if ( !remote ) {
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*" :
+ s.accepts._default );
+ } catch(e) {}
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global ) {
+ trigger("ajaxSend", [xhr, s]);
+ }
+
+ // Wait for a response to come back
+ var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
+ // The request was aborted
+ if ( !xhr || xhr.readyState === 0 ) {
+ // Opera doesn't call onreadystatechange before this point
+ // so we simulate the call
+ if ( !requestDone ) {
+ complete();
+ }
+
+ requestDone = true;
+ if ( xhr ) {
+ xhr.onreadystatechange = jQuery.noop;
+ }
+
+ // The transfer is complete and the data is available, or the request timed out
+ } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
+ requestDone = true;
+ xhr.onreadystatechange = jQuery.noop;
+
+ status = isTimeout === "timeout" ?
+ "timeout" :
+ !jQuery.httpSuccess( xhr ) ?
+ "error" :
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
+ "notmodified" :
+ "success";
+
+ if ( status === "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s );
+ } catch(e) {
+ status = "parsererror";
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status === "success" || status === "notmodified" ) {
+ // JSONP handles its own success callback
+ if ( !jsonp ) {
+ success();
+ }
+ } else {
+ jQuery.handleError(s, xhr, status);
+ }
+
+ // Fire the complete handlers
+ complete();
+
+ if ( isTimeout === "timeout" ) {
+ xhr.abort();
+ }
+
+ // Stop memory leaks
+ if ( s.async ) {
+ xhr = null;
+ }
+ }
+ };
+
+ // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
+ // Opera doesn't fire onreadystatechange at all on abort
+ try {
+ var oldAbort = xhr.abort;
+ xhr.abort = function() {
+ if ( xhr ) {
+ oldAbort.call( xhr );
+ if ( xhr ) {
+ xhr.readyState = 0;
+ }
+ }
+
+ onreadystatechange();
+ };
+ } catch(e) { }
+
+ // Timeout checker
+ if ( s.async && s.timeout > 0 ) {
+ setTimeout(function() {
+ // Check to see if the request is still happening
+ if ( xhr && !requestDone ) {
+ onreadystatechange( "timeout" );
+ }
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send( type === "POST" || type === "PUT" ? s.data : null );
+ } catch(e) {
+ jQuery.handleError(s, xhr, null, e);
+ // Fire the complete handlers
+ complete();
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async ) {
+ onreadystatechange();
+ }
+
+ function success() {
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success ) {
+ s.success.call( callbackContext, data, status, xhr );
+ }
+
+ // Fire the global callback
+ if ( s.global ) {
+ trigger( "ajaxSuccess", [xhr, s] );
+ }
+ }
+
+ function complete() {
+ // Process result
+ if ( s.complete ) {
+ s.complete.call( callbackContext, xhr, status);
+ }
+
+ // The request was completed
+ if ( s.global ) {
+ trigger( "ajaxComplete", [xhr, s] );
+ }
+
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ }
+
+ function trigger(type, args) {
+ (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) {
+ s.error.call( s.context || window, xhr, status, e );
+ }
+
+ // Fire the global callback
+ if ( s.global ) {
+ (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
+ }
+ },
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol === "file:" ||
+ // Opera returns 0 when status is 304
+ ( xhr.status >= 200 && xhr.status < 300 ) ||
+ xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
+ } catch(e) {}
+
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ var lastModified = xhr.getResponseHeader("Last-Modified"),
+ etag = xhr.getResponseHeader("Etag");
+
+ if ( lastModified ) {
+ jQuery.lastModified[url] = lastModified;
+ }
+
+ if ( etag ) {
+ jQuery.etag[url] = etag;
+ }
+
+ // Opera returns 0 when status is 304
+ return xhr.status === 304 || xhr.status === 0;
+ },
+
+ httpData: function( xhr, type, s ) {
+ var ct = xhr.getResponseHeader("content-type") || "",
+ xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.nodeName === "parsererror" ) {
+ throw "parsererror";
+ }
+
+ // Allow a pre-filtering function to sanitize the response
+ // s is checked to keep backwards compatibility
+ if ( s && s.dataFilter ) {
+ data = s.dataFilter( data, type );
+ }
+
+ // The filter can actually parse the response
+ if ( typeof data === "string" ) {
+ // Get the JavaScript object, if JSON is used.
+ if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if (/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
+
+ // Try to use the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ data = window.JSON.parse( data );
+
+ } else {
+ data = (new Function("return " + data))();
+ }
+
+ } else {
+ throw "Invalid JSON: " + data;
+ }
+
+ // If the type is "script", eval it in global context
+ } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
+ jQuery.globalEval( data );
+ }
+ }
+
+ return data;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a, traditional ) {
+
+ var s = [];
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ function add( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction(value) ? value() : value;
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray(a) || a.jquery ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ jQuery.each( a, function buildParams( prefix, obj ) {
+
+ if ( jQuery.isArray(obj) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
+ }
+ });
+
+ } else if ( !traditional && typeof obj === "object" ) {
+ // Serialize object item.
+ jQuery.each( obj, function( k, v ) {
+ buildParams( prefix + "[" + k + "]", v );
+ });
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+ });
+ }
+
+ // Return the resulting serialization
+ return s.join("&").replace(r20, "+");
+ }
+
+});
+var elemdisplay = {},
+ rfxtypes = /toggle|show|hide/,
+ rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ];
+
+jQuery.fn.extend({
+ show: function( speed, callback ) {
+ if ( speed != null ) {
+ return this.animate( genFx("show", 3), speed, callback);
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var old = jQuery.data(this[i], "olddisplay");
+
+ this[i].style.display = old || "";
+
+ if ( jQuery.css(this[i], "display") === "none" ) {
+ var nodeName = this[i].nodeName, display;
+
+ if ( elemdisplay[ nodeName ] ) {
+ display = elemdisplay[ nodeName ];
+
+ } else {
+ var elem = jQuery("<" + nodeName + " />").appendTo("body");
+
+ display = elem.css("display");
+
+ if ( display === "none" ) {
+ display = "block";
+ }
+
+ elem.remove();
+
+ elemdisplay[ nodeName ] = display;
+ }
+
+ jQuery.data(this[i], "olddisplay", display);
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var j = 0, k = this.length; j < k; j++ ) {
+ this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
+ }
+
+ return this;
+ }
+ },
+
+ hide: function( speed, callback ) {
+ if ( speed != null ) {
+ return this.animate( genFx("hide", 3), speed, callback);
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var old = jQuery.data(this[i], "olddisplay");
+ if ( !old && old !== "none" ) {
+ jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var j = 0, k = this.length; j < k; j++ ) {
+ this[j].style.display = "none";
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2 ) {
+ var bool = typeof fn === "boolean";
+
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
+ this._toggle.apply( this, arguments );
+
+ } else if ( fn == null || bool ) {
+ this.each(function() {
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ });
+
+ } else {
+ this.animate(genFx("toggle", 3), fn, fn2);
+ }
+
+ return this;
+ },
+
+ fadeTo: function( speed, to, callback ) {
+ return this.filter(":hidden").css("opacity", 0).show().end()
+ .animate({opacity: to}, speed, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ if ( jQuery.isEmptyObject( prop ) ) {
+ return this.each( optall.complete );
+ }
+
+ return this[ optall.queue === false ? "each" : "queue" ](function() {
+ var opt = jQuery.extend({}, optall), p,
+ hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
+ self = this;
+
+ for ( p in prop ) {
+ var name = p.replace(rdashAlpha, fcamelCase);
+
+ if ( p !== name ) {
+ prop[ name ] = prop[ p ];
+ delete prop[ p ];
+ p = name;
+ }
+
+ if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
+ return opt.complete.call(this);
+ }
+
+ if ( ( p === "height" || p === "width" ) && this.style ) {
+ // Store display property
+ opt.display = jQuery.css(this, "display");
+
+ // Make sure that nothing sneaks out
+ opt.overflow = this.style.overflow;
+ }
+
+ if ( jQuery.isArray( prop[p] ) ) {
+ // Create (if needed) and add to specialEasing
+ (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
+ prop[p] = prop[p][0];
+ }
+ }
+
+ if ( opt.overflow != null ) {
+ this.style.overflow = "hidden";
+ }
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function( name, val ) {
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( rfxtypes.test(val) ) {
+ e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+
+ } else {
+ var parts = rfxnum.exec(val),
+ start = e.cur(true) || 0;
+
+ if ( parts ) {
+ var end = parseFloat( parts[2] ),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit !== "px" ) {
+ self.style[ name ] = (end || 1) + unit;
+ start = ((end || 1) / e.cur(true)) * start;
+ self.style[ name ] = start + unit;
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] ) {
+ end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
+ }
+
+ e.custom( start, end, unit );
+
+ } else {
+ e.custom( start, val, "" );
+ }
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ stop: function( clearQueue, gotoEnd ) {
+ var timers = jQuery.timers;
+
+ if ( clearQueue ) {
+ this.queue([]);
+ }
+
+ this.each(function() {
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- ) {
+ if ( timers[i].elem === this ) {
+ if (gotoEnd) {
+ // force the next step to be the last
+ timers[i](true);
+ }
+
+ timers.splice(i, 1);
+ }
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if ( !gotoEnd ) {
+ this.dequeue();
+ }
+
+ return this;
+ }
+
+});
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show", 1),
+ slideUp: genFx("hide", 1),
+ slideToggle: genFx("toggle", 1),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, callback ) {
+ return this.animate( props, speed, callback );
+ };
+});
+
+jQuery.extend({
+ speed: function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? speed : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function() {
+ if ( opt.queue !== false ) {
+ jQuery(this).dequeue();
+ }
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ) {
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig ) {
+ options.orig = {};
+ }
+ }
+
+});
+
+jQuery.fx.prototype = {
+ // Simple function for setting a style value
+ update: function() {
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+ // Set display property to block for height/width animations
+ if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
+ this.elem.style.display = "block";
+ }
+ },
+
+ // Get the current size
+ cur: function( force ) {
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
+ return this.elem[ this.prop ];
+ }
+
+ var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+ return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function( from, to, unit ) {
+ this.startTime = now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+
+ var self = this;
+ function t( gotoEnd ) {
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval(jQuery.fx.tick, 13);
+ }
+ },
+
+ // Simple 'show' function
+ show: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
+
+ // Start by showing the element
+ jQuery( this.elem ).show();
+ },
+
+ // Simple 'hide' function
+ hide: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function( gotoEnd ) {
+ var t = now(), done = true;
+
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ for ( var i in this.options.curAnim ) {
+ if ( this.options.curAnim[i] !== true ) {
+ done = false;
+ }
+ }
+
+ if ( done ) {
+ if ( this.options.display != null ) {
+ // Reset the overflow
+ this.elem.style.overflow = this.options.overflow;
+
+ // Reset the display
+ var old = jQuery.data(this.elem, "olddisplay");
+ this.elem.style.display = old ? old : this.options.display;
+
+ if ( jQuery.css(this.elem, "display") === "none" ) {
+ this.elem.style.display = "block";
+ }
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide ) {
+ jQuery(this.elem).hide();
+ }
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show ) {
+ for ( var p in this.options.curAnim ) {
+ jQuery.style(this.elem, p, this.options.orig[p]);
+ }
+ }
+
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+ }
+
+ return false;
+
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
+ var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
+ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+};
+
+jQuery.extend( jQuery.fx, {
+ tick: function() {
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ ) {
+ if ( !timers[i]() ) {
+ timers.splice(i--, 1);
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ },
+
+ stop: function() {
+ clearInterval( timerId );
+ timerId = null;
+ },
+
+ speeds: {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+
+ step: {
+ opacity: function( fx ) {
+ jQuery.style(fx.elem, "opacity", fx.now);
+ },
+
+ _default: function( fx ) {
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
+ fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
+ } else {
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+if ( "getBoundingClientRect" in document.documentElement ) {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0];
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
+ clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
+ left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+
+ return { top: top, left: left };
+ };
+
+} else {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0];
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ jQuery.offset.initialize();
+
+ var offsetParent = elem.offsetParent, prevOffsetParent = elem,
+ doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
+ body = doc.body, defaultView = doc.defaultView,
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
+ top = elem.offsetTop, left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ break;
+ }
+
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
+ top -= elem.scrollTop;
+ left -= elem.scrollLeft;
+
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop;
+ left += elem.offsetLeft;
+
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
+ }
+
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
+ top += body.offsetTop;
+ left += body.offsetLeft;
+ }
+
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ top += Math.max( docElem.scrollTop, body.scrollTop );
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
+ }
+
+ return { top: top, left: left };
+ };
+}
+
+jQuery.offset = {
+ initialize: function() {
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
+ html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+
+ jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
+
+ container.innerHTML = html;
+ body.insertBefore( container, body.firstChild );
+ innerDiv = container.firstChild;
+ checkDiv = innerDiv.firstChild;
+ td = innerDiv.nextSibling.firstChild.firstChild;
+
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
+
+ checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
+ // safari subtracts parent border width here which is 5px
+ this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
+ checkDiv.style.position = checkDiv.style.top = "";
+
+ innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
+
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
+
+ body.removeChild( container );
+ body = container = innerDiv = checkDiv = table = td = null;
+ jQuery.offset.initialize = jQuery.noop;
+ },
+
+ bodyOffset: function( body ) {
+ var top = body.offsetTop, left = body.offsetLeft;
+
+ jQuery.offset.initialize();
+
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
+ top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
+ left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
+ }
+
+ return { top: top, left: left };
+ },
+
+ setOffset: function( elem, options, i ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
+ elem.style.position = "relative";
+ }
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
+ curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ var props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ if ( !this[0] ) {
+ return null;
+ }
+
+ var elem = this[0],
+
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
+ offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
+
+ // Add offsetParent borders
+ parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
+ parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
+
+ // Subtract the two offsets
+ return {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.body;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ["Left", "Top"], function( i, name ) {
+ var method = "scroll" + name;
+
+ jQuery.fn[ method ] = function(val) {
+ var elem = this[0], win;
+
+ if ( !elem ) {
+ return null;
+ }
+
+ if ( val !== undefined ) {
+ // Set the scroll offset
+ return this.each(function() {
+ win = getWindow( this );
+
+ if ( win ) {
+ win.scrollTo(
+ !i ? val : jQuery(win).scrollLeft(),
+ i ? val : jQuery(win).scrollTop()
+ );
+
+ } else {
+ this[ method ] = val;
+ }
+ });
+ } else {
+ win = getWindow( elem );
+
+ // Return the scroll offset
+ return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
+ win.document.body[ method ] :
+ elem[ method ];
+ }
+ };
+});
+
+function getWindow( elem ) {
+ return ("scrollTo" in elem && elem.document) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function( i, name ) {
+
+ var type = name.toLowerCase();
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function() {
+ return this[0] ?
+ jQuery.css( this[0], type, false, "padding" ) :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function( margin ) {
+ return this[0] ?
+ jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
+ null;
+ };
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ var elem = this[0];
+ if ( !elem ) {
+ return size == null ? null : this;
+ }
+
+ return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
+ elem.document.body[ "client" + name ] :
+
+ // Get document width or height
+ (elem.nodeType === 9) ? // is it a document
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ elem.documentElement["client" + name],
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
+ elem.body["offset" + name], elem.documentElement["offset" + name]
+ ) :
+
+ // Get or set width or height on the element
+ size === undefined ?
+ // Get width or height on the element
+ jQuery.css( elem, type ) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, typeof size === "string" ? size : size + "px" );
+ };
+
+});
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+})(window);
diff --git a/preview/.DS_Store b/preview/.DS_Store
new file mode 100644
index 0000000..b58b51e
Binary files /dev/null and b/preview/.DS_Store differ
diff --git a/preview/main.rb b/preview/main.rb
new file mode 100644
index 0000000..72ce715
--- /dev/null
+++ b/preview/main.rb
@@ -0,0 +1,24 @@
+require 'rubygems'
+require 'sinatra'
+require '../ruby_loader'
+
+get "/" do
+ redirect "/index.html"
+end
+
+get "/javascript/dep/:name.js" do |name|
+ sleep 0.2
+ File.read("#{Dir.pwd}/public/javascript/dependency/#{name}.js")
+ # l = Loader.new
+ # content = l.load_module("dep.#{name}")
+ # puts "Loaded dep.#{name}"
+ # content
+end
+
+get "/loader" do
+ sleep 0.2
+ l = Loader.new
+ content = l.load_module(params[:target_module], params[:deps])
+ puts "Loaded dep.#{params[:target_module]}"
+ content
+end
\ No newline at end of file
diff --git a/preview/public/dependency.html b/preview/public/dependency.html
new file mode 100644
index 0000000..b2536a6
--- /dev/null
+++ b/preview/public/dependency.html
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <script src='/javascript/jquery.js'></script>
+ <script src='/javascript/dependency.js'></script>
+ <script>
+
+ /*
+ register a dependency on the list
+ set up a dependency set which is a collection of requires that must be satisfied before executing the code
+ on dep satisfied, execute code into the page.
+ */
+ var widgets = {};
+ $p = {
+ start: function(){ this._start = new Date(); },
+ ping: function(){ return (new Date() - $p._start)}
+ }
+ $p.start();
+ // $d.require("dep.level1");
+
+
+ </script>
+ </head>
+ <body>
+ <script>
+ // once specific code and the dom have loaded, execute
+ $d.codeDomReady("dep.level1",function(){
+ widgets.something.asd.a();
+ });
+
+ // pure jquery understanding of when the document is ready.
+ // shows that the requires are non-blocking
+ $(document).ready(function(){
+ document.body.innerHTML += "<br/> ||="+$p.ping();
+ });
+ </script>
+ </body>
+</html>
diff --git a/preview/public/javascript b/preview/public/javascript
new file mode 120000
index 0000000..58677dd
--- /dev/null
+++ b/preview/public/javascript
@@ -0,0 +1 @@
+../../lib
\ No newline at end of file
diff --git a/ruby_loader.rb b/ruby_loader.rb
new file mode 100644
index 0000000..f28d112
--- /dev/null
+++ b/ruby_loader.rb
@@ -0,0 +1,81 @@
+require 'rubygems'
+require 'fileutils'
+
+class Loader
+ attr_accessor :chain
+
+ LOADER_ROOT = File.dirname(File.expand_path(__FILE__))
+ JS_BASE_PATH = File.join(LOADER_ROOT,"lib")
+ MODULE_ROOTS = {
+ "dep"=>File.join(JS_BASE_PATH,"dependency")
+ }
+
+ def initialize
+ @chain = []
+ end
+
+ # collect a module and it's deps into a single string,
+ # ordered to satisfy the deps as it's evalled in JS
+ def load_module(module_name, loaded_deps = [])
+ @chain = loaded_deps
+ load_module_chain(module_name).join("\n\n")
+ end
+
+ private
+
+ # convert a module name into a path to file.
+ # eg. dep.level1 => JS_BASE_PATH / dependency / level1.js
+ # if a raw js file is given, just add that to the js root.
+ def expand_module_path(module_name)
+ unless(module_name.index(".js").nil?)
+ # if raw js filename, just return that
+ path = File.join(JS_BASE_PATH,module_name)
+ else
+ # convert dot notation to path
+ parts = module_name.split(".")
+ base_path = MODULE_ROOTS[parts.first]
+ filename = "#{parts.last}.js"
+ remainder = parts.slice(1, parts.size-2)
+ set = []
+ set.push base_path
+ set.concat remainder unless remainder.nil?
+ set.push filename
+ path = File.join(set)
+ end
+ path
+ end
+
+ # read the content of the module
+ def module_content(module_name)
+ file_path = expand_module_path(module_name)
+ File.exist?(file_path) ? File.read(file_path) : nil
+ end
+
+ # pull out the dependencies using regex
+ def dependencies(content)
+ content.scan(/\/\/\-\-(.*)\-\-/)
+ end
+
+ # method used recursively to walk through files loading
+ # the content and pulling out dependencies.
+ def load_module_chain(module_name)
+ content = module_content(module_name)
+ return "" if content.nil?
+ code = []
+ dependencies(content).each do |dep|
+ content = content.gsub("//--#{dep}--","$d.preLoad('#{dep}')")
+ dep = dep[0]
+ unless chain.include?(dep)
+ # register with the global chain that we are loading this file
+ # prevents reloading of files if different branches require that dep
+ @chain.push(dep)
+ code.concat load_module_chain(dep)
+ end
+ end
+ # accumulate JS code into an array, ordered in a way to satisfy deps.
+ code.push(content)
+ return code
+ end
+end
+
+# load_code("dep.level1")
\ No newline at end of file
|
foca/gns-website | bceb39f3a2e7c309c5529b8a06a7c4f98f2db8c9 | Flickr ribbon with pics | diff --git a/public/flickr.css b/public/flickr.css
new file mode 100644
index 0000000..ee79eea
--- /dev/null
+++ b/public/flickr.css
@@ -0,0 +1,24 @@
+#flickr {
+ margin-top: 40px;
+ text-align: center;
+}
+
+#flickr #flickr_badge_uber_wrapper {
+ margin-left: auto;
+ margin-right: auto;
+ width: 620px;
+}
+
+/* CSS from Flickr follows */
+#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#ef0000;}
+#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}
+#flickr_icon_td {padding:0 5px 0 0 !important;}
+.flickr_badge_image {text-align:center !important;}
+.flickr_badge_image img {border: 1px solid black !important;}
+#flickr_www {display:block; text-align:left; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}
+#flickr_badge_uber_wrapper a:hover,
+#flickr_badge_uber_wrapper a:link,
+#flickr_badge_uber_wrapper a:active,
+#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#ef0000;}
+#flickr_badge_wrapper {}
+#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#ef0000 !important;}
diff --git a/views/layout.erb b/views/layout.erb
index dcdeb84..c8ba102 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -1,16 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gaming Night Society</title>
<link rel="stylesheet" type="text/css" href="/reset.css">
<link rel="stylesheet" type="text/css" href="/main.css">
+ <link rel="stylesheet" type="text/css" href="/flickr.css">
<link rel="home" type="text/html" href="/">
</head>
<body>
<h1 id="header"><a href="/" rel="home">Gaming Night Society</a></h1>
<div id="content">
<%= yield %>
+ <div id="flickr">
+ <!-- Start of Flickr Badge -->
+ <table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"><tr><td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper">
+ <tr>
+ <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&count=5&display=random&size=t&layout=h&context=in%2Fpool-gaming-night-society%2F&source=group&group=793903%40N23"></script>
+ <td id="flickr_badge_source" valign="center" align="center">
+ <table cellpadding="0" cellspacing="0" border="0"><tr>
+ <td width="10" id="flickr_icon_td"><a href="http://www.flickr.com/groups/gaming-night-society/pool/"><img id="flickr_badge_icon" alt="items in Gaming Night Society" src="http://farm4.static.flickr.com/3033/buddyicons/[email protected]?1213492200" align="left" width="48" height="48"></a></td>
+ <td id="flickr_badge_source_txt">More <a href="http://www.flickr.com/groups/gaming-night-society/pool/">in Gaming Night Society pool</a></td>
+ </tr></table>
+ </td>
+ </tr>
+ </table>
+ </td></tr></table>
+ <!-- End of Flickr Badge -->
+ </div>
</div>
+
+
</body>
</html>
|
foca/gns-website | a0cdc2c833f5c79cae658a9d6407b0d974635522 | Sucky design is sucky, but it's better than nothing :P | diff --git a/gaming-night-society.rb b/gaming-night-society.rb
index 8f4d9d9..61b2be1 100644
--- a/gaming-night-society.rb
+++ b/gaming-night-society.rb
@@ -1,24 +1,5 @@
require "sinatra"
get "/" do
erb :home
end
-
-__END__
-
-@@layout
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="es">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Gaming Night Society</title>
- <link rel="stylesheet" type="text/css" href="/main.css">
-</head>
-<body>
- <h1>Gaming Night Society</h1>
- <%= yield %>
-</body>
-</html>
-
-@@home
-<h2>Próximamente</h2>
diff --git a/public/facebook.png b/public/facebook.png
new file mode 100644
index 0000000..492953c
Binary files /dev/null and b/public/facebook.png differ
diff --git a/public/header.png b/public/header.png
new file mode 100644
index 0000000..c78153c
Binary files /dev/null and b/public/header.png differ
diff --git a/public/main.css b/public/main.css
index e69de29..d9e4c37 100644
--- a/public/main.css
+++ b/public/main.css
@@ -0,0 +1,61 @@
+html {
+ background: #000;
+}
+
+#content, #header {
+ width: 800px;
+ margin: 0 auto;
+}
+
+#header {
+ height: 200px;
+ background: url(/header.png) no-repeat center;
+ font-size: 3em;
+ font-weight: bold;
+}
+
+#header a {
+ display: block;
+ width: 642px;
+ height: 200px;
+ margin: 0 auto;
+ text-indent: -9999em;
+}
+
+#social-networks {
+ position: relative;
+ margin: 20px auto 0;
+ width: 800px;
+ height: 64px;
+}
+
+#social-networks li {
+ float: left;
+ font: 20px/50px Helvetica, Arial, sans-serif;
+}
+
+#social-networks a {
+ color: #ef0000;
+ display: block;
+ padding: 0 10px 0 80px;
+ height: 60px;
+}
+
+#social-networks .twitter {
+ position: absolute;
+ right: 400px;
+}
+
+#social-networks .facebook {
+ position: absolute;
+ left: 400px;
+}
+
+
+#social-networks .twitter a {
+ background: url(/twitter.png) no-repeat;
+}
+
+#social-networks .facebook a {
+ background: url(/facebook.png) no-repeat;
+}
diff --git a/public/reset.css b/public/reset.css
new file mode 100644
index 0000000..4040b3a
--- /dev/null
+++ b/public/reset.css
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2008, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.5.2
+*/
+html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
diff --git a/public/twitter.png b/public/twitter.png
new file mode 100644
index 0000000..dba87e1
Binary files /dev/null and b/public/twitter.png differ
diff --git a/views/home.erb b/views/home.erb
new file mode 100644
index 0000000..e4defb1
--- /dev/null
+++ b/views/home.erb
@@ -0,0 +1,4 @@
+<ul id="social-networks">
+ <li class="twitter"><a href="http://twitter.com/gamingnights">Seguà a <span class="username">@gamingnights</span></a></li>
+ <li class="facebook"><a href="http://www.facebook.com/group.php?gid=40231480727">Unite al grupo en facebook</a></li>
+</ul>
diff --git a/views/layout.erb b/views/layout.erb
new file mode 100644
index 0000000..dcdeb84
--- /dev/null
+++ b/views/layout.erb
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="es">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Gaming Night Society</title>
+ <link rel="stylesheet" type="text/css" href="/reset.css">
+ <link rel="stylesheet" type="text/css" href="/main.css">
+ <link rel="home" type="text/html" href="/">
+</head>
+<body>
+ <h1 id="header"><a href="/" rel="home">Gaming Night Society</a></h1>
+ <div id="content">
+ <%= yield %>
+ </div>
+</body>
+</html>
|
foca/gns-website | 7775bf46ca723c80ee0e2d9ce5df2d22266ec27e | Scaffold to get something on the domain | diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000..5c4a751
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,3 @@
+require "gaming-night-society"
+
+run Sinatra::Application
diff --git a/gaming-night-society.rb b/gaming-night-society.rb
new file mode 100644
index 0000000..8f4d9d9
--- /dev/null
+++ b/gaming-night-society.rb
@@ -0,0 +1,24 @@
+require "sinatra"
+
+get "/" do
+ erb :home
+end
+
+__END__
+
+@@layout
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="es">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Gaming Night Society</title>
+ <link rel="stylesheet" type="text/css" href="/main.css">
+</head>
+<body>
+ <h1>Gaming Night Society</h1>
+ <%= yield %>
+</body>
+</html>
+
+@@home
+<h2>Próximamente</h2>
diff --git a/public/main.css b/public/main.css
new file mode 100644
index 0000000..e69de29
|
vrana/mvc-exception-demo | 7b0daec121eb424b67c6d812380b1a49167c1bb5 | Corrections from v6ak | diff --git a/components/BestArticlesComponent.php b/components/BestArticlesComponent.php
index fad10ad..8636130 100644
--- a/components/BestArticlesComponent.php
+++ b/components/BestArticlesComponent.php
@@ -1,17 +1,19 @@
<?php
-class TryControl extends Control {
+abstract class TryControl extends Control {
+ abstract function getData();
+
function render() {
try {
$this->getData();
$this->template->setFile(__DIR__ . "/" . get_class($this) . ".phtml")->render();
- } catch (Exception $e) {
+ } catch (DataSourceException $e) {
}
}
}
class BestArticlesComponent extends TryControl {
function getData() {
$this->template->bestArticles = Article::findBests();
}
}
diff --git a/models/Article.php b/models/Article.php
index 4448065..aea9604 100644
--- a/models/Article.php
+++ b/models/Article.php
@@ -1,12 +1,12 @@
<?php
include __DIR__ . "/BaseModel.php";
class Article extends BaseModel {
/**
* @return array
* @throws DataSourceException
*/
static function findBests() {
- return self::tryFetchAll("SELEC * FROM [article] WHERE [best]");
+ return self::tryFetchAll("SELECT * FROM [article] WHERE [best]");
}
}
|
vrana/mvc-exception-demo | 918789bc2add46f6a1cca7344ee4a3870f139496 | Posledni sobota solution | diff --git a/components/BestArticlesComponent.php b/components/BestArticlesComponent.php
new file mode 100644
index 0000000..fad10ad
--- /dev/null
+++ b/components/BestArticlesComponent.php
@@ -0,0 +1,17 @@
+<?php
+
+class TryControl extends Control {
+ function render() {
+ try {
+ $this->getData();
+ $this->template->setFile(__DIR__ . "/" . get_class($this) . ".phtml")->render();
+ } catch (Exception $e) {
+ }
+ }
+}
+
+class BestArticlesComponent extends TryControl {
+ function getData() {
+ $this->template->bestArticles = Article::findBests();
+ }
+}
diff --git a/components/BestArticlesComponent.phtml b/components/BestArticlesComponent.phtml
new file mode 100644
index 0000000..9f33272
--- /dev/null
+++ b/components/BestArticlesComponent.phtml
@@ -0,0 +1,8 @@
+{if !empty($bestArticles)}
+ <h3><a href="{plink Article:bests}">VýbÄr Älánků</a></h3>
+ <ul>
+ {foreach $bestArticles as $article}
+ <li><a href="{plink Article:detail $article->id}">{$article->title}</a></li>
+ {/foreach}
+ </ul>
+{/if}
diff --git a/models/Article.php b/models/Article.php
index 95d27b4..4448065 100644
--- a/models/Article.php
+++ b/models/Article.php
@@ -1,6 +1,12 @@
<?php
-class Article {
+include __DIR__ . "/BaseModel.php";
+
+class Article extends BaseModel {
+ /**
+ * @return array
+ * @throws DataSourceException
+ */
static function findBests() {
- return dibi::fetchAll("SELECT * FROM [article] WHERE [best]");
+ return self::tryFetchAll("SELEC * FROM [article] WHERE [best]");
}
}
diff --git a/models/BaseModel.php b/models/BaseModel.php
new file mode 100644
index 0000000..b593597
--- /dev/null
+++ b/models/BaseModel.php
@@ -0,0 +1,15 @@
+<?php
+class DataSourceException extends Exception {
+}
+
+class BaseModel {
+ static function tryFetchAll($query) {
+ try {
+ $args = func_get_args();
+ return call_user_func_array('dibi::fetchAll', $args);
+ } catch (DibiException $e) {
+ Debug::processException($e, true);
+ throw new DataSourceException("Error in getting data.", 0, $e);
+ }
+ }
+}
diff --git a/presenters/ArticlePresenter.php b/presenters/ArticlePresenter.php
index a9866df..47f8d91 100644
--- a/presenters/ArticlePresenter.php
+++ b/presenters/ArticlePresenter.php
@@ -1,11 +1,13 @@
<?php
require_once APP_DIR . '/models/Article.php';
require_once dirname(__FILE__) . '/BasePresenter.php';
class ArticlePresenter extends BasePresenter {
function renderDetail($id) {
// tady bude naÄtenà hlavnÃho obsahu stránky - detailu Älánku
- // kromÄ toho naÄteme i výbÄr Älánků pro postrannà menu
+ }
+
+ function renderBests() {
$this->template->bestArticles = Article::findBests();
}
}
diff --git a/presenters/BasePresenter.php b/presenters/BasePresenter.php
index 91b82c2..57f30e2 100644
--- a/presenters/BasePresenter.php
+++ b/presenters/BasePresenter.php
@@ -1,10 +1,17 @@
<?php
+require_once APP_DIR . '/components/BestArticlesComponent.php';
+
abstract class BasePresenter extends Presenter {
public $oldLayoutMode = FALSE;
public function templatePrepareFilters($template) {
$template->registerFilter('TemplateFilters::removePhp');
parent::templatePrepareFilters($template);
}
+ function createComponent($name) {
+ $class = $name . "Component";
+ new $class($this, $name);
+ }
+
}
diff --git a/templates/Article.detail.phtml b/templates/Article.detail.phtml
index bbd730f..91eba84 100644
--- a/templates/Article.detail.phtml
+++ b/templates/Article.detail.phtml
@@ -1,8 +1,2 @@
-{if $bestArticles}
- <h3><a href="{link Article:bests}">VýbÄr Älánků</a></h3>
- <ul>
- {foreach $bestArticles as $article}
- <li><a href="{link Article:detail $article->id}">{$article->title}</a></li>
- {/foreach}
- </ul>
-{/if}
+{widget bestArticles}
+Title
|
vrana/mvc-exception-demo | 93983f550c1997950a7c1d12e02e35f9ab0c5679 | Simplification | diff --git a/models/Article.php b/models/Article.php
index 2bdb97c..95d27b4 100644
--- a/models/Article.php
+++ b/models/Article.php
@@ -1,6 +1,6 @@
<?php
class Article {
static function findBests() {
- return dibi::query("SELECT * FROM [article] WHERE [best]")->fetchAll();
+ return dibi::fetchAll("SELECT * FROM [article] WHERE [best]");
}
}
|
vrana/mvc-exception-demo | 06289a7c0272292ba0966d00c803eff0a8f128f3 | Whitespace | diff --git a/presenters/ArticlePresenter.php b/presenters/ArticlePresenter.php
index ea2db93..a9866df 100644
--- a/presenters/ArticlePresenter.php
+++ b/presenters/ArticlePresenter.php
@@ -1,11 +1,11 @@
<?php
require_once APP_DIR . '/models/Article.php';
require_once dirname(__FILE__) . '/BasePresenter.php';
class ArticlePresenter extends BasePresenter {
- function renderDetail($id) {
- // tady bude naÄtenà hlavnÃho obsahu stránky - detailu Älánku
- // kromÄ toho naÄteme i výbÄr Älánků pro postrannà menu
- $this->template->bestArticles = Article::findBests();
- }
+ function renderDetail($id) {
+ // tady bude naÄtenà hlavnÃho obsahu stránky - detailu Älánku
+ // kromÄ toho naÄteme i výbÄr Älánků pro postrannà menu
+ $this->template->bestArticles = Article::findBests();
+ }
}
|
fith/Plex-Aeon-media-flagger | c52f411c6330cace503fa6999bf0caa16e277d5e | flags.sh initial commit | diff --git a/flags.sh b/flags.sh
new file mode 100644
index 0000000..a64e3c4
--- /dev/null
+++ b/flags.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# did they supply an argument (folder name)?
+if [ -z "$1" ]
+then
+ echo "Usage: flags.sh /path/to/movies/folder"
+ exit 1;
+fi
+
+MOVIESFOLDER=$1
+# or you could do like below, but you'd need to comment out the argument check above
+# MOVIESFOLDER=/path/to/your/movies
+FLAGSFOLDER="/Users/`whoami`/Library/Application Support/Plex/skin/Plexaeon/media/flags"
+
+# function copy_flag($1 = search, $2 = image name, $3 = media flag name)
+do_flag() {
+ if [ -z "$1" ]; then echo "Example: do_flag dvd 480p resolution" return; fi;
+ find $MOVIESFOLDER -type d -iname "*$1*" -exec cp -n "$FLAGSFOLDER/$2.png" "{}/$3.png" \;
+}
+
+#resolutions
+do_flag dvd 480p resolution
+do_flag 1080 1080p resolution
+do_flag 720 720p resolution
+
+#sources
+do_flag dvd dvd source
+do_flag Blu*Ray bluray source
+do_flag hd*dvd hddvd source
+
+#audio
+do_flag DTS dts audio
+do_flag AC3 ac3 audio
+
+#audiochannels
+do_flag 5.1 6ch audiochannels
+do_flag 7.1 8ch audiochannels
+
+exit 0;
\ No newline at end of file
|
nblock/config | 748a603342d135da3c8e6bdcca1fb521a1708830 | Change perms. | diff --git a/xinitrc b/xinitrc
old mode 100644
new mode 100755
|
nblock/config | f4ad15ba8c4ee3afbc70af57cba8fe08e78f1eb9 | Add gtush to zshrc. | diff --git a/zshrc b/zshrc
index b71ced0..de26039 100644
--- a/zshrc
+++ b/zshrc
@@ -1,232 +1,233 @@
# load arch default settings
if [ -r /etc/profile ] ; then
. /etc/profile
fi
# history and directory stack config
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
DIRSTACKSIZE=100
setopt HIST_IGNORE_SPACE # commands with at least one space get ignored
setopt INC_APPEND_HISTORY # share history between sessions
setopt HIST_IGNORE_ALL_DUPS # ignore history dups
setopt AUTO_PUSHD # use automated directory stack
setopt PUSHD_IGNORE_DUPS # ignore directory stack dups
# colors
eval `dircolors $HOME/.config/dircolors/dircolors.256dark`
# stuff
setopt AUTOCD # autocd into dirs
setopt EXTENDEDGLOB # use extended globbing
setopt CORRECTALL # use autocorrection for commands and args
setopt NOBEEP # avoid "beep"ing
setopt PROMPT_SUBST # Enables additional prompt extentions
unsetopt NOMATCH # print no error on no matches
stty stop "" # disable <ctrl-s> and <ctrl-q>
# environment variables
export EDITOR=vim
export BROWSER=firefox
export LANG=de_AT.UTF-8
export TERM=rxvt-unicode-256color
export GPG_TTY=`tty`
PATH=$HOME/bin:$PATH
typeset -U PATH
# colors
autoload -U colors && colors
# set color vars
for COLOR in RED GREEN BLUE YELLOW; do
eval CN_$COLOR='%{$fg[${(L)COLOR}]%}'
eval CB_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
C_RESET="%{${reset_color}%}";
# autocompletion
autoload -U compinit
compinit
zstyle ':completion:*' menu select # menu driven autocomplete
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*' accept-exact '*(N)'
# version control info
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr "${CN_RED}â¶" # red sign if there are unstaged changes
zstyle ':vcs_info:*' stagedstr "${CN_YELLOW}â¶" # yellow sign if there are staged changes
zstyle ':vcs_info:*' formats "${CN_GREEN}%s${CB_BLUE}@${CB_RED}%b${C_RESET}"
zstyle ':vcs_info:(git):*' formats "${CN_GREEN}%s${CB_BLUE}@${CB_RED}%b${CN_BLUE}:${CB_RED}%u%c${C_RESET}"
zstyle ':vcs_info:*' branchformats "%b:%r"
function precmd {
vcs_info 'prompt'
}
# default prompt
PROMPT=$'${CN_GREEN}%n${CB_BLUE}@${CB_RED}%m ${CN_BLUE}%~ ${CB_GREEN}$ ${C_RESET}'
RPROMPT='${vcs_info_msg_0_}'
# prompt for loops
PROMPT2='{%_} '
# prompt for selections
PROMPT3='{ ⦠} '
# So far I don't use "setopt xtrace", so I don't need this prompt
PROMPT4=''
# auto extension alias
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
# no autocorrection for mv and cp
alias mv='nocorrect mv'
alias cp='nocorrect cp'
# normal alias
alias ls='ls --color=auto -F'
alias ll='ls -lh'
alias la='ls -a'
alias e=$EDITOR
alias se='sudo $EDITOR'
alias grep='grep --color=auto'
alias p='sudo pacman'
alias y='yaourt'
alias popt='sudo pacman-optimize && sync'
alias info='echo Dependencies: && pacman -Qd | wc -l && echo Explicitly: && pacman -Qe | wc -l && echo Total: && pacman -Q | wc -l'
alias R='y -Rscn'
alias Syu='y -Syu'
alias S='y -S'
alias Ss='y -Ss'
alias clean='y -Qdt && y -Scc'
alias su='su -'
alias t='task'
alias ta='task add'
alias tl='task list'
# alias for git
alias ga='git add'
alias gpush='git push'
+alias gtush='git push --tags'
alias gs='git status -sb'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpull='git pull'
alias gcl='git clone'
alias gl='git log'
alias glo='git log --oneline --graph --decorate'
gldate() {
before=`date -d "$(date +$1) -1 day" +'%Y-%m-%d'`
git log --oneline --graph --decorate --since="$before" --until="$1"
}
#set TERM only for ssh
alias ssh='env TERM=rxvt-unicode ssh'
# key bindings (vim mode)
bindkey -v
bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\ee[C" forward-word
bindkey "\ee[D" backward-word
bindkey "\^H" backward-delete-word
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix
bindkey '^R' history-incremental-search-backward
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
#edit current line in vim
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# tmux ?
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
# hashes
hash -d da=~/fh-hagenberg/da
# extract various files with x $arg
function x()
{
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.bz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.tar.xz) tar -Jxf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted." ;;
esac
else
echo "'$1' is not a valid archive."
fi
}
# generate a random password
function random(){
< /dev/urandom tr -dc '[](){}?!.,;_A-Z-a-z-0-9' | head -c${1:-20};echo;
}
# obtain public ip addresses (v4 and v6) if available
function hostip(){
IPV6=`curl -s ipv6.icanhazipv6.com |grep my_address |sed -e 's/.*>\(.*\)<\/p>/\1/'`
IPV4=`curl -s ifconfig.me/ip`
if [ -z "$IPV6" ]; then
echo "IPv6: -"
else
echo "IPv6: ${IPV6}"
fi
if [ -z "$IPV4" ]; then
echo "IPv4: -"
else
echo "IPv4: ${IPV4}"
fi
}
# serve local dir via http
function serve(){
SERVE_PORT=8080
echo "listening on:"
ip addr s | grep -Eo 'inet [^/]*' | sort | uniq |awk -v P=$SERVE_PORT '{print " - http://" $2 ":" P}'
python -m http.server $SERVE_PORT 1>/dev/null
unset $SERVE_PORT
}
# a shortcut for cropping pages with pdfcrop
function crop()
pdfcrop --pdftexcmd pdflatex --margins 2 "$1" "${1%.pdf}-cropped.pdf"
# virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
|
nblock/config | 28fdeabc44023e92fc4fc00a8d6028407008ccf7 | Add YCM option to vimrc. | diff --git a/vimrc b/vimrc
index 60d26d3..9332ec2 100644
--- a/vimrc
+++ b/vimrc
@@ -1,222 +1,224 @@
" File: .vimrc
" Author: nblock <nblock [/at\] archlinux DOT us>
" Description: just another .vimrc
" Last Modified: Dezember 10th, 2011
set nocompatible
set nobackup
set nowritebackup
set noswapfile
set showmode " always display current mode
set showcmd " always display current command
set showmatch " show matching brackets (),{},[]
set mat=3 " show matching brackets for 0.3 seconds
set encoding=utf-8 " use utf-8 everywhere
set fileencoding=utf-8 " use utf-8 everywhere
set termencoding=utf-8 " use utf-8 everywhere
set backspace=indent,eol,start " more flexible backspace
set mouse=a " enable mouse usage in all modes
set incsearch " jump to match during searching
set hlsearch " highlight search
set ttyfast " fast terminal connection
set scrolloff=4 " 4 lines above/below cursor when scrolling
set listchars=tab:â¸\ ,eol:¬ " different symbols for tabs and eol
set nomodeline " use secure modeline
set tabpagemax=30 " 30 instead of 10 concurrent tabs
set ignorecase " ignore the case on searches
set smartcase " lowerspace search will ignore case, uppercase will honor the case
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
set number " enable line numbering
" use a terminal title
set title
set titlestring=%F\ [vim]
" tab settings
set tabstop=2 " tab character amount
set expandtab " tabs as space
set autoindent
set smartindent " smart autoindenting on a new line
set shiftwidth=2 " set spaces for autoindent
set softtabstop=2
" statusline
set laststatus=2
set statusline=%<%F\ %h%m%r%=%k\ %-10.(%l/%L,%c%V%)\ %P\ [%{&encoding}:%{&fileformat}]%(\ %w%)\ %y
" vundle settings
filetype off "required by vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"plugins managed by vundle
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-speeddating'
Bundle 'godlygeek/tabular'
Bundle 'git://gitorious.org/vim-gnupg/vim-gnupg.git'
Bundle 'matchit.zip'
Bundle 'fs111/pydoc.vim'
Bundle 'paster.vim'
Bundle 'kien/ctrlp.vim'
Bundle 'majutsushi/tagbar'
Bundle 'ciaranm/securemodelines'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/syntastic'
Bundle 'SirVer/ultisnips'
Bundle 'nblock/vim-dokuwiki'
Bundle 'SudoEdit.vim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'Lokaltog/vim-powerline'
Bundle 'sjl/gundo.vim'
Bundle 'vim-scripts/AutoTag'
Bundle 'vim-scripts/restore_view.vim'
Bundle 'Valloric/YouCompleteMe'
Bundle 'tpope/vim-unimpaired'
filetype plugin indent on " required by vundle
" switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "de", "en" ]
function! MySpellLang()
" loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=de | endif
if g:myLang == 2 | setlocal spell spelllang=en | endif
echo "language:" g:myLangList[g:myLang]
endf
" call the python version that is specified in the shebang
" in Arch Linux, `python` is Python 3.x
function! ExecSpecifiedPython()
let lc = getline(1)
" check if shebang is present
if stridx(lc, "python") == -1
let py = '!/usr/bin/python2 "%"' " default to python2
else
let lc = substitute(lc,"#", "", "g")
let lc = substitute(lc,"env ", "", "g")
let py = lc . ' "%"'
endif
exec py
endfunction
" cleaning up
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" shortcuts and mappings
let mapleader = ","
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O><F2>
set pastetoggle=<F2>
map <F3> :nohlsearch<CR>
autocmd FileType python map <F5> :w<CR>:call ExecSpecifiedPython()<CR>
autocmd FileType tex map <F5> :w<CR>:!latexmk -pdf "%"<CR>
map <F6> :w<CR>:!make<CR>
vmap <F9> :!xclip -f -sel clip<CR>
map <F10> :-1r !xclip -o -sel clip<CR>
nnoremap <silent> <F11> :TagbarToggle<CR>
map <F12> <C-]>
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
nmap <leader>$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap <leader>= :call Preserve("normal gg=G")<CR>
nnoremap <F9> :GundoToggle<CR>
map <leader>cf [[kV][,c<space><CR>
" switch between buffers
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>h <C-w>h
nnoremap <leader>l <C-w>l
nnoremap <leader>w <C-w>w
nnoremap <leader><space> <C-w>r
" enable very magic forward/backward search
nnoremap / /\v
vnoremap / /\v
nnoremap ? ?\v
vnoremap ? ?\v
let g:tex_flavor = "latex" " assume latex as default tex
" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<leader><tab>"
let g:UltiSnipsDontReverseSearchPath="1"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "nblock-snippets"]
py import sys; sys.path.append("/home/flo/.vim/nblock-snippets")
"syntastic
let g:syntastic_error_symbol='E'
let g:syntastic_style_error_symbol='e'
let g:syntastic_warning_symbol='W'
let g:syntastic_style_warning_symbol='w'
" vim-pydiction
filetype plugin on
let g:pydiction_location = '/usr/share/pydiction/complete-dict'
"gnupg.vim
let g:GPGUsePipes = 1
" tagbar latex support
let g:tagbar_type_tex = {
\ 'ctagstype' : 'latex',
\ 'kinds' : [
\ 's:sections',
\ 'g:graphics',
\ 'l:labels',
\ 'r:refs:1',
\ 'L:listings',
\ 'p:pagerefs:1'
\ ],
\ 'sort' : 0,
\ }
" tagbar mediawiki support
autocmd FileType mediawiki :!ctags %
let g:tagbar_type_mediawiki = {
\ 'ctagstype' : 'mediawiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
" YouCompleteMe
" disable <tab>, <s-tab> as it is used by UltiSnips, c-n and c-p work just fine
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
" CtrlP
let g:ctrlp_cmd = 'CtrlPMixed'
" settings for different filetypes
autocmd BufNewFile,BufRead PKGBUILD setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType tex setlocal textwidth=120 tabstop=2 shiftwidth=2 softtabstop=2 expandtab smartindent autoindent
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab smartindent autoindent foldmethod=indent
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete " change omnifunc for python
autocmd BufWritePre *.py,*.tex :call Preserve("%s/\\s\\+$//e") " clean up whitespaces for certain filetypes
" colorscheme settings
syntax enable
set background=dark
colorscheme solarized
+
+ let g:ycm_confirm_extra_conf = 0
|
nblock/config | 366a824557a191bfbc15e913a1f4d34680a0439c | Drop newsbeuter. | diff --git a/config/i3/config b/config/i3/config
index ef0374d..edbde84 100644
--- a/config/i3/config
+++ b/config/i3/config
@@ -1,197 +1,196 @@
# i3 config file (v4)
# nblock (at) archlinux (dot) us
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# window title font
font pango:Bitstream Vera Sans Mono 10
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4
# start a terminal
bindsym Mod4+Return exec urxvtc
# kill focused window
bindsym Mod4+Shift+c kill
# start dmenu (a program launcher)
bindsym Mod4+x exec "$HOME/bin/dmenu_multi"
# change focus
bindsym Mod4+n focus left
bindsym Mod4+r focus right
bindsym Mod4+t focus up
bindsym Mod4+d focus down
# move focused window
bindsym Mod4+Shift+n move left
bindsym Mod4+Shift+r move right
bindsym Mod4+Shift+t move up
bindsym Mod4+Shift+d move down
# switch to next/prev workspace
# TODO switch to other screens
bindsym Mod4+Left workspace prev
bindsym Mod4+Right workspace next
#bindsym Mod4+Up focus up
#bindsym Mod4+Down focus down #
# move container and workspaces to a different screen
bindsym Mod4+Shift+Left move container to output left
bindsym Mod4+Shift+Right move container to output right
bindsym Mod4+Shift+Up move workspace to output left
bindsym Mod4+Shift+Down move workspace to output right
# split in horizontal/vertical orientation
bindsym Mod4+h split h
bindsym Mod4+v split v
# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen
# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split
# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod4+space focus mode_toggle
# focus the parent container
bindsym Mod4+a focus parent
# focus the child container
bindsym Mod4+i focus child
# use a 2 monitor split setup where each screen has an equal amount of workspaces
workspace 1 output HDMI1
workspace 2 output HDMI1
workspace 3 output HDMI1
workspace 4 output HDMI1
workspace 5 output HDMI1
workspace 6 output LVDS1
workspace 7 output LVDS1
workspace 8 output LVDS1
workspace 9 output LVDS1
workspace 10 output LVDS1
# switch to workspace
bindsym Mod4+1 workspace 1
bindsym Mod4+2 workspace 2
bindsym Mod4+3 workspace 3
bindsym Mod4+4 workspace 4
bindsym Mod4+5 workspace 5
bindsym Mod4+6 workspace 6
bindsym Mod4+7 workspace 7
bindsym Mod4+8 workspace 8
bindsym Mod4+9 workspace 9
bindsym Mod4+0 workspace 10
# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace 1
bindsym Mod4+Shift+2 move container to workspace 2
bindsym Mod4+Shift+3 move container to workspace 3
bindsym Mod4+Shift+4 move container to workspace 4
bindsym Mod4+Shift+5 move container to workspace 5
bindsym Mod4+Shift+6 move container to workspace 6
bindsym Mod4+Shift+7 move container to workspace 7
bindsym Mod4+Shift+8 move container to workspace 8
bindsym Mod4+Shift+9 move container to workspace 9
bindsym Mod4+Shift+0 move container to workspace 10
# quickly navigate back to previous window
workspace_auto_back_and_forth yes
# reload the configuration file
bindsym Mod4+Shift+q reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+y restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windowâs width.
# Pressing right will grow the windowâs width.
# Pressing up will shrink the windowâs height.
# Pressing down will grow the windowâs height.
bindsym n resize shrink width 10 px or 10 ppt
bindsym r resize grow width 10 px or 10 ppt
bindsym r resize shrink height 10 px or 10 ppt
bindsym t resize grow height 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+y mode "resize"
# valid for my Thinkpad
bindsym XF86ScreenSaver exec "i3lock -d -c 000000"
bindsym XF86AudioMute exec "amixer sset PCM toggle"
bindsym XF86AudioRaiseVolume exec "amixer set PCM 2%+; killall -USR1 i3status"
bindsym XF86AudioLowerVolume exec "amixer set PCM 2%-; killall -USR1 i3status"
bindsym XF86AudioNext exec "cmus-remote --next"
bindsym XF86AudioPrev exec "cmus-remote --prev"
bindsym XF86AudioPlay exec "cmus-remote --pause"
bindsym XF86AudioStop exec "cmus-remote --stop"
bindsym XF86Sleep exec "systemctl suspend"
bindsym XF86WebCam exec "$HOME/bin/bluetooth-toggle.sh"
bindsym XF86TouchpadToggle exec "$HOME/bin/touchpad-toggle.sh"
# currently unused
#bindsym XF86Tools exec "something"
#bindsym XF86Calculator exec "something"
#bindsym XF86Launch1 exec "something" # ThinkVantage
#bindsym XF86Display exec "something" # fn - f7
# focus popular clients by title/class
bindsym Mod4+Mod1+f [class="(?i)firefox"] focus
bindsym Mod4+Mod1+t [class="(?i)thunderbird"] focus
bindsym Mod4+Mod1+p [class="(?i)pidgin" window_role="conversation"] focus
bindsym Mod4+Mod1+b [class="(?i)pidgin" window_role="buddy_list"] focus
bindsym Mod4+Mod1+k [class="(?i)keepassx"] focus
bindsym Mod4+Mod1+c [title="(?i)cmus"] focus
-bindsym Mod4+Mod1+n [title="(?i)newsbeuter"] focus
bindsym Mod4+Mod1+j [title="JDownloader"] focus
# colors
# class border backgr. text indicator
client.focused #4c7899 #285577 #ffffff #ff0000
client.focused_inactive #333333 #5f676a #ffffff #484e50
client.unfocused #333333 #222222 #888888 #292d2e
client.urgent #2f343a #900000 #ffffff #900000
# wallpaper
exec --no-startup-id feh --bg-scale "$HOME/bilder/wallpaper/1440x900/arch_wall-by_kpolicano-1440x900.jpg"
# autostart
exec "blueman-applet"
# The status bar
bar {
status_command i3status
position top
colors {
statusline #00ff00
# color_class border backg. text
focused_workspace #4c7899 #285577 #00ff00
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
diff --git a/config/i3/run_in_terminal b/config/i3/run_in_terminal
index 3403d5a..a1684cf 100644
--- a/config/i3/run_in_terminal
+++ b/config/i3/run_in_terminal
@@ -1,3 +1,2 @@
rtorrent
-newsbeuter
cmus
diff --git a/config/newsbeuter/config b/config/newsbeuter/config
deleted file mode 100644
index 7a5204b..0000000
--- a/config/newsbeuter/config
+++ /dev/null
@@ -1,84 +0,0 @@
-#newsbeuter 2.4 config - notizblock
-
-#color <element> <foreground color> <background color> [<attribute> ...]
-color listnormal yellow default
-color listfocus color166 color237 bold
-color info color237 color250
-color background red default
-color article yellow default
-
-
-#newsbeuter via proxy
-#in this case -> polipo (tor)
-use-proxy yes
-proxy localhost:8118
-download-retries 4
-download-timeout 30
-
-#reload stuff
-reload-threads 10 #parallel reload threads.
-auto-reload yes #auto reload stuff
-reload-time 20 #min
-refresh-on-startup yes
-
-#use this useragent to get osvdb feed
-user-agent "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
-
-#various
-max-items 300 # number of feeds to hold in db per url
-goto-next-feed yes
-browser "/home/flo/bin/newsbeuter_links"
-cleanup-on-quit yes # cleanup is always nice
-download-full-page yes # load empty feeds
-
-#visibility of feeds
-show-read-feeds no #list read feeds ?
-show-read-articles no #list read articles ?
-
-#files (~/.local/share/newsbeuter and ~/.config/newsbeuter)
-save-path "~/" #where to save feeds
-
-#kill files
-ignore-article "*" "title =~ \"CSI\""
-ignore-article "*" "title =~ \"more rss feeds from\""
-ignore-article "*" "title =~ \"[iI]P[ao]d\""
-ignore-article "*" "title =~ \"iPhone\""
-ignore-article "*" "title =~ \"Windows Phone 7\""
-ignore-article "*" "title =~ \"Alm\""
-ignore-article "http://lwn.net/headlines/rss" "title =~ \"\[\$\]\""
-
-#key bindings
-bind-key c next-unread-feed
-bind-key x prev-unread-feed
-bind-key m toggle-article-read
-bind-key ^B pageup
-bind-key ^F pagedown
-bind-key H pageup
-bind-key L pagedown
-bind-key k up
-bind-key j down
-bind-key d save
-bind-key s sort
-bind-key S revsort
-bind-key O open-in-browser
-bind-key o open-in-browser-and-mark-read
-bind-key b bookmark
-
-#bookmark
-bookmark-cmd "~/bin/instapaper.py"
-
-#layout
-datetime-format "%d.%m %H:%M"
-text-width 100 # max text width to render html
-display-article-progress yes
-show-keymap-hint no #keyboard hints ?
-always-display-description true
-#feedlist-format "%4i %n %11u %t
-article-sort-order date # parameter syntax: <sortfield>[-<direction>]
-articlelist-format "%4i %f %D %?T?|%-17T| ?%t"
-
-#always download this feed -> ignore last-modification timestamp
-always-download "http://www.movie-blog.org/feed/rss"
-
-#reset unread flag when feed gets updated after reading
-reset-unread-on-update "http://blog.fefe.de/rss.xml?html"
|
nblock/config | f8e0326187f86d1c8932d8d71951d45d3df736cd | Remove most autostarted programs. | diff --git a/config/i3/config b/config/i3/config
index e30d3d3..ef0374d 100644
--- a/config/i3/config
+++ b/config/i3/config
@@ -1,199 +1,197 @@
# i3 config file (v4)
# nblock (at) archlinux (dot) us
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# window title font
font pango:Bitstream Vera Sans Mono 10
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4
# start a terminal
bindsym Mod4+Return exec urxvtc
# kill focused window
bindsym Mod4+Shift+c kill
# start dmenu (a program launcher)
bindsym Mod4+x exec "$HOME/bin/dmenu_multi"
# change focus
bindsym Mod4+n focus left
bindsym Mod4+r focus right
bindsym Mod4+t focus up
bindsym Mod4+d focus down
# move focused window
bindsym Mod4+Shift+n move left
bindsym Mod4+Shift+r move right
bindsym Mod4+Shift+t move up
bindsym Mod4+Shift+d move down
# switch to next/prev workspace
# TODO switch to other screens
bindsym Mod4+Left workspace prev
bindsym Mod4+Right workspace next
#bindsym Mod4+Up focus up
#bindsym Mod4+Down focus down #
# move container and workspaces to a different screen
bindsym Mod4+Shift+Left move container to output left
bindsym Mod4+Shift+Right move container to output right
bindsym Mod4+Shift+Up move workspace to output left
bindsym Mod4+Shift+Down move workspace to output right
# split in horizontal/vertical orientation
bindsym Mod4+h split h
bindsym Mod4+v split v
# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen
# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split
# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod4+space focus mode_toggle
# focus the parent container
bindsym Mod4+a focus parent
# focus the child container
bindsym Mod4+i focus child
# use a 2 monitor split setup where each screen has an equal amount of workspaces
workspace 1 output HDMI1
workspace 2 output HDMI1
workspace 3 output HDMI1
workspace 4 output HDMI1
workspace 5 output HDMI1
workspace 6 output LVDS1
workspace 7 output LVDS1
workspace 8 output LVDS1
workspace 9 output LVDS1
workspace 10 output LVDS1
# switch to workspace
bindsym Mod4+1 workspace 1
bindsym Mod4+2 workspace 2
bindsym Mod4+3 workspace 3
bindsym Mod4+4 workspace 4
bindsym Mod4+5 workspace 5
bindsym Mod4+6 workspace 6
bindsym Mod4+7 workspace 7
bindsym Mod4+8 workspace 8
bindsym Mod4+9 workspace 9
bindsym Mod4+0 workspace 10
# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace 1
bindsym Mod4+Shift+2 move container to workspace 2
bindsym Mod4+Shift+3 move container to workspace 3
bindsym Mod4+Shift+4 move container to workspace 4
bindsym Mod4+Shift+5 move container to workspace 5
bindsym Mod4+Shift+6 move container to workspace 6
bindsym Mod4+Shift+7 move container to workspace 7
bindsym Mod4+Shift+8 move container to workspace 8
bindsym Mod4+Shift+9 move container to workspace 9
bindsym Mod4+Shift+0 move container to workspace 10
# quickly navigate back to previous window
workspace_auto_back_and_forth yes
# reload the configuration file
bindsym Mod4+Shift+q reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+y restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windowâs width.
# Pressing right will grow the windowâs width.
# Pressing up will shrink the windowâs height.
# Pressing down will grow the windowâs height.
bindsym n resize shrink width 10 px or 10 ppt
bindsym r resize grow width 10 px or 10 ppt
bindsym r resize shrink height 10 px or 10 ppt
bindsym t resize grow height 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+y mode "resize"
# valid for my Thinkpad
bindsym XF86ScreenSaver exec "i3lock -d -c 000000"
bindsym XF86AudioMute exec "amixer sset PCM toggle"
bindsym XF86AudioRaiseVolume exec "amixer set PCM 2%+; killall -USR1 i3status"
bindsym XF86AudioLowerVolume exec "amixer set PCM 2%-; killall -USR1 i3status"
bindsym XF86AudioNext exec "cmus-remote --next"
bindsym XF86AudioPrev exec "cmus-remote --prev"
bindsym XF86AudioPlay exec "cmus-remote --pause"
bindsym XF86AudioStop exec "cmus-remote --stop"
bindsym XF86Sleep exec "systemctl suspend"
bindsym XF86WebCam exec "$HOME/bin/bluetooth-toggle.sh"
bindsym XF86TouchpadToggle exec "$HOME/bin/touchpad-toggle.sh"
# currently unused
#bindsym XF86Tools exec "something"
#bindsym XF86Calculator exec "something"
#bindsym XF86Launch1 exec "something" # ThinkVantage
#bindsym XF86Display exec "something" # fn - f7
# focus popular clients by title/class
bindsym Mod4+Mod1+f [class="(?i)firefox"] focus
bindsym Mod4+Mod1+t [class="(?i)thunderbird"] focus
bindsym Mod4+Mod1+p [class="(?i)pidgin" window_role="conversation"] focus
bindsym Mod4+Mod1+b [class="(?i)pidgin" window_role="buddy_list"] focus
bindsym Mod4+Mod1+k [class="(?i)keepassx"] focus
bindsym Mod4+Mod1+c [title="(?i)cmus"] focus
bindsym Mod4+Mod1+n [title="(?i)newsbeuter"] focus
bindsym Mod4+Mod1+j [title="JDownloader"] focus
# colors
# class border backgr. text indicator
client.focused #4c7899 #285577 #ffffff #ff0000
client.focused_inactive #333333 #5f676a #ffffff #484e50
client.unfocused #333333 #222222 #888888 #292d2e
client.urgent #2f343a #900000 #ffffff #900000
# wallpaper
exec --no-startup-id feh --bg-scale "$HOME/bilder/wallpaper/1440x900/arch_wall-by_kpolicano-1440x900.jpg"
# autostart
-exec "firefox"
-exec "thunderbird"
-exec "pidgin"
+exec "blueman-applet"
# The status bar
bar {
status_command i3status
position top
colors {
statusline #00ff00
# color_class border backg. text
focused_workspace #4c7899 #285577 #00ff00
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
|
nblock/config | e17c8303671aadeeffefbbc3f09374eeb4a06816 | Make links clickable. | diff --git a/zshrc b/zshrc
index c21391e..b71ced0 100644
--- a/zshrc
+++ b/zshrc
@@ -1,232 +1,232 @@
# load arch default settings
if [ -r /etc/profile ] ; then
. /etc/profile
fi
# history and directory stack config
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
DIRSTACKSIZE=100
setopt HIST_IGNORE_SPACE # commands with at least one space get ignored
setopt INC_APPEND_HISTORY # share history between sessions
setopt HIST_IGNORE_ALL_DUPS # ignore history dups
setopt AUTO_PUSHD # use automated directory stack
setopt PUSHD_IGNORE_DUPS # ignore directory stack dups
# colors
eval `dircolors $HOME/.config/dircolors/dircolors.256dark`
# stuff
setopt AUTOCD # autocd into dirs
setopt EXTENDEDGLOB # use extended globbing
setopt CORRECTALL # use autocorrection for commands and args
setopt NOBEEP # avoid "beep"ing
setopt PROMPT_SUBST # Enables additional prompt extentions
unsetopt NOMATCH # print no error on no matches
stty stop "" # disable <ctrl-s> and <ctrl-q>
# environment variables
export EDITOR=vim
export BROWSER=firefox
export LANG=de_AT.UTF-8
export TERM=rxvt-unicode-256color
export GPG_TTY=`tty`
PATH=$HOME/bin:$PATH
typeset -U PATH
# colors
autoload -U colors && colors
# set color vars
for COLOR in RED GREEN BLUE YELLOW; do
eval CN_$COLOR='%{$fg[${(L)COLOR}]%}'
eval CB_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
C_RESET="%{${reset_color}%}";
# autocompletion
autoload -U compinit
compinit
zstyle ':completion:*' menu select # menu driven autocomplete
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*' accept-exact '*(N)'
# version control info
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr "${CN_RED}â¶" # red sign if there are unstaged changes
zstyle ':vcs_info:*' stagedstr "${CN_YELLOW}â¶" # yellow sign if there are staged changes
zstyle ':vcs_info:*' formats "${CN_GREEN}%s${CB_BLUE}@${CB_RED}%b${C_RESET}"
zstyle ':vcs_info:(git):*' formats "${CN_GREEN}%s${CB_BLUE}@${CB_RED}%b${CN_BLUE}:${CB_RED}%u%c${C_RESET}"
zstyle ':vcs_info:*' branchformats "%b:%r"
function precmd {
vcs_info 'prompt'
}
# default prompt
PROMPT=$'${CN_GREEN}%n${CB_BLUE}@${CB_RED}%m ${CN_BLUE}%~ ${CB_GREEN}$ ${C_RESET}'
RPROMPT='${vcs_info_msg_0_}'
# prompt for loops
PROMPT2='{%_} '
# prompt for selections
PROMPT3='{ ⦠} '
# So far I don't use "setopt xtrace", so I don't need this prompt
PROMPT4=''
# auto extension alias
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
# no autocorrection for mv and cp
alias mv='nocorrect mv'
alias cp='nocorrect cp'
# normal alias
alias ls='ls --color=auto -F'
alias ll='ls -lh'
alias la='ls -a'
alias e=$EDITOR
alias se='sudo $EDITOR'
alias grep='grep --color=auto'
alias p='sudo pacman'
alias y='yaourt'
alias popt='sudo pacman-optimize && sync'
alias info='echo Dependencies: && pacman -Qd | wc -l && echo Explicitly: && pacman -Qe | wc -l && echo Total: && pacman -Q | wc -l'
alias R='y -Rscn'
alias Syu='y -Syu'
alias S='y -S'
alias Ss='y -Ss'
alias clean='y -Qdt && y -Scc'
alias su='su -'
alias t='task'
alias ta='task add'
alias tl='task list'
# alias for git
alias ga='git add'
alias gpush='git push'
alias gs='git status -sb'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpull='git pull'
alias gcl='git clone'
alias gl='git log'
alias glo='git log --oneline --graph --decorate'
gldate() {
before=`date -d "$(date +$1) -1 day" +'%Y-%m-%d'`
git log --oneline --graph --decorate --since="$before" --until="$1"
}
#set TERM only for ssh
alias ssh='env TERM=rxvt-unicode ssh'
# key bindings (vim mode)
bindkey -v
bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\ee[C" forward-word
bindkey "\ee[D" backward-word
bindkey "\^H" backward-delete-word
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix
bindkey '^R' history-incremental-search-backward
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
#edit current line in vim
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# tmux ?
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
# hashes
hash -d da=~/fh-hagenberg/da
# extract various files with x $arg
function x()
{
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.bz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.tar.xz) tar -Jxf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted." ;;
esac
else
echo "'$1' is not a valid archive."
fi
}
# generate a random password
function random(){
< /dev/urandom tr -dc '[](){}?!.,;_A-Z-a-z-0-9' | head -c${1:-20};echo;
}
# obtain public ip addresses (v4 and v6) if available
function hostip(){
IPV6=`curl -s ipv6.icanhazipv6.com |grep my_address |sed -e 's/.*>\(.*\)<\/p>/\1/'`
IPV4=`curl -s ifconfig.me/ip`
if [ -z "$IPV6" ]; then
echo "IPv6: -"
else
echo "IPv6: ${IPV6}"
fi
if [ -z "$IPV4" ]; then
echo "IPv4: -"
else
echo "IPv4: ${IPV4}"
fi
}
# serve local dir via http
function serve(){
SERVE_PORT=8080
echo "listening on:"
- ip addr s | grep -Eo 'inet [^/]*' | sort | uniq |awk -v P=$SERVE_PORT '{print " - " $2 ":" P}'
+ ip addr s | grep -Eo 'inet [^/]*' | sort | uniq |awk -v P=$SERVE_PORT '{print " - http://" $2 ":" P}'
python -m http.server $SERVE_PORT 1>/dev/null
unset $SERVE_PORT
}
# a shortcut for cropping pages with pdfcrop
function crop()
pdfcrop --pdftexcmd pdflatex --margins 2 "$1" "${1%.pdf}-cropped.pdf"
# virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
|
nblock/config | 4501444153060f5683ef35fce6d1007450d9cae9 | Use the same font for the i3bar. | diff --git a/config/i3/config b/config/i3/config
index 72c536a..e469ee7 100644
--- a/config/i3/config
+++ b/config/i3/config
@@ -1,201 +1,199 @@
# i3 config file (v4)
# nblock (at) archlinux (dot) us
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# window title font
font pango:Bitstream Vera Sans Mono 10
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4
# start a terminal
bindsym Mod4+Return exec urxvtc
# kill focused window
bindsym Mod4+Shift+c kill
# start dmenu (a program launcher)
bindsym Mod4+x exec "$HOME/bin/dmenu_multi"
# change focus
bindsym Mod4+n focus left
bindsym Mod4+r focus right
bindsym Mod4+t focus up
bindsym Mod4+d focus down
# move focused window
bindsym Mod4+Shift+n move left
bindsym Mod4+Shift+r move right
bindsym Mod4+Shift+t move up
bindsym Mod4+Shift+d move down
# switch to next/prev workspace
# TODO switch to other screens
bindsym Mod4+Left workspace prev
bindsym Mod4+Right workspace next
#bindsym Mod4+Up focus up
#bindsym Mod4+Down focus down #
# move container and workspaces to a different screen
bindsym Mod4+Shift+Left move container to output left
bindsym Mod4+Shift+Right move container to output right
bindsym Mod4+Shift+Up move workspace to output left
bindsym Mod4+Shift+Down move workspace to output right
# split in horizontal/vertical orientation
bindsym Mod4+h split h
bindsym Mod4+v split v
# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen
# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split
# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod4+space focus mode_toggle
# focus the parent container
bindsym Mod4+a focus parent
# focus the child container
bindsym Mod4+i focus child
# use a 2 monitor split setup where each screen has an equal amount of workspaces
workspace 1 output HDMI1
workspace 2 output HDMI1
workspace 3 output HDMI1
workspace 4 output HDMI1
workspace 5 output HDMI1
workspace 6 output LVDS1
workspace 7 output LVDS1
workspace 8 output LVDS1
workspace 9 output LVDS1
workspace 10 output LVDS1
# switch to workspace
bindsym Mod4+1 workspace 1
bindsym Mod4+2 workspace 2
bindsym Mod4+3 workspace 3
bindsym Mod4+4 workspace 4
bindsym Mod4+5 workspace 5
bindsym Mod4+6 workspace 6
bindsym Mod4+7 workspace 7
bindsym Mod4+8 workspace 8
bindsym Mod4+9 workspace 9
bindsym Mod4+0 workspace 10
# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace 1
bindsym Mod4+Shift+2 move container to workspace 2
bindsym Mod4+Shift+3 move container to workspace 3
bindsym Mod4+Shift+4 move container to workspace 4
bindsym Mod4+Shift+5 move container to workspace 5
bindsym Mod4+Shift+6 move container to workspace 6
bindsym Mod4+Shift+7 move container to workspace 7
bindsym Mod4+Shift+8 move container to workspace 8
bindsym Mod4+Shift+9 move container to workspace 9
bindsym Mod4+Shift+0 move container to workspace 10
# quickly navigate back to previous window
workspace_auto_back_and_forth yes
# reload the configuration file
bindsym Mod4+Shift+q reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+y restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windowâs width.
# Pressing right will grow the windowâs width.
# Pressing up will shrink the windowâs height.
# Pressing down will grow the windowâs height.
bindsym n resize shrink width 10 px or 10 ppt
bindsym r resize grow width 10 px or 10 ppt
bindsym r resize shrink height 10 px or 10 ppt
bindsym t resize grow height 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+y mode "resize"
# valid for my Thinkpad
bindsym XF86ScreenSaver exec "i3lock -d -c 000000"
bindsym XF86AudioMute exec "amixer sset PCM toggle"
bindsym XF86AudioRaiseVolume exec "amixer set PCM 2%+"
bindsym XF86AudioLowerVolume exec "amixer set PCM 2%-"
bindsym XF86AudioNext exec "cmus-remote --next"
bindsym XF86AudioPrev exec "cmus-remote --prev"
bindsym XF86AudioPlay exec "cmus-remote --pause"
bindsym XF86AudioStop exec "cmus-remote --stop"
bindsym XF86Sleep exec "systemctl suspend"
bindsym XF86WebCam exec "$HOME/bin/bluetooth-toggle.sh"
bindsym XF86TouchpadToggle exec "$HOME/bin/touchpad-toggle.sh"
# currently unused
#bindsym XF86Tools exec "something"
#bindsym XF86Calculator exec "something"
#bindsym XF86Launch1 exec "something" # ThinkVantage
#bindsym XF86Display exec "something" # fn - f7
# focus popular clients by title/class
bindsym Mod4+Mod1+f [class="(?i)firefox"] focus
bindsym Mod4+Mod1+t [class="(?i)thunderbird"] focus
bindsym Mod4+Mod1+p [class="(?i)pidgin" window_role="conversation"] focus
bindsym Mod4+Mod1+b [class="(?i)pidgin" window_role="buddy_list"] focus
bindsym Mod4+Mod1+k [class="(?i)keepassx"] focus
bindsym Mod4+Mod1+c [title="(?i)cmus"] focus
bindsym Mod4+Mod1+n [title="(?i)newsbeuter"] focus
bindsym Mod4+Mod1+j [title="JDownloader"] focus
# colors
# class border backgr. text indicator
client.focused #4c7899 #285577 #ffffff #ff0000
client.focused_inactive #333333 #5f676a #ffffff #484e50
client.unfocused #333333 #222222 #888888 #292d2e
client.urgent #2f343a #900000 #ffffff #900000
# wallpaper
exec --no-startup-id feh --bg-scale "$HOME/bilder/wallpaper/1440x900/arch_wall-by_kpolicano-1440x900.jpg"
# autostart
exec "firefox"
exec "thunderbird"
exec "pidgin"
# The status bar
bar {
status_command i3status
position top
- # use anothor font to get the separator in a different color
- font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
colors {
statusline #00ff00
# color_class border backg. text
focused_workspace #4c7899 #285577 #00ff00
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
|
nblock/config | da9d395ed6558a5ecb852e5c3866a20bfb40a3a7 | Add vim-unimpaired and enable line numbering by default. | diff --git a/vimrc b/vimrc
index 17436bc..60d26d3 100644
--- a/vimrc
+++ b/vimrc
@@ -1,220 +1,222 @@
" File: .vimrc
" Author: nblock <nblock [/at\] archlinux DOT us>
" Description: just another .vimrc
" Last Modified: Dezember 10th, 2011
set nocompatible
set nobackup
set nowritebackup
set noswapfile
set showmode " always display current mode
set showcmd " always display current command
set showmatch " show matching brackets (),{},[]
set mat=3 " show matching brackets for 0.3 seconds
set encoding=utf-8 " use utf-8 everywhere
set fileencoding=utf-8 " use utf-8 everywhere
set termencoding=utf-8 " use utf-8 everywhere
set backspace=indent,eol,start " more flexible backspace
set mouse=a " enable mouse usage in all modes
set incsearch " jump to match during searching
set hlsearch " highlight search
set ttyfast " fast terminal connection
set scrolloff=4 " 4 lines above/below cursor when scrolling
set listchars=tab:â¸\ ,eol:¬ " different symbols for tabs and eol
set nomodeline " use secure modeline
set tabpagemax=30 " 30 instead of 10 concurrent tabs
set ignorecase " ignore the case on searches
set smartcase " lowerspace search will ignore case, uppercase will honor the case
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
+set number " enable line numbering
" use a terminal title
set title
set titlestring=%F\ [vim]
" tab settings
set tabstop=2 " tab character amount
set expandtab " tabs as space
set autoindent
set smartindent " smart autoindenting on a new line
set shiftwidth=2 " set spaces for autoindent
set softtabstop=2
" statusline
set laststatus=2
set statusline=%<%F\ %h%m%r%=%k\ %-10.(%l/%L,%c%V%)\ %P\ [%{&encoding}:%{&fileformat}]%(\ %w%)\ %y
" vundle settings
filetype off "required by vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"plugins managed by vundle
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-speeddating'
Bundle 'godlygeek/tabular'
Bundle 'git://gitorious.org/vim-gnupg/vim-gnupg.git'
Bundle 'matchit.zip'
Bundle 'fs111/pydoc.vim'
Bundle 'paster.vim'
Bundle 'kien/ctrlp.vim'
Bundle 'majutsushi/tagbar'
Bundle 'ciaranm/securemodelines'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/syntastic'
Bundle 'SirVer/ultisnips'
Bundle 'nblock/vim-dokuwiki'
Bundle 'SudoEdit.vim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'Lokaltog/vim-powerline'
Bundle 'sjl/gundo.vim'
Bundle 'vim-scripts/AutoTag'
Bundle 'vim-scripts/restore_view.vim'
Bundle 'Valloric/YouCompleteMe'
+Bundle 'tpope/vim-unimpaired'
filetype plugin indent on " required by vundle
" switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "de", "en" ]
function! MySpellLang()
" loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=de | endif
if g:myLang == 2 | setlocal spell spelllang=en | endif
echo "language:" g:myLangList[g:myLang]
endf
" call the python version that is specified in the shebang
" in Arch Linux, `python` is Python 3.x
function! ExecSpecifiedPython()
let lc = getline(1)
" check if shebang is present
if stridx(lc, "python") == -1
let py = '!/usr/bin/python2 "%"' " default to python2
else
let lc = substitute(lc,"#", "", "g")
let lc = substitute(lc,"env ", "", "g")
let py = lc . ' "%"'
endif
exec py
endfunction
" cleaning up
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" shortcuts and mappings
let mapleader = ","
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O><F2>
set pastetoggle=<F2>
map <F3> :nohlsearch<CR>
autocmd FileType python map <F5> :w<CR>:call ExecSpecifiedPython()<CR>
autocmd FileType tex map <F5> :w<CR>:!latexmk -pdf "%"<CR>
map <F6> :w<CR>:!make<CR>
vmap <F9> :!xclip -f -sel clip<CR>
map <F10> :-1r !xclip -o -sel clip<CR>
nnoremap <silent> <F11> :TagbarToggle<CR>
map <F12> <C-]>
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
nmap <leader>$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap <leader>= :call Preserve("normal gg=G")<CR>
nnoremap <F9> :GundoToggle<CR>
map <leader>cf [[kV][,c<space><CR>
" switch between buffers
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>h <C-w>h
nnoremap <leader>l <C-w>l
nnoremap <leader>w <C-w>w
nnoremap <leader><space> <C-w>r
" enable very magic forward/backward search
nnoremap / /\v
vnoremap / /\v
nnoremap ? ?\v
vnoremap ? ?\v
let g:tex_flavor = "latex" " assume latex as default tex
" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<leader><tab>"
let g:UltiSnipsDontReverseSearchPath="1"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "nblock-snippets"]
py import sys; sys.path.append("/home/flo/.vim/nblock-snippets")
"syntastic
let g:syntastic_error_symbol='E'
let g:syntastic_style_error_symbol='e'
let g:syntastic_warning_symbol='W'
let g:syntastic_style_warning_symbol='w'
" vim-pydiction
filetype plugin on
let g:pydiction_location = '/usr/share/pydiction/complete-dict'
"gnupg.vim
let g:GPGUsePipes = 1
" tagbar latex support
let g:tagbar_type_tex = {
\ 'ctagstype' : 'latex',
\ 'kinds' : [
\ 's:sections',
\ 'g:graphics',
\ 'l:labels',
\ 'r:refs:1',
\ 'L:listings',
\ 'p:pagerefs:1'
\ ],
\ 'sort' : 0,
\ }
" tagbar mediawiki support
autocmd FileType mediawiki :!ctags %
let g:tagbar_type_mediawiki = {
\ 'ctagstype' : 'mediawiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
" YouCompleteMe
" disable <tab>, <s-tab> as it is used by UltiSnips, c-n and c-p work just fine
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
" CtrlP
let g:ctrlp_cmd = 'CtrlPMixed'
" settings for different filetypes
autocmd BufNewFile,BufRead PKGBUILD setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType tex setlocal textwidth=120 tabstop=2 shiftwidth=2 softtabstop=2 expandtab smartindent autoindent
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab smartindent autoindent foldmethod=indent
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete " change omnifunc for python
autocmd BufWritePre *.py,*.tex :call Preserve("%s/\\s\\+$//e") " clean up whitespaces for certain filetypes
" colorscheme settings
syntax enable
set background=dark
colorscheme solarized
|
nblock/config | df952c0acd3da1a4998483efb974ec826fbc5aaf | Switch from command-t to CtrlP. | diff --git a/vimrc b/vimrc
index 1e1c52d..17436bc 100644
--- a/vimrc
+++ b/vimrc
@@ -1,217 +1,220 @@
" File: .vimrc
" Author: nblock <nblock [/at\] archlinux DOT us>
" Description: just another .vimrc
" Last Modified: Dezember 10th, 2011
set nocompatible
set nobackup
set nowritebackup
set noswapfile
set showmode " always display current mode
set showcmd " always display current command
set showmatch " show matching brackets (),{},[]
set mat=3 " show matching brackets for 0.3 seconds
set encoding=utf-8 " use utf-8 everywhere
set fileencoding=utf-8 " use utf-8 everywhere
set termencoding=utf-8 " use utf-8 everywhere
set backspace=indent,eol,start " more flexible backspace
set mouse=a " enable mouse usage in all modes
set incsearch " jump to match during searching
set hlsearch " highlight search
set ttyfast " fast terminal connection
set scrolloff=4 " 4 lines above/below cursor when scrolling
set listchars=tab:â¸\ ,eol:¬ " different symbols for tabs and eol
set nomodeline " use secure modeline
set tabpagemax=30 " 30 instead of 10 concurrent tabs
set ignorecase " ignore the case on searches
set smartcase " lowerspace search will ignore case, uppercase will honor the case
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
" use a terminal title
set title
set titlestring=%F\ [vim]
" tab settings
set tabstop=2 " tab character amount
set expandtab " tabs as space
set autoindent
set smartindent " smart autoindenting on a new line
set shiftwidth=2 " set spaces for autoindent
set softtabstop=2
" statusline
set laststatus=2
set statusline=%<%F\ %h%m%r%=%k\ %-10.(%l/%L,%c%V%)\ %P\ [%{&encoding}:%{&fileformat}]%(\ %w%)\ %y
" vundle settings
filetype off "required by vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"plugins managed by vundle
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-speeddating'
Bundle 'godlygeek/tabular'
Bundle 'git://gitorious.org/vim-gnupg/vim-gnupg.git'
Bundle 'matchit.zip'
Bundle 'fs111/pydoc.vim'
Bundle 'paster.vim'
+Bundle 'kien/ctrlp.vim'
Bundle 'majutsushi/tagbar'
-Bundle 'git://git.wincent.com/command-t.git'
Bundle 'ciaranm/securemodelines'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/syntastic'
Bundle 'SirVer/ultisnips'
Bundle 'nblock/vim-dokuwiki'
Bundle 'SudoEdit.vim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'Lokaltog/vim-powerline'
Bundle 'sjl/gundo.vim'
Bundle 'vim-scripts/AutoTag'
Bundle 'vim-scripts/restore_view.vim'
Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on " required by vundle
" switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "de", "en" ]
function! MySpellLang()
" loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=de | endif
if g:myLang == 2 | setlocal spell spelllang=en | endif
echo "language:" g:myLangList[g:myLang]
endf
" call the python version that is specified in the shebang
" in Arch Linux, `python` is Python 3.x
function! ExecSpecifiedPython()
let lc = getline(1)
" check if shebang is present
if stridx(lc, "python") == -1
let py = '!/usr/bin/python2 "%"' " default to python2
else
let lc = substitute(lc,"#", "", "g")
let lc = substitute(lc,"env ", "", "g")
let py = lc . ' "%"'
endif
exec py
endfunction
" cleaning up
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" shortcuts and mappings
let mapleader = ","
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O><F2>
set pastetoggle=<F2>
map <F3> :nohlsearch<CR>
autocmd FileType python map <F5> :w<CR>:call ExecSpecifiedPython()<CR>
autocmd FileType tex map <F5> :w<CR>:!latexmk -pdf "%"<CR>
map <F6> :w<CR>:!make<CR>
vmap <F9> :!xclip -f -sel clip<CR>
map <F10> :-1r !xclip -o -sel clip<CR>
nnoremap <silent> <F11> :TagbarToggle<CR>
map <F12> <C-]>
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
nmap <leader>$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap <leader>= :call Preserve("normal gg=G")<CR>
nnoremap <F9> :GundoToggle<CR>
map <leader>cf [[kV][,c<space><CR>
" switch between buffers
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>h <C-w>h
nnoremap <leader>l <C-w>l
nnoremap <leader>w <C-w>w
nnoremap <leader><space> <C-w>r
" enable very magic forward/backward search
nnoremap / /\v
vnoremap / /\v
nnoremap ? ?\v
vnoremap ? ?\v
let g:tex_flavor = "latex" " assume latex as default tex
" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<leader><tab>"
let g:UltiSnipsDontReverseSearchPath="1"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "nblock-snippets"]
py import sys; sys.path.append("/home/flo/.vim/nblock-snippets")
"syntastic
let g:syntastic_error_symbol='E'
let g:syntastic_style_error_symbol='e'
let g:syntastic_warning_symbol='W'
let g:syntastic_style_warning_symbol='w'
" vim-pydiction
filetype plugin on
let g:pydiction_location = '/usr/share/pydiction/complete-dict'
"gnupg.vim
let g:GPGUsePipes = 1
" tagbar latex support
let g:tagbar_type_tex = {
\ 'ctagstype' : 'latex',
\ 'kinds' : [
\ 's:sections',
\ 'g:graphics',
\ 'l:labels',
\ 'r:refs:1',
\ 'L:listings',
\ 'p:pagerefs:1'
\ ],
\ 'sort' : 0,
\ }
" tagbar mediawiki support
autocmd FileType mediawiki :!ctags %
let g:tagbar_type_mediawiki = {
\ 'ctagstype' : 'mediawiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
" YouCompleteMe
" disable <tab>, <s-tab> as it is used by UltiSnips, c-n and c-p work just fine
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
+" CtrlP
+let g:ctrlp_cmd = 'CtrlPMixed'
+
" settings for different filetypes
autocmd BufNewFile,BufRead PKGBUILD setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType tex setlocal textwidth=120 tabstop=2 shiftwidth=2 softtabstop=2 expandtab smartindent autoindent
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab smartindent autoindent foldmethod=indent
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete " change omnifunc for python
autocmd BufWritePre *.py,*.tex :call Preserve("%s/\\s\\+$//e") " clean up whitespaces for certain filetypes
" colorscheme settings
syntax enable
set background=dark
colorscheme solarized
|
nblock/config | a58d7417b00043902bfb31635e4b0a302499a2ff | Try YouCompleteMe | diff --git a/vimrc b/vimrc
index 6da678d..1e1c52d 100644
--- a/vimrc
+++ b/vimrc
@@ -1,215 +1,217 @@
" File: .vimrc
" Author: nblock <nblock [/at\] archlinux DOT us>
" Description: just another .vimrc
" Last Modified: Dezember 10th, 2011
set nocompatible
set nobackup
set nowritebackup
set noswapfile
set showmode " always display current mode
set showcmd " always display current command
set showmatch " show matching brackets (),{},[]
set mat=3 " show matching brackets for 0.3 seconds
set encoding=utf-8 " use utf-8 everywhere
set fileencoding=utf-8 " use utf-8 everywhere
set termencoding=utf-8 " use utf-8 everywhere
set backspace=indent,eol,start " more flexible backspace
set mouse=a " enable mouse usage in all modes
set incsearch " jump to match during searching
set hlsearch " highlight search
set ttyfast " fast terminal connection
set scrolloff=4 " 4 lines above/below cursor when scrolling
set listchars=tab:â¸\ ,eol:¬ " different symbols for tabs and eol
set nomodeline " use secure modeline
set tabpagemax=30 " 30 instead of 10 concurrent tabs
set ignorecase " ignore the case on searches
set smartcase " lowerspace search will ignore case, uppercase will honor the case
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
" use a terminal title
set title
set titlestring=%F\ [vim]
" tab settings
set tabstop=2 " tab character amount
set expandtab " tabs as space
set autoindent
set smartindent " smart autoindenting on a new line
set shiftwidth=2 " set spaces for autoindent
set softtabstop=2
" statusline
set laststatus=2
set statusline=%<%F\ %h%m%r%=%k\ %-10.(%l/%L,%c%V%)\ %P\ [%{&encoding}:%{&fileformat}]%(\ %w%)\ %y
" vundle settings
filetype off "required by vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"plugins managed by vundle
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-speeddating'
Bundle 'godlygeek/tabular'
Bundle 'git://gitorious.org/vim-gnupg/vim-gnupg.git'
Bundle 'matchit.zip'
Bundle 'fs111/pydoc.vim'
Bundle 'paster.vim'
Bundle 'majutsushi/tagbar'
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'ciaranm/securemodelines'
Bundle 'scrooloose/nerdcommenter'
-Bundle 'AutoComplPop'
Bundle 'scrooloose/syntastic'
Bundle 'SirVer/ultisnips'
Bundle 'nblock/vim-dokuwiki'
Bundle 'SudoEdit.vim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'Lokaltog/vim-powerline'
Bundle 'sjl/gundo.vim'
Bundle 'vim-scripts/AutoTag'
Bundle 'vim-scripts/restore_view.vim'
+Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on " required by vundle
" switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "de", "en" ]
function! MySpellLang()
" loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=de | endif
if g:myLang == 2 | setlocal spell spelllang=en | endif
echo "language:" g:myLangList[g:myLang]
endf
" call the python version that is specified in the shebang
" in Arch Linux, `python` is Python 3.x
function! ExecSpecifiedPython()
let lc = getline(1)
" check if shebang is present
if stridx(lc, "python") == -1
let py = '!/usr/bin/python2 "%"' " default to python2
else
let lc = substitute(lc,"#", "", "g")
let lc = substitute(lc,"env ", "", "g")
let py = lc . ' "%"'
endif
exec py
endfunction
" cleaning up
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" shortcuts and mappings
let mapleader = ","
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O><F2>
set pastetoggle=<F2>
map <F3> :nohlsearch<CR>
autocmd FileType python map <F5> :w<CR>:call ExecSpecifiedPython()<CR>
autocmd FileType tex map <F5> :w<CR>:!latexmk -pdf "%"<CR>
map <F6> :w<CR>:!make<CR>
vmap <F9> :!xclip -f -sel clip<CR>
map <F10> :-1r !xclip -o -sel clip<CR>
nnoremap <silent> <F11> :TagbarToggle<CR>
map <F12> <C-]>
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
nmap <leader>$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap <leader>= :call Preserve("normal gg=G")<CR>
nnoremap <F9> :GundoToggle<CR>
map <leader>cf [[kV][,c<space><CR>
" switch between buffers
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>h <C-w>h
nnoremap <leader>l <C-w>l
nnoremap <leader>w <C-w>w
nnoremap <leader><space> <C-w>r
" enable very magic forward/backward search
nnoremap / /\v
vnoremap / /\v
nnoremap ? ?\v
vnoremap ? ?\v
let g:tex_flavor = "latex" " assume latex as default tex
-" UltiSnip
+" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<leader><tab>"
let g:UltiSnipsDontReverseSearchPath="1"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "nblock-snippets"]
py import sys; sys.path.append("/home/flo/.vim/nblock-snippets")
"syntastic
let g:syntastic_error_symbol='E'
let g:syntastic_style_error_symbol='e'
let g:syntastic_warning_symbol='W'
let g:syntastic_style_warning_symbol='w'
" vim-pydiction
filetype plugin on
let g:pydiction_location = '/usr/share/pydiction/complete-dict'
"gnupg.vim
let g:GPGUsePipes = 1
" tagbar latex support
let g:tagbar_type_tex = {
\ 'ctagstype' : 'latex',
\ 'kinds' : [
\ 's:sections',
\ 'g:graphics',
\ 'l:labels',
\ 'r:refs:1',
\ 'L:listings',
\ 'p:pagerefs:1'
\ ],
\ 'sort' : 0,
\ }
" tagbar mediawiki support
autocmd FileType mediawiki :!ctags %
let g:tagbar_type_mediawiki = {
\ 'ctagstype' : 'mediawiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
-"AutoComplPop
-let g:acp_behaviorKeywordLength=4 "start matching after 4 consecutive chars -> less cpu consumption
+" YouCompleteMe
+" disable <tab>, <s-tab> as it is used by UltiSnips, c-n and c-p work just fine
+let g:ycm_key_list_select_completion = ['<Down>']
+let g:ycm_key_list_previous_completion = ['<Up>']
" settings for different filetypes
autocmd BufNewFile,BufRead PKGBUILD setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd FileType tex setlocal textwidth=120 tabstop=2 shiftwidth=2 softtabstop=2 expandtab smartindent autoindent
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab smartindent autoindent foldmethod=indent
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete " change omnifunc for python
autocmd BufWritePre *.py,*.tex :call Preserve("%s/\\s\\+$//e") " clean up whitespaces for certain filetypes
" colorscheme settings
syntax enable
set background=dark
colorscheme solarized
|
nblock/config | 4125b88bc0b60234b366af970d547e7ed5eaf55d | Remove make rule from ctags. | diff --git a/ctags b/ctags
index 1891ced..f4ada69 100644
--- a/ctags
+++ b/ctags
@@ -1,25 +1,24 @@
--langdef=latex
--langmap=latex:.tex
--regex-latex=/^\\part[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/part \2/s,part/
--regex-latex=/^\\part[[:space:]]*\*[[:space:]]*\{([^}]+)\}/part \1/s,part/
--regex-latex=/^\\chapter[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/ \2/s,chapter/
--regex-latex=/^\\chapter[[:space:]]*\*[[:space:]]*\{([^}]+)\}/ \1/s,chapter/
--regex-latex=/^\\section[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\. \2/s,section/
--regex-latex=/^\\section[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\. \1/s,section/
--regex-latex=/^\\subsection[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\.\. \2/s,subsection/
--regex-latex=/^\\subsection[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\.\. \1/s,subsection/
--regex-latex=/^\\subsubsection[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\.\.\. \2/s,subsubsection/
--regex-latex=/^\\subsubsection[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\.\.\. \1/s,subsubsection/
--regex-latex=/^\\includegraphics[[:space:]]*(\[[^]]*\])?[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\3/g,graphic/
--regex-latex=/^\\lstinputlisting[[:space:]]*(\[[^]]*\])?[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\3/L,listing/
--regex-latex=/\\label[[:space:]]*\{([^}]+)\}/\1/l,label/
--regex-latex=/\\ref[[:space:]]*\{([^}]+)\}/\1/r,ref/
--regex-latex=/\\pageref[[:space:]]*\{([^}]+)\}/\1/p,pageref/
---regex-make=/^([^:# \t]+)[ \t]*[:]{1,2}/\1/t,targets/
--langdef=mediawiki
--langmap=mediawiki:.wiki
--regex-mediawiki=/^=[[:space:]]?([^=]+)[[:space:]]?=$/\1/h,header/
--regex-mediawiki=/^==[[:space:]]?([^=]+)[[:space:]]?==$/. \1/h,header/
--regex-mediawiki=/^===[[:space:]]?([^=]+)[[:space:]]?===$/. \1/h,header/
--regex-mediawiki=/^====[[:space:]]?([^=]+)[[:space:]]?====$/. \1/h,header/
--regex-mediawiki=/^=====[[:space:]]?([^=]+)[[:space:]]?=====$/. \1/h,header/
|
nblock/config | a6eb3f76b9afc87430b7699ce1c38c5ff34b55e0 | Autostart and better focus for Pidgin. | diff --git a/config/i3/config b/config/i3/config
index d1c512c..72c536a 100644
--- a/config/i3/config
+++ b/config/i3/config
@@ -1,195 +1,201 @@
# i3 config file (v4)
# nblock (at) archlinux (dot) us
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# window title font
font pango:Bitstream Vera Sans Mono 10
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4
# start a terminal
bindsym Mod4+Return exec urxvtc
# kill focused window
bindsym Mod4+Shift+c kill
# start dmenu (a program launcher)
bindsym Mod4+x exec "$HOME/bin/dmenu_multi"
# change focus
bindsym Mod4+n focus left
bindsym Mod4+r focus right
bindsym Mod4+t focus up
bindsym Mod4+d focus down
# move focused window
bindsym Mod4+Shift+n move left
bindsym Mod4+Shift+r move right
bindsym Mod4+Shift+t move up
bindsym Mod4+Shift+d move down
# switch to next/prev workspace
# TODO switch to other screens
bindsym Mod4+Left workspace prev
bindsym Mod4+Right workspace next
#bindsym Mod4+Up focus up
#bindsym Mod4+Down focus down #
# move container and workspaces to a different screen
bindsym Mod4+Shift+Left move container to output left
bindsym Mod4+Shift+Right move container to output right
bindsym Mod4+Shift+Up move workspace to output left
bindsym Mod4+Shift+Down move workspace to output right
# split in horizontal/vertical orientation
bindsym Mod4+h split h
bindsym Mod4+v split v
# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen
# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split
# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod4+space focus mode_toggle
# focus the parent container
bindsym Mod4+a focus parent
# focus the child container
bindsym Mod4+i focus child
# use a 2 monitor split setup where each screen has an equal amount of workspaces
workspace 1 output HDMI1
workspace 2 output HDMI1
workspace 3 output HDMI1
workspace 4 output HDMI1
workspace 5 output HDMI1
workspace 6 output LVDS1
workspace 7 output LVDS1
workspace 8 output LVDS1
workspace 9 output LVDS1
workspace 10 output LVDS1
# switch to workspace
bindsym Mod4+1 workspace 1
bindsym Mod4+2 workspace 2
bindsym Mod4+3 workspace 3
bindsym Mod4+4 workspace 4
bindsym Mod4+5 workspace 5
bindsym Mod4+6 workspace 6
bindsym Mod4+7 workspace 7
bindsym Mod4+8 workspace 8
bindsym Mod4+9 workspace 9
bindsym Mod4+0 workspace 10
# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace 1
bindsym Mod4+Shift+2 move container to workspace 2
bindsym Mod4+Shift+3 move container to workspace 3
bindsym Mod4+Shift+4 move container to workspace 4
bindsym Mod4+Shift+5 move container to workspace 5
bindsym Mod4+Shift+6 move container to workspace 6
bindsym Mod4+Shift+7 move container to workspace 7
bindsym Mod4+Shift+8 move container to workspace 8
bindsym Mod4+Shift+9 move container to workspace 9
bindsym Mod4+Shift+0 move container to workspace 10
# quickly navigate back to previous window
workspace_auto_back_and_forth yes
# reload the configuration file
bindsym Mod4+Shift+q reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+y restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windowâs width.
# Pressing right will grow the windowâs width.
# Pressing up will shrink the windowâs height.
# Pressing down will grow the windowâs height.
bindsym n resize shrink width 10 px or 10 ppt
bindsym r resize grow width 10 px or 10 ppt
bindsym r resize shrink height 10 px or 10 ppt
bindsym t resize grow height 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+y mode "resize"
# valid for my Thinkpad
bindsym XF86ScreenSaver exec "i3lock -d -c 000000"
bindsym XF86AudioMute exec "amixer sset PCM toggle"
bindsym XF86AudioRaiseVolume exec "amixer set PCM 2%+"
bindsym XF86AudioLowerVolume exec "amixer set PCM 2%-"
bindsym XF86AudioNext exec "cmus-remote --next"
bindsym XF86AudioPrev exec "cmus-remote --prev"
bindsym XF86AudioPlay exec "cmus-remote --pause"
bindsym XF86AudioStop exec "cmus-remote --stop"
bindsym XF86Sleep exec "systemctl suspend"
bindsym XF86WebCam exec "$HOME/bin/bluetooth-toggle.sh"
bindsym XF86TouchpadToggle exec "$HOME/bin/touchpad-toggle.sh"
# currently unused
#bindsym XF86Tools exec "something"
#bindsym XF86Calculator exec "something"
#bindsym XF86Launch1 exec "something" # ThinkVantage
#bindsym XF86Display exec "something" # fn - f7
# focus popular clients by title/class
bindsym Mod4+Mod1+f [class="(?i)firefox"] focus
bindsym Mod4+Mod1+t [class="(?i)thunderbird"] focus
-bindsym Mod4+Mod1+p [class="(?i)pidgin"] focus
+bindsym Mod4+Mod1+p [class="(?i)pidgin" window_role="conversation"] focus
+bindsym Mod4+Mod1+b [class="(?i)pidgin" window_role="buddy_list"] focus
bindsym Mod4+Mod1+k [class="(?i)keepassx"] focus
bindsym Mod4+Mod1+c [title="(?i)cmus"] focus
bindsym Mod4+Mod1+n [title="(?i)newsbeuter"] focus
-bindsym Mod4+Mod1+j [title="(?i)jdownloader"] focus
+bindsym Mod4+Mod1+j [title="JDownloader"] focus
# colors
# class border backgr. text indicator
client.focused #4c7899 #285577 #ffffff #ff0000
client.focused_inactive #333333 #5f676a #ffffff #484e50
client.unfocused #333333 #222222 #888888 #292d2e
client.urgent #2f343a #900000 #ffffff #900000
# wallpaper
exec --no-startup-id feh --bg-scale "$HOME/bilder/wallpaper/1440x900/arch_wall-by_kpolicano-1440x900.jpg"
+# autostart
+exec "firefox"
+exec "thunderbird"
+exec "pidgin"
+
# The status bar
bar {
status_command i3status
position top
# use anothor font to get the separator in a different color
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
colors {
statusline #00ff00
# color_class border backg. text
focused_workspace #4c7899 #285577 #00ff00
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.